]> source.dussan.org Git - vaadin-framework.git/commitdiff
Test application and disabled testbench script for #8076
authorLeif Åstrand <leif@vaadin.com>
Thu, 8 Dec 2011 10:53:36 +0000 (10:53 +0000)
committerLeif Åstrand <leif@vaadin.com>
Thu, 8 Dec 2011 10:53:36 +0000 (10:53 +0000)
svn changeset:22309/svn branch:6.7

tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html2 [new file with mode: 0644]
tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java [new file with mode: 0644]

diff --git a/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html2 b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html2
new file mode 100644 (file)
index 0000000..8d185b6
--- /dev/null
@@ -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>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.ProgrammaticUnselectInRange?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+       <td>23,5</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+       <td>24,3:shift</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td>
+       <td>Item 2 is selected</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td>
+       <td>Item 2 is not selected</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[0]</td>
+       <td>32,8:ctrl</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td>
+       <td>Item 2 is not selected</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java
new file mode 100644 (file)
index 0000000..758fa4b
--- /dev/null
@@ -0,0 +1,67 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+
+public class ProgrammaticUnselectInRange extends TestBase {
+
+    private static final String PROPERTY = "property";
+
+    final Label selectionLabel = new Label();
+    final Table table = new Table();
+
+    @Override
+    protected void setup() {
+        table.addContainerProperty(PROPERTY, Integer.class, "");
+
+        table.setMultiSelect(true);
+        table.setSelectable(true);
+        table.setImmediate(true);
+        table.setPageLength(5);
+
+        for (int i = 0; i < 5; i++) {
+            Integer value = Integer.valueOf(i + 1);
+            table.addItem(new Object[] { value }, value);
+        }
+        table.addListener(new Property.ValueChangeListener() {
+            public void valueChange(ValueChangeEvent event) {
+                updateSelectionLabel();
+            }
+        });
+
+        addComponent(table);
+        addComponent(selectionLabel);
+        addComponent(new Button("Deselect item 2", new Button.ClickListener() {
+            public void buttonClick(ClickEvent event) {
+                table.unselect(Integer.valueOf(2));
+            }
+        }));
+
+        updateSelectionLabel();
+    }
+
+    private void updateSelectionLabel() {
+        if (table.isSelected(Integer.valueOf(2))) {
+            selectionLabel.setValue("Item 2 is selected");
+        } else {
+            selectionLabel.setValue("Item 2 is not selected");
+        }
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Selecting items 1 - 3 using shift click, deselecting item 2 using the button and selecting item 5 using ctrl should keep item 2 deselected according to the server";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}