aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/button
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/button')
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonDisableOnClick.html156
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonEnterWithWindowShortcut.html62
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonEnterWithWindowShortcut.java58
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonErrorMessage.java32
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonHtml.html47
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonHtml.java40
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonMouseDetails.java63
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonTabIndex.java65
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonTooltips.html37
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonTooltips.java40
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.html82
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.java40
-rw-r--r--uitest/src/com/vaadin/tests/components/button/Buttons-chameleon.html32
-rw-r--r--uitest/src/com/vaadin/tests/components/button/Buttons-reindeer.html32
-rw-r--r--uitest/src/com/vaadin/tests/components/button/Buttons-runo.html32
-rw-r--r--uitest/src/com/vaadin/tests/components/button/Buttons.java70
-rw-r--r--uitest/src/com/vaadin/tests/components/button/Buttons2.java71
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons-chameleon.html32
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons-reindeer.html32
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons-runo.html32
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons.java49
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonsInHorizontalLayout.html47
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonsInHorizontalLayout.java52
-rw-r--r--uitest/src/com/vaadin/tests/components/button/DisabledButtons.html32
-rw-r--r--uitest/src/com/vaadin/tests/components/button/DisabledButtons.java60
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java77
-rw-r--r--uitest/src/com/vaadin/tests/components/button/TooltipForDisabledButton.java50
27 files changed, 1422 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonDisableOnClick.html b/uitest/src/com/vaadin/tests/components/button/ButtonDisableOnClick.html
new file mode 100644
index 0000000000..d39f72ef1f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonDisableOnClick.html
@@ -0,0 +1,156 @@
+<?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://localhost: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.button.Buttons2?restartApplication</td>
+ <td></td>
+</tr>
+<!--click listener-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_Smenu#item0</td>
+ <td>37,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>28,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+ <td>35,8</td>
+</tr>
+<!--disable on click-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_Smenu#item0</td>
+ <td>39,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+ <td>33,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>22,4</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_SLog_row_0</td>
+ <td>1. Command: /Disable on click(true)</td>
+</tr>
+<!--click button-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_StestComponent/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_StestComponent</td>
+ <td>v-disabled</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_SLog_row_0</td>
+ <td>2. ClickEvent</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_StestComponent/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_SLog_row_0</td>
+ <td>2. ClickEvent</td>
+</tr>
+<!--re-enable-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_Smenu#item0</td>
+ <td>35,13</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::Root/VOverlay[0]/VMenuBar[0]#item0</td>
+ <td>34,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::Root/VOverlay[1]/VMenuBar[0]#item1</td>
+ <td>15,13</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_Smenu#item0</td>
+ <td>43,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::Root/VOverlay[0]/VMenuBar[0]#item0</td>
+ <td>37,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::Root/VOverlay[1]/VMenuBar[0]#item1</td>
+ <td>33,6</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_SLog_row_0</td>
+ <td>4. Command: /Enabled(true)</td>
+</tr>
+<tr>
+ <td>assertNotCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_StestComponent</td>
+ <td>v-disabled</td>
+</tr>
+<!--no longer disable on click-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_Smenu#item0</td>
+ <td>25,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+ <td>39,13</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>36,3</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_StestComponent/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_SLog_row_0</td>
+ <td>6. ClickEvent</td>
+</tr>
+<tr>
+ <td>assertNotCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtons2::PID_StestComponent</td>
+ <td>v-disabled</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonEnterWithWindowShortcut.html b/uitest/src/com/vaadin/tests/components/button/ButtonEnterWithWindowShortcut.html
new file mode 100644
index 0000000000..5ec33f09fa
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonEnterWithWindowShortcut.html
@@ -0,0 +1,62 @@
+<?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>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.button.ButtonEnterWithWindowShortcut?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonEnterWithWindowShortcut::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]</td>
+ <td>enter</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonEnterWithWindowShortcut::PID_SLog_row_0</td>
+ <td>1. button click listener fired</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonEnterWithWindowShortcut::</td>
+ <td>enter</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonEnterWithWindowShortcut::PID_SLog_row_0</td>
+ <td>2. enter pressed in window</td>
+</tr>
+<!-- Can't test using space because of #8827 -->
+<!-- <tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonEnterWithWindowShortcut::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]</td>
+ <td>space</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonEnterWithWindowShortcut::PID_SLog_row_0</td>
+ <td>3. button click listener fired</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonEnterWithWindowShortcut::</td>
+ <td>space</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonEnterWithWindowShortcut::PID_SLog_row_0</td>
+ <td>4. space pressed in window</td>
+</tr> -->
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonEnterWithWindowShortcut.java b/uitest/src/com/vaadin/tests/components/button/ButtonEnterWithWindowShortcut.java
new file mode 100644
index 0000000000..0d4981a441
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonEnterWithWindowShortcut.java
@@ -0,0 +1,58 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.event.Action;
+import com.vaadin.event.Action.Handler;
+import com.vaadin.event.ShortcutAction;
+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;
+
+public class ButtonEnterWithWindowShortcut extends TestBase {
+ Log log = new Log(5);
+
+ @Override
+ protected void setup() {
+ getMainWindow().addActionHandler(new Handler() {
+ private static final long serialVersionUID = -4976129418325394913L;
+
+ @Override
+ public void handleAction(Action action, Object sender, Object target) {
+ log.log(action.getCaption() + " pressed in window");
+ }
+
+ @Override
+ public Action[] getActions(Object target, Object sender) {
+ ShortcutAction enter = new ShortcutAction("enter",
+ ShortcutAction.KeyCode.ENTER, null);
+ ShortcutAction space = new ShortcutAction("space",
+ ShortcutAction.KeyCode.SPACEBAR, null);
+ return new Action[] { enter, space };
+ }
+ });
+
+ Button button = new Button("Focus me and press enter",
+ new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ log.log("button click listener fired");
+ }
+ });
+ button.focus();
+
+ addComponent(log);
+ addComponent(button);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Pressing enter or space with the button focused should trigger the button click listener and not the shortcut action on the window.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(5433);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonErrorMessage.java b/uitest/src/com/vaadin/tests/components/button/ButtonErrorMessage.java
new file mode 100644
index 0000000000..b27f948669
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonErrorMessage.java
@@ -0,0 +1,32 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+
+public class ButtonErrorMessage extends TestBase {
+
+ @Override
+ protected void setup() {
+ Button b = new Button("Click for error");
+ b.addListener(new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ throw new NullPointerException();
+ }
+ });
+ addComponent(b);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Click the button for an exception. The exception should not contain any extra ',' characters";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3303;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonHtml.html b/uitest/src/com/vaadin/tests/components/button/ButtonHtml.html
new file mode 100644
index 0000000000..2d58d0e2e1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonHtml.html
@@ -0,0 +1,47 @@
+<?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>ButtonHtml</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ButtonHtml</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.button.ButtonHtml?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>initial</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonHtml::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>after_1_click</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonHtml::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>after_2_clicks</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonHtml.java b/uitest/src/com/vaadin/tests/components/button/ButtonHtml.java
new file mode 100644
index 0000000000..5cdc34e8e8
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonHtml.java
@@ -0,0 +1,40 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class ButtonHtml extends TestBase {
+
+ @Override
+ protected void setup() {
+ Button b = new Button("<b>Plain text button</b>");
+ addComponent(b);
+
+ b = new Button(
+ "<span style=\"color: red; font-weight: bold;\">HTML</span> button");
+ b.setHtmlContentAllowed(true);
+ addComponent(b);
+
+ final Button swapButton = new Button("<i>Swap button<i>");
+ swapButton.addListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ swapButton.setHtmlContentAllowed(!swapButton
+ .isHtmlContentAllowed());
+ }
+ });
+ addComponent(swapButton);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Verify that Button HTML rendering works";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8663;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonMouseDetails.java b/uitest/src/com/vaadin/tests/components/button/ButtonMouseDetails.java
new file mode 100644
index 0000000000..1b6a81551a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonMouseDetails.java
@@ -0,0 +1,63 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+
+public class ButtonMouseDetails extends TestBase {
+
+ private Label out = new Label("", ContentMode.PREFORMATTED);
+
+ private int clickCounter = 1;
+
+ private Button.ClickListener clickListener = new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ StringBuilder str = new StringBuilder(out.getValue().toString());
+ str.append(clickCounter + ":\t");
+
+ // Modifier keys
+ str.append("ctrl=" + event.isCtrlKey() + ",\t");
+ str.append("alt=" + event.isAltKey() + ",\t");
+ str.append("meta=" + event.isMetaKey() + ",\t");
+ str.append("shift=" + event.isShiftKey() + ",\t");
+
+ // Coordinates
+ str.append("X=" + event.getRelativeX() + ",\t");
+ str.append("Y=" + event.getRelativeY() + ",\t");
+ str.append("clientX=" + event.getClientX() + ",\t");
+ str.append("clientY=" + event.getClientY());
+
+ str.append("\n");
+
+ out.setValue(str.toString());
+ clickCounter++;
+ }
+ };
+
+ @Override
+ protected void setup() {
+
+ getLayout().setSpacing(true);
+
+ Button button = new Button("CLICK ME!", clickListener);
+ button.setImmediate(true);
+ addComponent(button);
+
+ addComponent(out);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Clicking a button should returns some additional information about the click";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6605;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonTabIndex.java b/uitest/src/com/vaadin/tests/components/button/ButtonTabIndex.java
new file mode 100644
index 0000000000..e1c8b2faea
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonTabIndex.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.button;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.TextField;
+
+public class ButtonTabIndex extends TestBase {
+
+ @Override
+ protected void setup() {
+ TextField tf1 = new TextField("Tab index 0");
+ tf1.setTabIndex(0);
+ TextField tf2 = new TextField("Tab index -1, focused initially");
+ tf2.setTabIndex(-1);
+ tf2.focus();
+ addComponent(tf1);
+ addComponent(tf2);
+
+ addComponent(createButton(1));
+ addComponent(createButton(5));
+ addComponent(createNativeButton(3));
+ addComponent(createButton(4));
+ addComponent(createNativeButton(2));
+
+ }
+
+ private Button createButton(int i) {
+ Button b = new Button("Button with tab index " + i);
+ b.setTabIndex(i);
+ return b;
+ }
+
+ private NativeButton createNativeButton(int i) {
+ NativeButton b = new NativeButton("NativeButton with tab index " + i);
+ b.setTabIndex(i);
+ return b;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Test for tab indexes for Button and NativeButton";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 9022;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonTooltips.html b/uitest/src/com/vaadin/tests/components/button/ButtonTooltips.html
new file mode 100644
index 0000000000..13fdf52c76
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonTooltips.html
@@ -0,0 +1,37 @@
+<?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://192.168.2.168: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.button.ButtonTooltips?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonTooltips::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>0,0</td>
+</tr>
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonTooltips::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>0,0</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonTooltips.java b/uitest/src/com/vaadin/tests/components/button/ButtonTooltips.java
new file mode 100644
index 0000000000..fa639918aa
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonTooltips.java
@@ -0,0 +1,40 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.VerticalLayout;
+
+public class ButtonTooltips extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Button tooltip's size gets messed up if moving from one tooltip to another before a timer expires.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8454;
+ }
+
+ @Override
+ protected void setup() {
+ VerticalLayout vl = new VerticalLayout();
+ Button button = new Button("One");
+ button.setDescription("long descidescidescpription");
+ Button button2 = new Button("Two");
+ button2.setDescription("Another");
+ Button button3 = new Button("One");
+ button3.setDescription("long descidescidescpription");
+ Button button4 = new Button("Two");
+ button4.setDescription("Another");
+ vl.addComponent(button);
+ vl.addComponent(button2);
+ vl.addComponent(button3);
+ vl.addComponent(button4);
+ vl.setComponentAlignment(button, Alignment.TOP_RIGHT);
+ vl.setComponentAlignment(button2, Alignment.TOP_RIGHT);
+ addComponent(vl);
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.html b/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.html
new file mode 100644
index 0000000000..0aaa01f05b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.html
@@ -0,0 +1,82 @@
+<?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>ButtonUndefinedWidth</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ButtonUndefinedWidth</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.button.ButtonUndefinedWidth</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VNativeButton[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VNativeButton[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[2]</td>
+ <td>636,149</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>1</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.java b/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.java
new file mode 100644
index 0000000000..89b03df92a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.java
@@ -0,0 +1,40 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.data.Item;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.Table;
+
+public class ButtonUndefinedWidth extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Both the button outside the table and inside the table should be only as wide as necessary. There should be empty space in the table to the right of the button.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3257;
+ }
+
+ @Override
+ protected void setup() {
+ Button b = new Button("Undefined wide");
+ addComponent(b);
+ NativeButton b2 = new NativeButton("Undefined wide");
+ addComponent(b2);
+
+ Table t = new Table();
+ t.addContainerProperty("A", Button.class, null);
+ t.setWidth("500px");
+
+ Item i = t.addItem("1");
+ i.getItemProperty("A").setValue(new Button("Undef wide"));
+ Item i2 = t.addItem("2");
+ i2.getItemProperty("A").setValue(new NativeButton("Undef wide"));
+
+ addComponent(t);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/Buttons-chameleon.html b/uitest/src/com/vaadin/tests/components/button/Buttons-chameleon.html
new file mode 100644
index 0000000000..4830c79bcf
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/Buttons-chameleon.html
@@ -0,0 +1,32 @@
+<?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>com.vaadin.tests.components.button.Buttons</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">com.vaadin.tests.components.button.Buttons</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.button.Buttons?theme=chameleon</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/Buttons-reindeer.html b/uitest/src/com/vaadin/tests/components/button/Buttons-reindeer.html
new file mode 100644
index 0000000000..43e554bec5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/Buttons-reindeer.html
@@ -0,0 +1,32 @@
+<?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>com.vaadin.tests.components.button.Buttons</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">com.vaadin.tests.components.button.Buttons</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.button.Buttons</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/Buttons-runo.html b/uitest/src/com/vaadin/tests/components/button/Buttons-runo.html
new file mode 100644
index 0000000000..27779f170b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/Buttons-runo.html
@@ -0,0 +1,32 @@
+<?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>com.vaadin.tests.components.button.Buttons</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">com.vaadin.tests.components.button.Buttons</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.button.Buttons?theme=runo</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/Buttons.java b/uitest/src/com/vaadin/tests/components/button/Buttons.java
new file mode 100644
index 0000000000..573c95c2b8
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/Buttons.java
@@ -0,0 +1,70 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.tests.components.ComponentTestCase;
+import com.vaadin.tests.util.LoremIpsum;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.NativeButton;
+
+public class Buttons extends ComponentTestCase<Button> {
+
+ @Override
+ protected Class<Button> getTestClass() {
+ return Button.class;
+ }
+
+ @Override
+ protected void initializeComponents() {
+
+ Button l;
+ for (boolean nat : new boolean[] { false, true }) {
+ l = createButton("This is an undefined wide button", nat);
+ l.setWidth(null);
+ addTestComponent(l);
+
+ l = createButton(
+ "This is an undefined wide button with fixed 100px height",
+ nat);
+ l.setWidth(null);
+ l.setHeight("100px");
+ addTestComponent(l);
+
+ l = createButton(
+ "This is a 200px wide simple button with a much longer caption",
+ nat);
+ l.setWidth("200px");
+ addTestComponent(l);
+
+ l = createButton(
+ "This is a 100% wide simple button " + LoremIpsum.get(1500),
+ nat);
+ l.setWidth("100%");
+ addTestComponent(l);
+
+ l = createButton(
+ "This is a 100% wide button with fixed 65px height. "
+ + LoremIpsum.get(5000), nat);
+ l.setWidth("100%");
+ l.setHeight("65px");
+
+ addTestComponent(l);
+ }
+
+ }
+
+ private Button createButton(String text, boolean nativeButton) {
+ Button b;
+ if (nativeButton) {
+ b = new NativeButton(text);
+ } else {
+ b = new Button(text);
+ }
+
+ return b;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "A generic test for Buttons in different configurations";
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/Buttons2.java b/uitest/src/com/vaadin/tests/components/button/Buttons2.java
new file mode 100644
index 0000000000..7526e7dbc3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/Buttons2.java
@@ -0,0 +1,71 @@
+package com.vaadin.tests.components.button;
+
+import java.util.LinkedHashMap;
+
+import com.vaadin.tests.components.AbstractComponentTest;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.themes.Reindeer;
+
+public class Buttons2<T extends Button> extends AbstractComponentTest<T>
+ implements ClickListener {
+
+ private Command<T, Boolean> disableOnClickCommand = new Command<T, Boolean>() {
+
+ @Override
+ public void execute(T c, Boolean value, Object data) {
+ c.setDisableOnClick(value);
+ }
+ };
+
+ private Command<T, Boolean> clickListenerCommand = new Command<T, Boolean>() {
+
+ @Override
+ public void execute(T c, Boolean value, Object data) {
+ if (value) {
+ c.addListener((Button.ClickListener) Buttons2.this);
+ } else {
+ c.removeListener((Button.ClickListener) Buttons2.this);
+ }
+
+ }
+ };
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Class<T> getTestClass() {
+ return (Class<T>) Button.class;
+ }
+
+ @Override
+ protected void createActions() {
+ super.createActions();
+
+ createFocusListener(CATEGORY_LISTENERS);
+ createBlurListener(CATEGORY_LISTENERS);
+
+ createBooleanAction("Disable on click", CATEGORY_FEATURES, false,
+ disableOnClickCommand);
+ addClickListener(CATEGORY_LISTENERS);
+ }
+
+ @Override
+ protected void createComponentStyleNames(
+ LinkedHashMap<String, String> options) {
+ options.put("Reindeer default", Reindeer.BUTTON_DEFAULT);
+ options.put("Reindeer small", Reindeer.BUTTON_SMALL);
+ options.put("Reindeer link", Reindeer.BUTTON_LINK);
+ }
+
+ private void addClickListener(String category) {
+ createBooleanAction("Click listener", category, false,
+ clickListenerCommand);
+
+ }
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ log(event.getClass().getSimpleName());
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons-chameleon.html b/uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons-chameleon.html
new file mode 100644
index 0000000000..5425ebb716
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons-chameleon.html
@@ -0,0 +1,32 @@
+<?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>IE7ButtonWithIcon</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ButtonsAndIcons</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.button.ButtonsAndIcons?theme=chameleon</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons-reindeer.html b/uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons-reindeer.html
new file mode 100644
index 0000000000..6bee11d561
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons-reindeer.html
@@ -0,0 +1,32 @@
+<?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>IE7ButtonWithIcon</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ButtonsAndIcons</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.button.ButtonsAndIcons</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons-runo.html b/uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons-runo.html
new file mode 100644
index 0000000000..8084a58536
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons-runo.html
@@ -0,0 +1,32 @@
+<?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>IE7ButtonWithIcon</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ButtonsAndIcons</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.button.ButtonsAndIcons?theme=runo</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons.java b/uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons.java
new file mode 100644
index 0000000000..4ab18e994a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonsAndIcons.java
@@ -0,0 +1,49 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.NativeButton;
+
+public class ButtonsAndIcons extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "The first button has text and an icon, the second only text and the third only an icon.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3031;
+ }
+
+ @Override
+ protected void setup() {
+ Button b = new Button("Text and icon");
+ b.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
+
+ addComponent(b);
+
+ b = new Button("Only text");
+
+ addComponent(b);
+ b = new Button(null);
+ b.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
+
+ addComponent(b);
+
+ b = new NativeButton("Text and icon");
+ b.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
+
+ addComponent(b);
+
+ b = new NativeButton("Only text");
+
+ addComponent(b);
+ b = new NativeButton(null);
+ b.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
+
+ addComponent(b);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonsInHorizontalLayout.html b/uitest/src/com/vaadin/tests/components/button/ButtonsInHorizontalLayout.html
new file mode 100644
index 0000000000..cb3b5e66ee
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonsInHorizontalLayout.html
@@ -0,0 +1,47 @@
+<?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>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.button.ButtonsInHorizontalLayout?restartApplication&amp;theme=reindeer</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>reindeer</td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.button.ButtonsInHorizontalLayout?restartApplication&amp;theme=runo</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>runo</td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.button.ButtonsInHorizontalLayout?restartApplication&amp;theme=chameleon</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>chameleon</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonsInHorizontalLayout.java b/uitest/src/com/vaadin/tests/components/button/ButtonsInHorizontalLayout.java
new file mode 100644
index 0000000000..3a0afdce50
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonsInHorizontalLayout.java
@@ -0,0 +1,52 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.tests.components.AbstractTestCase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.BaseTheme;
+
+public class ButtonsInHorizontalLayout extends AbstractTestCase {
+
+ @Override
+ public void init() {
+ VerticalLayout content = new VerticalLayout();
+ content.setMargin(true);
+ content.setSpacing(true);
+
+ content.addComponent(createButtonLayout(null));
+ content.addComponent(createButtonLayout(BaseTheme.BUTTON_LINK));
+
+ setMainWindow(new LegacyWindow("", content));
+ }
+
+ private HorizontalLayout createButtonLayout(String style) {
+ HorizontalLayout layout = new HorizontalLayout();
+ layout.setSpacing(true);
+ layout.addComponent(createButton(style));
+ layout.addComponent(createButton(style));
+ layout.addComponent(createButton(style));
+ return layout;
+ }
+
+ private Button createButton(String style) {
+ Button button = new Button(
+ "Look at me in IE7 or IE8 in compatibility mode");
+ if (style != null && style.length() != 0) {
+ button.setStyleName(style);
+ }
+ return button;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Tests for rendering of buttons in a HorizontalLayout";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 7978;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/DisabledButtons.html b/uitest/src/com/vaadin/tests/components/button/DisabledButtons.html
new file mode 100644
index 0000000000..65584fd4d0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/DisabledButtons.html
@@ -0,0 +1,32 @@
+<?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>DisabledButtons</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">DisabledButtons</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.button.DisabledButtons</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/DisabledButtons.java b/uitest/src/com/vaadin/tests/components/button/DisabledButtons.java
new file mode 100644
index 0000000000..73dbd95829
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/DisabledButtons.java
@@ -0,0 +1,60 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.VerticalLayout;
+
+public class DisabledButtons extends TestBase {
+
+ private static final ThemeResource ICON = new ThemeResource(
+ "../runo/icons/16/ok.png");
+ private String CAPTION = "Caption";
+
+ @Override
+ protected String getDescription() {
+ return "The disabled buttons should be identical to the enabled buttons but grayed out.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3110;
+ }
+
+ @Override
+ protected void setup() {
+ HorizontalLayout hl = new HorizontalLayout();
+ hl.addComponent(createButtons(true));
+ hl.addComponent(createButtons(false));
+
+ addComponent(hl);
+
+ }
+
+ private Component createButtons(boolean enabled) {
+ VerticalLayout vl = new VerticalLayout();
+ Button b;
+
+ // Button w/ text
+ b = new Button(CAPTION);
+ b.setEnabled(enabled);
+ vl.addComponent(b);
+
+ // Button w/ text, icon
+ b = new Button(CAPTION);
+ b.setEnabled(enabled);
+ b.setIcon(ICON);
+ vl.addComponent(b);
+
+ // Button w/ icon
+ b = new Button();
+ b.setEnabled(enabled);
+ b.setIcon(ICON);
+ vl.addComponent(b);
+
+ return vl;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java b/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java
new file mode 100644
index 0000000000..d0321100dd
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java
@@ -0,0 +1,77 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.event.ShortcutAction.KeyCode;
+import com.vaadin.event.ShortcutAction.ModifierKey;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.Window;
+
+@SuppressWarnings("serial")
+public class ShortCutListenerModification extends TestBase implements
+ ClickListener {
+
+ @Override
+ protected String getDescription() {
+ return "Modifiying listeners in shortcuthandler should succeed. Hitting CTRL-C should close windows one by one.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5350;
+ }
+
+ @Override
+ protected void setup() {
+
+ Button prev = null;
+
+ for (int j = 0; j < 20; j++) {
+
+ Window window = new Window();
+ getMainWindow().addWindow(window);
+
+ Button button1 = new Button("b1 (CTRL-C)");
+ Button button2 = new Button("b2 (CTRL-V)");
+
+ button1.addListener(this);
+ button2.addListener(this);
+
+ button1.setClickShortcut(KeyCode.C, ModifierKey.CTRL);
+ button2.setClickShortcut(KeyCode.V, ModifierKey.CTRL);
+
+ window.addComponent(button1);
+ window.addComponent(button2);
+ button1.focus();
+ button1.setData(prev);
+ prev = button1;
+ }
+
+ }
+
+ @Override
+ public void terminalError(com.vaadin.server.Terminal.ErrorEvent event) {
+ super.terminalError(event);
+ getMainWindow().showNotification("Failed!",
+ Notification.TYPE_ERROR_MESSAGE);
+
+ }
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Component c = event.getButton();
+ while (!(c instanceof Window)) {
+ c = c.getParent();
+ }
+ ((Window) c).close();
+
+ Button prev = (Button) event.getButton().getData();
+ if (prev != null) {
+ prev.focus();
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/TooltipForDisabledButton.java b/uitest/src/com/vaadin/tests/components/button/TooltipForDisabledButton.java
new file mode 100644
index 0000000000..c1f1846415
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/TooltipForDisabledButton.java
@@ -0,0 +1,50 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class TooltipForDisabledButton extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "A disabled button should show a tooltip when hovering it";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2085;
+ }
+
+ @Override
+ protected void setup() {
+ Button buttonEnabled = new Button("This is an enabled button");
+ Button buttonDisabled = new Button("This is an disabled button");
+ buttonDisabled.setEnabled(false);
+
+ buttonEnabled.setDescription("Tooltip for enabled");
+ buttonDisabled.setDescription("Tooltip for disabled");
+
+ buttonDisabled.addListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ getMainWindow().showNotification("Clicked Disabled");
+ }
+
+ });
+
+ buttonEnabled.addListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ getMainWindow().showNotification("Clicked Enabled");
+ }
+
+ });
+
+ addComponent(buttonEnabled);
+ addComponent(buttonDisabled);
+ }
+
+}