summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2011-01-14 10:23:08 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2011-01-14 10:23:08 +0000
commitc7575543ac3add060a3b7a45496fcca0616e8436 (patch)
tree7d3da1dc55f6fca6bbadc7f214ba76271a0495b7 /tests
parent58196cd5ccc32c5c0dfab9e0ca5584f98a84af5b (diff)
downloadvaadin-framework-c7575543ac3add060a3b7a45496fcca0616e8436.tar.gz
vaadin-framework-c7575543ac3add060a3b7a45496fcca0616e8436.zip
#6281 : test case + test script
svn changeset:16889/svn branch:6.5
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/vaadin/tests/components/table/ContainerChangeWithPartlySamePropertyIds.html57
-rw-r--r--tests/src/com/vaadin/tests/components/table/ContainerChangeWithPartlySamePropertyIds.java107
2 files changed, 164 insertions, 0 deletions
diff --git a/tests/src/com/vaadin/tests/components/table/ContainerChangeWithPartlySamePropertyIds.html b/tests/src/com/vaadin/tests/components/table/ContainerChangeWithPartlySamePropertyIds.html
new file mode 100644
index 0000000000..6c8a770b6a
--- /dev/null
+++ b/tests/src/com/vaadin/tests/components/table/ContainerChangeWithPartlySamePropertyIds.html
@@ -0,0 +1,57 @@
+<?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>ContainerChangeWithPartlySamePropertyIds</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ContainerChangeWithPartlySamePropertyIds</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.table.ContainerChangeWithPartlySamePropertyIds?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableContainerChangeWithPartlySamePropertyIds::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>contextmenu</td>
+ <td>vaadin=runcomvaadintestscomponentstableContainerChangeWithPartlySamePropertyIds::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>property4</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>value_prop4</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableContainerChangeWithPartlySamePropertyIds::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>property1</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>value1</td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/src/com/vaadin/tests/components/table/ContainerChangeWithPartlySamePropertyIds.java b/tests/src/com/vaadin/tests/components/table/ContainerChangeWithPartlySamePropertyIds.java
new file mode 100644
index 0000000000..b8e9226ad2
--- /dev/null
+++ b/tests/src/com/vaadin/tests/components/table/ContainerChangeWithPartlySamePropertyIds.java
@@ -0,0 +1,107 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+
+public class ContainerChangeWithPartlySamePropertyIds extends TestBase {
+
+ @Override
+ protected void setup() {
+ getLayout().addComponent(new TableTestComponent());
+ }
+
+ @Override
+ protected String getDescription() {
+ return "The client side Table component messes up its internal "
+ + "data structures (in header and footer) if the container changes and it has partly"
+ + " the same properties (but in different order) than the old container.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6281;
+ }
+
+ public static class TableTestComponent extends VerticalLayout {
+
+ final TableTestComponent me = this;
+
+ Table testTable;
+ IndexedContainer containerA;
+ IndexedContainer containerB;
+
+ String property1 = "property1";
+ String property2 = "property2";
+ String property3 = "property3";
+ String property4 = "property4";
+
+ private void createContainers() {
+
+ containerA = new IndexedContainer();
+ containerA.addContainerProperty(property1, String.class, "");
+ containerA.addContainerProperty(property2, String.class, "");
+ containerA.addContainerProperty(property3, String.class, "");
+
+ Item itemA = containerA.addItem(new Object());
+ itemA.getItemProperty(property1).setValue("value1");
+ itemA.getItemProperty(property2).setValue("value2");
+ itemA.getItemProperty(property3).setValue("value3");
+
+ containerB = new IndexedContainer();
+ containerB.addContainerProperty(property4, String.class, "");
+ containerB.addContainerProperty(property3, String.class, "");
+ containerB.addContainerProperty(property2, String.class, "");
+
+ Item itemB = containerB.addItem(new Object());
+ itemB.getItemProperty(property4).setValue("value_prop4");
+ itemB.getItemProperty(property3).setValue("value_prop3");
+ itemB.getItemProperty(property2).setValue("value_prop2");
+ }
+
+ public TableTestComponent() {
+
+ Button switchContainerButton = new Button("switch container");
+ switchContainerButton.addListener(new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ if (testTable.getContainerDataSource() == containerA) {
+ testTable.setContainerDataSource(containerB);
+ } else {
+ testTable.setContainerDataSource(containerA);
+ }
+ }
+ });
+ this.addComponent(switchContainerButton);
+
+ Button clearButton = new Button("clear (click twice)");
+ clearButton.addListener(new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ try {
+ me.removeComponent(testTable);
+
+ testTable = new Table();
+ createContainers();
+ testTable.setContainerDataSource(containerA);
+
+ me.addComponent(testTable);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ this.addComponent(clearButton);
+
+ testTable = new Table();
+ this.addComponent(testTable);
+
+ createContainers();
+ testTable.setContainerDataSource(containerA);
+ }
+ }
+
+}