]> source.dussan.org Git - vaadin-framework.git/commitdiff
Test case and TestBench test for #5109
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Fri, 9 Mar 2012 12:43:41 +0000 (12:43 +0000)
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Fri, 9 Mar 2012 12:43:41 +0000 (12:43 +0000)
svn changeset:23211/svn branch:6.8

tests/testbench/com/vaadin/tests/application/PaintableIdsShouldBeUnique.html [new file with mode: 0644]
tests/testbench/com/vaadin/tests/application/PaintableIdsShouldBeUnique.java [new file with mode: 0644]

diff --git a/tests/testbench/com/vaadin/tests/application/PaintableIdsShouldBeUnique.html b/tests/testbench/com/vaadin/tests/application/PaintableIdsShouldBeUnique.html
new file mode 100644 (file)
index 0000000..64b3197
--- /dev/null
@@ -0,0 +1,122 @@
+<?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:8068/" />
+<title>PaintableIdsShouldBeUnique</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">PaintableIdsShouldBeUnique</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.application.PaintableIdsShouldBeUnique?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::PID_SMyLabel</td>
+       <td>30,11</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::PID_SMyLabel</td>
+       <td>A label with a debug id.</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td>
+       <td>A label without a debug id.</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::PID_SMyButton/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::PID_SMyButton/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::PID_SMyButton/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::PID_SMyLabel</td>
+       <td>Button clicked 3 times.</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td>
+       <td>Button clicked 3 times.</td>
+</tr>
+<tr>
+       <td>clickAndWait</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::PID_0SMyLabel</td>
+       <td>A label with a debug id.</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td>
+       <td>A label without a debug id.</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::PID_0SMyButton/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::PID_0SMyLabel</td>
+       <td>Button clicked 1 times.</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td>
+       <td>Button clicked 1 times.</td>
+</tr>
+<tr>
+       <td>clickAndWait</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::PID_1SMyLabel</td>
+       <td>A label with a debug id.</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td>
+       <td>A label without a debug id.</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::PID_1SMyButton/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::PID_1SMyLabel</td>
+       <td>Button clicked 1 times.</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestsapplicationPaintableIdsShouldBeUnique::/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td>
+       <td>Button clicked 1 times.</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/application/PaintableIdsShouldBeUnique.java b/tests/testbench/com/vaadin/tests/application/PaintableIdsShouldBeUnique.java
new file mode 100644 (file)
index 0000000..95760c1
--- /dev/null
@@ -0,0 +1,74 @@
+package com.vaadin.tests.application;
+
+import com.vaadin.terminal.ExternalResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Window;
+
+public class PaintableIdsShouldBeUnique extends TestBase {
+
+    @Override
+    protected void setup() {
+        setMainWindow(new MyWindow());
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Two Paintables attached to different windows with the same debug id should have unique paintable ids";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 5109;
+    }
+
+    @Override
+    public Window getWindow(String name) {
+        Window win = super.getWindow(name);
+        if (win == null) {
+            win = new MyWindow();
+            addWindow(win);
+            win.open(new ExternalResource(win.getURL()));
+        }
+        return win;
+    }
+
+    private class MyWindow extends Window {
+        int counter = 0;
+        Label labelWithDebugId = new Label("A label with a debug id.");
+        Label labelWithoutDebugId = new Label("A label without a debug id.");
+        Button button = new Button("Click me.");
+        Button newwin = new Button("New window");
+
+        MyWindow() {
+            labelWithDebugId.setDebugId("MyLabel");
+
+            button.addListener(new Button.ClickListener() {
+                public void buttonClick(ClickEvent event) {
+                    counter++;
+                    labelWithDebugId.setValue("Button clicked " + counter
+                            + " times.");
+                    labelWithoutDebugId.setValue("Button clicked " + counter
+                            + " times.");
+                }
+            });
+            button.setDebugId("MyButton");
+
+            newwin.addListener(new Button.ClickListener() {
+                public void buttonClick(ClickEvent event) {
+                    Window win = new MyWindow();
+                    PaintableIdsShouldBeUnique.this.addWindow(win);
+                    open(new ExternalResource(win.getURL()));
+                }
+            });
+
+            addComponent(labelWithDebugId);
+            addComponent(labelWithoutDebugId);
+            addComponent(button);
+            addComponent(newwin);
+        };
+    }
+
+}