diff options
author | Artur Signell <artur.signell@itmill.com> | 2011-08-11 12:56:40 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2011-08-11 12:56:40 +0000 |
commit | 3c901dcead8a829ac06b1dbdd55a033001071572 (patch) | |
tree | b79634c4d32e3317153250a9fc0fac00b83d643f | |
parent | 703f6c937387bf1011905ed0acaa930d42e1afc7 (diff) | |
download | vaadin-framework-3c901dcead8a829ac06b1dbdd55a033001071572.tar.gz vaadin-framework-3c901dcead8a829ac06b1dbdd55a033001071572.zip |
Tests for #5916
svn changeset:20303/svn branch:6.7
3 files changed, 346 insertions, 13 deletions
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 index 0000000000..4d5f4c2d17 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/table/TableGeneratedStringColumns.html @@ -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> diff --git a/tests/src/com/vaadin/tests/components/table/Tables.java b/tests/src/com/vaadin/tests/components/table/Tables.java index f663fbb48b..4ff42e7bc8 100644 --- a/tests/src/com/vaadin/tests/components/table/Tables.java +++ b/tests/src/com/vaadin/tests/components/table/Tables.java @@ -12,7 +12,6 @@ import com.vaadin.terminal.Resource; import com.vaadin.tests.components.select.AbstractSelectTestCase;
import com.vaadin.ui.AbstractSelect.MultiSelectMode;
import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
import com.vaadin.ui.Table.ColumnGenerator;
@@ -192,13 +191,15 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> };
private class GeneratedColumn {
- private Class<? extends Component> type;
+ private Class<?> type;
private String width;
+ private boolean html;
- public GeneratedColumn(Class<? extends Component> type, String width) {
+ public GeneratedColumn(Class<?> type, String width, boolean html) {
super();
this.type = type;
this.width = width;
+ this.html = html;
}
}
@@ -216,18 +217,34 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> c.addGeneratedColumn(generatedColumnId + generatedColumnNextNr,
new ColumnGenerator() {
- public Component generateCell(Table source,
- Object itemId, Object columnId) {
+ public Object generateCell(Table source, Object itemId,
+ Object columnId) {
+ String value = "";
+ if (col.html) {
+ value = "<i>" + itemId + "</i>" + "/" + "<b>"
+ + columnId + "</b>";
+ } else {
+ value = itemId + "/" + columnId;
+ }
if (col.type == Button.class) {
Button b = new Button();
- b.setCaption(itemId + "/" + columnId);
+ b.setCaption(value);
b.setWidth(col.width);
return b;
} else if (col.type == Label.class) {
Label l = new Label();
- l.setValue(itemId + "/" + columnId);
l.setWidth(col.width);
+ if (col.html) {
+ l.setValue(value);
+ l.setContentMode(Label.CONTENT_XHTML);
+ } else {
+ l.setValue(value);
+ }
return l;
+ } else if (col.type == String.class) {
+ return value;
+ } else if (col.type == Object.class) {
+ return new Object();
}
return null;
@@ -301,24 +318,36 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> String category = "Generated columns";
createCategory(category, categoryFeatures);
createClickAction("Add Button", category, addGeneratedColumnCommand,
- new GeneratedColumn(Button.class, null));
+ new GeneratedColumn(Button.class, null, false));
createClickAction("Add 200px wide Button", category,
addGeneratedColumnCommand, new GeneratedColumn(Button.class,
- "200px"));
+ "200px", false));
createClickAction("Add 100% wide Button", category,
addGeneratedColumnCommand, new GeneratedColumn(Button.class,
- "100%"));
+ "100%", false));
createClickAction("Add Label", category, addGeneratedColumnCommand,
- new GeneratedColumn(Label.class, null));
+ new GeneratedColumn(Label.class, null, false));
createClickAction("Add 100px Label", category,
addGeneratedColumnCommand, new GeneratedColumn(Label.class,
- "100px"));
+ "100px", false));
createClickAction("Add 100% wide Label", category,
addGeneratedColumnCommand, new GeneratedColumn(Label.class,
- "100%"));
+ "100%", false));
createClickAction("Remove generated columns", category,
removeGeneratedColumnsCommand, null);
+ createClickAction("Add string as generated column", category,
+ addGeneratedColumnCommand, new GeneratedColumn(String.class,
+ "", false));
+ createClickAction("Add HTML string as generated column", category,
+ addGeneratedColumnCommand, new GeneratedColumn(String.class,
+ "", true));
+ createClickAction("Add 100px HTML Label", category,
+ addGeneratedColumnCommand, new GeneratedColumn(Label.class,
+ "100px", true));
+ createClickAction("Add Object as generated column", category,
+ addGeneratedColumnCommand, new GeneratedColumn(Object.class,
+ "", false));
}
private void createColumnHeaderMode(String category) {
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 index 0000000000..09014f3aa0 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/treetable/TreeTableGeneratedColumns.html @@ -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><i>Item 1</i>/<b>Generated 4</b></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>generated-columns-label-label-string-string</td> +</tr> + +</tbody></table> +</body> +</html> |