summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests
diff options
context:
space:
mode:
authorAnna Koskinen <anna@vaadin.com>2013-01-11 13:14:56 +0200
committerAnna Koskinen <anna@vaadin.com>2013-01-11 13:14:56 +0200
commit96845bea4d6d1f01dc0d22d2a3f19058a883eb4a (patch)
treeb633721f3652985ec7faa5bbc9e0a68b6107942f /uitest/src/com/vaadin/tests
parentf9dca2ef3f4b25ef5516fefc5cf3b037e75996cd (diff)
downloadvaadin-framework-96845bea4d6d1f01dc0d22d2a3f19058a883eb4a.tar.gz
vaadin-framework-96845bea4d6d1f01dc0d22d2a3f19058a883eb4a.zip
Merge of (#5681) to Vaadin 7.
Column collapsing optimization. Change-Id: I3b27024569ee2c5aa464ff6a63e50dcf4a90a8ba
Diffstat (limited to 'uitest/src/com/vaadin/tests')
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TooManySetColumnCollapsedCalls.html36
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TooManySetColumnCollapsedCalls.java63
2 files changed, 99 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/table/TooManySetColumnCollapsedCalls.html b/uitest/src/com/vaadin/tests/components/table/TooManySetColumnCollapsedCalls.html
new file mode 100644
index 0000000000..a234594b8f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TooManySetColumnCollapsedCalls.html
@@ -0,0 +1,36 @@
+<?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>TooManySetColumnCollapsedCalls</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TooManySetColumnCollapsedCalls</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.table.TooManySetColumnCollapsedCalls?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTooManySetColumnCollapsedCalls::PID_Stable/domChild[0]/domChild[1]</td>
+ <td>5,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTooManySetColumnCollapsedCalls::Root/VContextMenu[0]#option1</td>
+ <td>2,7</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>label</td>
+ <td>2</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/TooManySetColumnCollapsedCalls.java b/uitest/src/com/vaadin/tests/components/table/TooManySetColumnCollapsedCalls.java
new file mode 100644
index 0000000000..30921392e8
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TooManySetColumnCollapsedCalls.java
@@ -0,0 +1,63 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+
+public class TooManySetColumnCollapsedCalls extends TestBase {
+
+ private int counter = 0;
+ private Label label;
+ private Table table;
+
+ @Override
+ protected void setup() {
+ label = new Label(String.valueOf(counter));
+ label.setId("label");
+ table = createTable();
+ table.setId("table");
+ addComponent(table);
+ addComponent(label);
+ getLayout().setSpacing(true);
+ table.setColumnCollapsed("p2", true);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Table.setColumnCollapsed is called too many times in Table.changeVariables."
+ + " Collapsing column 'P3' should only increase the counter by one.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5681;
+ }
+
+ private Table createTable() {
+ Table table = new Table() {
+ @Override
+ public void setColumnCollapsed(Object propertyId, boolean collapsed)
+ throws IllegalStateException {
+ ++counter;
+ label.setValue(String.valueOf(counter));
+ super.setColumnCollapsed(propertyId, collapsed);
+ }
+ };
+ table.setWidth("400px");
+ table.setHeight("100px");
+ table.setPageLength(100);
+ table.setColumnCollapsingAllowed(true);
+ table.setImmediate(true);
+ table.addContainerProperty("p1", String.class, null);
+ table.addContainerProperty("p2", String.class, null);
+ table.addContainerProperty("p3", String.class, null);
+ table.addContainerProperty("p4", String.class, null);
+
+ for (int i = 0; i < 10; i++) {
+ table.addItem(new Object[] { "a" + i, "b" + i, "c" + i, "X" + i },
+ "" + i);
+ }
+ return table;
+ }
+
+}