diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-09-07 07:58:22 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-09-07 07:58:22 +0000 |
commit | 919d0469dba09b69cea7acfa676bb161c8ebb410 (patch) | |
tree | 29c88b42326a2a501bacd3bc0efe465b21fd0777 | |
parent | cea19edd2ed3f1084a60a67ebd298f9d0196e4a0 (diff) | |
download | vaadin-framework-919d0469dba09b69cea7acfa676bb161c8ebb410.tar.gz vaadin-framework-919d0469dba09b69cea7acfa676bb161c8ebb410.zip |
Test case for #5539
svn changeset:14736/svn branch:6.4
-rw-r--r-- | tests/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.html | 209 | ||||
-rw-r--r-- | tests/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java | 65 |
2 files changed, 274 insertions, 0 deletions
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 @@ +<?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="http://artur-laptop.office.itmill.com:8888/" />
+<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.abstractfield.ShortcutAddAndRemove?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/domChild[0]/domChild[1]</td>
+ <td>316,58</td>
+</tr>
+<!--Enter on background - should cause event-->
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::</td>
+ <td>enter</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>1. Log button was clicked</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>102,51</td>
+</tr>
+<!--Enter in textfield - should cause event-->
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>enter</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>2. Log button was clicked</td>
+</tr>
+<!--Remove shortcut-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>110,62</td>
+</tr>
+<!--Enter in field - should not cause event-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>97,26</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>up</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>enterCharacter</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>row1</td>
+</tr>
+<tr>
+ <td>keyPress</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>13</td>
+</tr>
+<tr>
+ <td>keyPress</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>r</td>
+</tr>
+<tr>
+ <td>keyPress</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>o</td>
+</tr>
+<tr>
+ <td>keyPress</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>w</td>
+</tr>
+<tr>
+ <td>keyPress</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>2</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>2. Log button was clicked</td>
+</tr>
+<!-- Commented out because of TestBench bug #5551 -->
+<!-- <tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>row1<br />row2</td>
+</tr>-->
+<!--Add shortcut again-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>85,46</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td>
+ <td>enter</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>3. Log button was clicked</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[2]/domChild[0]</td>
+ <td>625,2</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::</td>
+ <td>enter</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>4. Log button was clicked</td>
+</tr>
+<!--Remove shortcut once more-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[2]</td>
+ <td>631,52</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[2]</td>
+ <td>597,57</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::</td>
+ <td>enter</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>4. Log button was clicked</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
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;
+ }
+
+}
|