]> source.dussan.org Git - vaadin-framework.git/commitdiff
[merge from 6.7] Test for #8526
authorAutomerge <automerge@vaadin.com>
Tue, 27 Mar 2012 13:15:23 +0000 (13:15 +0000)
committerAutomerge <automerge@vaadin.com>
Tue, 27 Mar 2012 13:15:23 +0000 (13:15 +0000)
svn changeset:23331/svn branch:6.8

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

diff --git a/tests/testbench/com/vaadin/tests/components/table/RowUpdateShouldRetainContextMenu.html b/tests/testbench/com/vaadin/tests/components/table/RowUpdateShouldRetainContextMenu.html
new file mode 100644 (file)
index 0000000..e13aa5a
--- /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>RowUpdateShouldRetainContextMenu</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">RowUpdateShouldRetainContextMenu</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/RowUpdateShouldRetainContextMenu?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>contextMenuAt</td>
+       <td>vaadin=runRowUpdateShouldRetainContextMenu::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[0]</td>
+       <td>10,10</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runRowUpdateShouldRetainContextMenu::Root/VContextMenu[0]#option0</td>
+       <td>Action 1</td>
+</tr>
+<tr>
+       <td>pause</td>
+       <td>2000</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runRowUpdateShouldRetainContextMenu::Root/VContextMenu[0]#option0</td>
+       <td>Action 1</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runRowUpdateShouldRetainContextMenu::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[0]</td>
+       <td>5,5</td>
+</tr>
+<tr>
+       <td>pause</td>
+       <td>2000</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertTextNotPresent</td>
+       <td>Action 2</td>
+       <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/table/RowUpdateShouldRetainContextMenu.java b/tests/testbench/com/vaadin/tests/components/table/RowUpdateShouldRetainContextMenu.java
new file mode 100644 (file)
index 0000000..d3ba232
--- /dev/null
@@ -0,0 +1,81 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.event.Action;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.ProgressIndicator;
+import com.vaadin.ui.Table;
+
+public class RowUpdateShouldRetainContextMenu extends TestBase {
+
+    private ProgressIndicator indicator = new ProgressIndicator();
+    private Table table = new Table();
+
+    private int ctr = 0;
+
+    @Override
+    protected void setup() {
+        indicator.setWidth("200px");
+        indicator.addListener(new ValueChangeListener() {
+            public void valueChange(ValueChangeEvent event) {
+                // Do some changes to the table
+                table.setColumnHeader("Column", "Column " + ctr);
+                table.getItem(2).getItemProperty("Column")
+                        .setValue("Test " + ctr++);
+            }
+        });
+        Thread updater = new Thread() {
+            private float progress = 0;
+
+            @Override
+            public void run() {
+                while (true) {
+                    try {
+                        sleep(1000);
+                    } catch (InterruptedException ie) {
+                    }
+                    synchronized (RowUpdateShouldRetainContextMenu.this) {
+                        indicator.setValue(progress += 0.01);
+                    }
+                }
+            }
+        };
+        updater.start();
+
+        addComponent(indicator);
+
+        table.setWidth("200px");
+        table.setHeight("200px");
+
+        table.addActionHandler(new Action.Handler() {
+            public void handleAction(Action action, Object sender, Object target) {
+            }
+
+            public Action[] getActions(Object target, Object sender) {
+                return new Action[] { new Action("Action 1"),
+                        new Action("Action 2"), };
+            }
+        });
+
+        table.addContainerProperty("Column", String.class, "");
+
+        table.addItem();
+        for (int i = 0; i < 15; ++i) {
+            table.addItem(new String[] { "Row " + ctr++, }, ctr);
+        }
+
+        addComponent(table);
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Open context menu is closed if a row is updated via e.g. server push";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 8526;
+    }
+
+}