]> source.dussan.org Git - vaadin-framework.git/commitdiff
Test case for #3195
authorArtur Signell <artur.signell@itmill.com>
Thu, 20 Aug 2009 06:31:31 +0000 (06:31 +0000)
committerArtur Signell <artur.signell@itmill.com>
Thu, 20 Aug 2009 06:31:31 +0000 (06:31 +0000)
svn changeset:8513/svn branch:6.1

src/com/vaadin/tests/layouts/NPEInReplaceComponent.java [new file with mode: 0644]

diff --git a/src/com/vaadin/tests/layouts/NPEInReplaceComponent.java b/src/com/vaadin/tests/layouts/NPEInReplaceComponent.java
new file mode 100644 (file)
index 0000000..97155c9
--- /dev/null
@@ -0,0 +1,40 @@
+package com.vaadin.tests.layouts;\r
+\r
+import com.vaadin.tests.components.TestBase;\r
+import com.vaadin.ui.Button;\r
+import com.vaadin.ui.VerticalLayout;\r
+import com.vaadin.ui.Button.ClickEvent;\r
+\r
+public class NPEInReplaceComponent extends TestBase {\r
+\r
+       @Override\r
+       protected String getDescription() {\r
+               return "Clicking 'ReplaceComponent' should replace the 'Button' button with a VericalLayout, and move the button inside the verticalLayout. Visually this can be seen by the added margins of the VerticalLayout.";\r
+       }\r
+\r
+       @Override\r
+       protected Integer getTicketNumber() {\r
+               return 3195;\r
+       }\r
+\r
+       final Button button = new Button("Button");\r
+       final VerticalLayout outer = new VerticalLayout();\r
+\r
+       @Override\r
+       protected void setup() {\r
+               outer.setMargin(true);\r
+               \r
+               Button changer = new Button("ReplaceComponent");\r
+               changer.addListener(new Button.ClickListener() {\r
+                       public void buttonClick(ClickEvent event) {\r
+                               getLayout().replaceComponent(button, outer);\r
+                               outer.addComponent(button);\r
+                       }\r
+               });\r
+\r
+               getLayout().addComponent(button);\r
+               getLayout().addComponent(changer);\r
+\r
+       }\r
+\r
+}\r