]> source.dussan.org Git - vaadin-framework.git/commitdiff
Tests for #5916
authorArtur Signell <artur.signell@itmill.com>
Thu, 11 Aug 2011 12:56:40 +0000 (12:56 +0000)
committerArtur Signell <artur.signell@itmill.com>
Thu, 11 Aug 2011 12:56:40 +0000 (12:56 +0000)
svn changeset:20303/svn branch:6.7

tests/src/com/vaadin/tests/components/table/TableGeneratedStringColumns.html [new file with mode: 0644]
tests/src/com/vaadin/tests/components/table/Tables.java
tests/src/com/vaadin/tests/components/treetable/TreeTableGeneratedColumns.html [new file with mode: 0644]

diff --git a/tests/src/com/vaadin/tests/components/table/TableGeneratedStringColumns.html b/tests/src/com/vaadin/tests/components/table/TableGeneratedStringColumns.html
new file mode 100644 (file)
index 0000000..4d5f4c2
--- /dev/null
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.table.Tables?restartApplication</td>
+       <td></td>
+</tr>
+<!--Hide log to allow screenshots to be consistent-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item1</td>
+       <td>23,10</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item0</td>
+       <td>58,13</td>
+</tr>
+<!--2 properties-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+       <td>31,10</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item5</td>
+       <td>36,11</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+       <td>86,8</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+       <td>22,7</td>
+</tr>
+<!--add plain string-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+       <td>27,8</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item8</td>
+       <td>37,8</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+       <td>77,10</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item7</td>
+       <td>45,10</td>
+</tr>
+<!--Add html label-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+       <td>45,21</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item8</td>
+       <td>30,2</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+       <td>109,7</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item8</td>
+       <td>71,10</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>plain-html</td>
+</tr>
+<!--set width to 900px-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+       <td>39,12</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item2</td>
+       <td>38,13</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+       <td>39,7</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item10</td>
+       <td>19,9</td>
+</tr>
+<!--Align generated string right-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+       <td>17,10</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+       <td>48,11</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+       <td>39,10</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+       <td>53,13</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item2</td>
+       <td>16,6</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>plain-right-html-left</td>
+</tr>
+</tbody></table>
+</body>
+</html>
index f663fbb48ba3ea270d3c5fb2ae4d06cc53ff4a49..4ff42e7bc848a951dcda7b924c90bf1a4bb4974d 100644 (file)
@@ -12,7 +12,6 @@ import com.vaadin.terminal.Resource;
 import com.vaadin.tests.components.select.AbstractSelectTestCase;\r
 import com.vaadin.ui.AbstractSelect.MultiSelectMode;\r
 import com.vaadin.ui.Button;\r
-import com.vaadin.ui.Component;\r
 import com.vaadin.ui.Label;\r
 import com.vaadin.ui.Table;\r
 import com.vaadin.ui.Table.ColumnGenerator;\r
@@ -192,13 +191,15 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T>
     };\r
 \r
     private class GeneratedColumn {\r
-        private Class<? extends Component> type;\r
+        private Class<?> type;\r
         private String width;\r
+        private boolean html;\r
 \r
-        public GeneratedColumn(Class<? extends Component> type, String width) {\r
+        public GeneratedColumn(Class<?> type, String width, boolean html) {\r
             super();\r
             this.type = type;\r
             this.width = width;\r
+            this.html = html;\r
         }\r
     }\r
 \r
@@ -216,18 +217,34 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T>
             c.addGeneratedColumn(generatedColumnId + generatedColumnNextNr,\r
                     new ColumnGenerator() {\r
 \r
-                        public Component generateCell(Table source,\r
-                                Object itemId, Object columnId) {\r
+                        public Object generateCell(Table source, Object itemId,\r
+                                Object columnId) {\r
+                            String value = "";\r
+                            if (col.html) {\r
+                                value = "<i>" + itemId + "</i>" + "/" + "<b>"\r
+                                        + columnId + "</b>";\r
+                            } else {\r
+                                value = itemId + "/" + columnId;\r
+                            }\r
                             if (col.type == Button.class) {\r
                                 Button b = new Button();\r
-                                b.setCaption(itemId + "/" + columnId);\r
+                                b.setCaption(value);\r
                                 b.setWidth(col.width);\r
                                 return b;\r
                             } else if (col.type == Label.class) {\r
                                 Label l = new Label();\r
-                                l.setValue(itemId + "/" + columnId);\r
                                 l.setWidth(col.width);\r
+                                if (col.html) {\r
+                                    l.setValue(value);\r
+                                    l.setContentMode(Label.CONTENT_XHTML);\r
+                                } else {\r
+                                    l.setValue(value);\r
+                                }\r
                                 return l;\r
+                            } else if (col.type == String.class) {\r
+                                return value;\r
+                            } else if (col.type == Object.class) {\r
+                                return new Object();\r
                             }\r
 \r
                             return null;\r
@@ -301,24 +318,36 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T>
         String category = "Generated columns";\r
         createCategory(category, categoryFeatures);\r
         createClickAction("Add Button", category, addGeneratedColumnCommand,\r
-                new GeneratedColumn(Button.class, null));\r
+                new GeneratedColumn(Button.class, null, false));\r
         createClickAction("Add 200px wide Button", category,\r
                 addGeneratedColumnCommand, new GeneratedColumn(Button.class,\r
-                        "200px"));\r
+                        "200px", false));\r
         createClickAction("Add 100% wide Button", category,\r
                 addGeneratedColumnCommand, new GeneratedColumn(Button.class,\r
-                        "100%"));\r
+                        "100%", false));\r
         createClickAction("Add Label", category, addGeneratedColumnCommand,\r
-                new GeneratedColumn(Label.class, null));\r
+                new GeneratedColumn(Label.class, null, false));\r
         createClickAction("Add 100px Label", category,\r
                 addGeneratedColumnCommand, new GeneratedColumn(Label.class,\r
-                        "100px"));\r
+                        "100px", false));\r
         createClickAction("Add 100% wide Label", category,\r
                 addGeneratedColumnCommand, new GeneratedColumn(Label.class,\r
-                        "100%"));\r
+                        "100%", false));\r
 \r
         createClickAction("Remove generated columns", category,\r
                 removeGeneratedColumnsCommand, null);\r
