From 9ca9f4eb7a3b2a8cc2a4087c2a9c1e7b6559774d Mon Sep 17 00:00:00 2001 From: Automerge Date: Tue, 27 Mar 2012 13:15:23 +0000 Subject: [PATCH] [merge from 6.7] Test for #8526 svn changeset:23331/svn branch:6.8 --- .../RowUpdateShouldRetainContextMenu.html | 57 +++++++++++++ .../RowUpdateShouldRetainContextMenu.java | 81 +++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 tests/testbench/com/vaadin/tests/components/table/RowUpdateShouldRetainContextMenu.html create mode 100644 tests/testbench/com/vaadin/tests/components/table/RowUpdateShouldRetainContextMenu.java 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 @@ + + + + + + +RowUpdateShouldRetainContextMenu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RowUpdateShouldRetainContextMenu
open/run/RowUpdateShouldRetainContextMenu?restartApplication
contextMenuAtvaadin=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]10,10
assertTextvaadin=runRowUpdateShouldRetainContextMenu::Root/VContextMenu[0]#option0Action 1
pause2000
assertTextvaadin=runRowUpdateShouldRetainContextMenu::Root/VContextMenu[0]#option0Action 1
mouseClickvaadin=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]5,5
pause2000
assertTextNotPresentAction 2
+ + 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; + } + +} -- 2.39.5