diff options
author | Automerge <automerge@vaadin.com> | 2012-03-27 13:15:23 +0000 |
---|---|---|
committer | Automerge <automerge@vaadin.com> | 2012-03-27 13:15:23 +0000 |
commit | 9ca9f4eb7a3b2a8cc2a4087c2a9c1e7b6559774d (patch) | |
tree | 7208c6a86803b4d4ffc71ff7d69c718fa1f6852d | |
parent | 53bb61089d4225ff3ba1bc75e471720e0fe44f4a (diff) | |
download | vaadin-framework-9ca9f4eb7a3b2a8cc2a4087c2a9c1e7b6559774d.tar.gz vaadin-framework-9ca9f4eb7a3b2a8cc2a4087c2a9c1e7b6559774d.zip |
[merge from 6.7] Test for #8526
svn changeset:23331/svn branch:6.8
-rw-r--r-- | tests/testbench/com/vaadin/tests/components/table/RowUpdateShouldRetainContextMenu.html | 57 | ||||
-rw-r--r-- | tests/testbench/com/vaadin/tests/components/table/RowUpdateShouldRetainContextMenu.java | 81 |
2 files changed, 138 insertions, 0 deletions
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 index 0000000000..e13aa5a3e5 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/RowUpdateShouldRetainContextMenu.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>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 index 0000000000..d3ba232f79 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/RowUpdateShouldRetainContextMenu.java @@ -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; + } + +} |