]> source.dussan.org Git - vaadin-framework.git/commitdiff
Added TestBench test for #6368
authorJohn Alhroos <john.ahlroos@itmill.com>
Tue, 8 Mar 2011 10:02:31 +0000 (10:02 +0000)
committerJohn Alhroos <john.ahlroos@itmill.com>
Tue, 8 Mar 2011 10:02:31 +0000 (10:02 +0000)
svn changeset:17659/svn branch:6.5

tests/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutAttachedPosition.html [new file with mode: 0644]
tests/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutAttachedPosition.java [new file with mode: 0644]

diff --git a/tests/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutAttachedPosition.html b/tests/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutAttachedPosition.html
new file mode 100644 (file)
index 0000000..a263629
--- /dev/null
@@ -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>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.absolutelayout.AbsoluteLayoutAttachedPosition</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutAttachedPosition::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutAttachedPosition::Root/VNotification[0]/HTML[0]/domChild[0]</td>
+       <td>Attached to top:50.0px;left:50.0px;</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutAttachedPosition.java b/tests/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutAttachedPosition.java
new file mode 100644 (file)
index 0000000..e42f5d9
--- /dev/null
@@ -0,0 +1,53 @@
+package com.vaadin.tests.components.absolutelayout;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbsoluteLayout;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.ComponentContainer.ComponentAttachEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Window.Notification;
+
+
+public class AbsoluteLayoutAttachedPosition extends TestBase {
+
+    @Override
+    protected void setup() {
+        final AbsoluteLayout a = new AbsoluteLayout();
+        a.setWidth("300px");
+        a.setHeight("300px");
+        a.addListener(new ComponentContainer.ComponentAttachListener() {
+            public void componentAttachedToContainer(ComponentAttachEvent event) {
+                AbsoluteLayout layout = (AbsoluteLayout) event.getContainer();
+                AbsoluteLayout.ComponentPosition position = layout
+                        .getPosition(event.getAttachedComponent());
+
+                getMainWindow().showNotification(
+                        "Attached to " + position.getCSSString(),
+                        Notification.TYPE_ERROR_MESSAGE);
+            }
+        });
+        addComponent(a);
+
+        addComponent(new Button("Attach label to AbsoluteLayout",
+                new Button.ClickListener() {
+                    public void buttonClick(ClickEvent event) {
+                        a.addComponent(new Label("X"), "top:50px;left:50px");
+                    }
+                }));
+    }
+
+    @Override
+    protected String getDescription() {
+        return "When pressing the attach button a Label with the value \"X\" "
+                + "should get add to the above placed AbsoluteLayout. The position css "
+                + "should be 'top:50px;left:50px'.";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 6368;
+    }
+
+}