From 919d0469dba09b69cea7acfa676bb161c8ebb410 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 7 Sep 2010 07:58:22 +0000 Subject: Test case for #5539 svn changeset:14736/svn branch:6.4 --- .../abstractfield/ShortcutAddAndRemove.html | 209 +++++++++++++++++++++ .../abstractfield/ShortcutAddAndRemove.java | 65 +++++++ 2 files changed, 274 insertions(+) create mode 100644 tests/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.html create mode 100644 tests/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java diff --git a/tests/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.html b/tests/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.html new file mode 100644 index 0000000000..ff69f3860c --- /dev/null +++ b/tests/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.html @@ -0,0 +1,209 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.abstractfield.ShortcutAddAndRemove?restartApplication
mouseClickvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/domChild[0]/domChild[1]316,58
pressSpecialKeyvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::enter
waitForVaadin
assertTextvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]1. Log button was clicked
mouseClickvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]102,51
pressSpecialKeyvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]enter
waitForVaadin
assertTextvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]2. Log button was clicked
clickvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
mouseClickvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]110,62
mouseClickvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]97,26
pressSpecialKeyvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]up
pressSpecialKeyvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]down
pressSpecialKeyvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]down
enterCharactervaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]row1
keyPressvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]13
keyPressvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]r
keyPressvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]o
keyPressvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]w
keyPressvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]2
assertTextvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]2. Log button was clicked
clickvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]
mouseClickvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]85,46
pressSpecialKeyvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]enter
waitForVaadin
assertTextvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]3. Log button was clicked
mouseClickvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[2]/domChild[0]625,2
pressSpecialKeyvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::enter
waitForVaadin
assertTextvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]4. Log button was clicked
clickvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
mouseClickvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[2]631,52
mouseClickvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[2]597,57
pressSpecialKeyvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::enter
assertTextvaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]4. Log button was clicked
+ + diff --git a/tests/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java b/tests/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java new file mode 100644 index 0000000000..7c0af3d9ab --- /dev/null +++ b/tests/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java @@ -0,0 +1,65 @@ +package com.vaadin.tests.components.abstractfield; + +import com.vaadin.event.ShortcutAction.KeyCode; +import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.util.Log; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.TextField; + +public class ShortcutAddAndRemove extends TestBase { + + private Log log; + private TextField textArea; + + @Override + protected void setup() { + log = new Log(4); + log.setNumberLogRows(true); + + final Button logButton = new Button("Log a row (enter shortcut)"); + logButton.setClickShortcut(KeyCode.ENTER); + logButton.addListener(new ClickListener() { + public void buttonClick(ClickEvent event) { + log.log("Log button was clicked"); + } + }); + + final Button removeShortcut = new Button("Remove shortcut"); + removeShortcut.addListener(new ClickListener() { + public void buttonClick(ClickEvent event) { + logButton.removeClickShortcut(); + logButton.setCaption("Log a row (no shortcut)"); + } + }); + final Button addShortcut = new Button("Add shortcut"); + addShortcut.addListener(new ClickListener() { + public void buttonClick(ClickEvent event) { + logButton.setClickShortcut(KeyCode.ENTER); + logButton.setCaption("Log a row (enter shortcut)"); + } + }); + addComponent(log); + addComponent(logButton); + textArea = new TextField("Enter key does not break lines ..."); + textArea.setRows(5); + textArea.setColumns(20); + addComponent(textArea); + addComponent(removeShortcut); + addComponent(addShortcut); + + } + + @Override + protected String getDescription() { + return null; + } + + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } + +} -- cgit v1.2.3