+        createClickAction("Add string as generated column", category,\r
+                addGeneratedColumnCommand, new GeneratedColumn(String.class,\r
+                        "", false));\r
+        createClickAction("Add HTML string as generated column", category,\r
+                addGeneratedColumnCommand, new GeneratedColumn(String.class,\r
+                        "", true));\r
+        createClickAction("Add 100px HTML Label", category,\r
+                addGeneratedColumnCommand, new GeneratedColumn(Label.class,\r
+                        "100px", true));\r
+        createClickAction("Add Object as generated column", category,\r
+                addGeneratedColumnCommand, new GeneratedColumn(Object.class,\r
+                        "", false));\r
     }\r
 \r
     private void createColumnHeaderMode(String category) {\r
diff --git a/tests/src/com/vaadin/tests/components/treetable/TreeTableGeneratedColumns.html b/tests/src/com/vaadin/tests/components/treetable/TreeTableGeneratedColumns.html
new file mode 100644 (file)
index 0000000..09014f3
--- /dev/null
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.treetable.TreeTableTest?restartApplication</td>
+       <td></td>
+</tr>
+<!--3 properties-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_Smenu#item0</td>
+       <td>38,13</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[0]/VMenuBar[0]#item5</td>
+       <td>50,1</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+       <td>63,9</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[2]/VMenuBar[0]#item3</td>
+       <td>32,14</td>
+</tr>
+<!--100px label-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_Smenu#item0</td>
+       <td>38,10</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[0]/VMenuBar[0]#item8</td>
+       <td>46,7</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+       <td>76,6</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[2]/VMenuBar[0]#item4</td>
+       <td>101,11</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_StestComponent/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[0]/VLabel[0]</td>
+       <td>Item 1/Generated 1</td>
+</tr>
+<!--100px html label-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_Smenu#item0</td>
+       <td>49,19</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[0]/VMenuBar[0]#item8</td>
+       <td>54,9</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+       <td>96,1</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[2]/VMenuBar[0]#item9</td>
+       <td>101,9</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_StestComponent/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[0]/VLabel[1]</td>
+       <td>Item 1/Generated 2</td>
+</tr>
+<!--plain string-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_Smenu#item0</td>
+       <td>32,9</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[0]/VMenuBar[0]#item8</td>
+       <td>44,4</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+       <td>71,4</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[2]/VMenuBar[0]#item7</td>
+       <td>143,11</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_StestComponent/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[5]/domChild[0]</td>
+       <td>Item 1/Generated 3</td>
+</tr>
+<!--html string-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_Smenu#item0</td>
+       <td>43,1</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[0]/VMenuBar[0]#item8</td>
+       <td>49,3</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+       <td>90,10</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::Root/VOverlay[2]/VMenuBar[0]#item8</td>
+       <td>135,14</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_StestComponent/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[6]/domChild[0]</td>
+       <td>&lt;i&gt;Item 1&lt;/i&gt;/&lt;b&gt;Generated 4&lt;/b&gt;</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>generated-columns-label-label-string-string</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>