]> source.dussan.org Git - vaadin-framework.git/commitdiff
Improved test cases for #8170
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Thu, 22 Dec 2011 15:35:32 +0000 (15:35 +0000)
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Thu, 22 Dec 2011 15:35:32 +0000 (15:35 +0000)
svn changeset:22474/svn branch:6.7

tests/testbench/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java

index 593491f1e9ed62258dfa0c06950014f7efb1f571..a6040c06d3c4dfb014bdf793c487462fea9fcacc 100644 (file)
@@ -10,6 +10,7 @@ import com.vaadin.tests.util.Log;
 import com.vaadin.ui.Button;\r
 import com.vaadin.ui.Button.ClickEvent;\r
 import com.vaadin.ui.Button.ClickListener;\r
+import com.vaadin.ui.Component;\r
 import com.vaadin.ui.Label;\r
 import com.vaadin.ui.Window;\r
 \r
@@ -30,7 +31,16 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase
                 log(this);\r
                 super.attach();\r
             }\r
+\r
+            @Override\r
+            public void addWindow(Window w) {\r
+                log.log("Adding sub window");\r
+                super.addWindow(w);\r
+                log.log("Sub window added");\r
+\r
+            }\r
         };\r
+        mainWindow.setCaption("Main window");\r
         mainWindow.addComponent(log);\r
         mainWindow.getContent().setSizeFull();\r
         Label label = new Label("This is the main app") {\r
@@ -45,15 +55,14 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase
         Window loginWindow = createSubWindow();\r
         if (addSubWindowBeforeMainWindow) {\r
             mainWindow.addWindow(loginWindow);\r
-            log.log("Sub window added to application");\r
         }\r
 \r
+        log.log("Setting main window");\r
         setMainWindow(mainWindow); // At this point\r
         log.log("Main window set");\r
 \r
         if (!addSubWindowBeforeMainWindow) {\r
             mainWindow.addWindow(loginWindow);\r
-            log.log("Sub window added to application");\r
         }\r
     }\r
 \r
@@ -85,12 +94,13 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase
         return w;\r
     }\r
 \r
-    public void log(Object o) {\r
-        Class cls = o.getClass();\r
+    public void log(Component c) {\r
+        Class<?> cls = c.getClass();\r
         if (cls.isAnonymousClass()) {\r
             cls = cls.getSuperclass();\r
         }\r
-        log.log(cls.getName() + " attached to application");\r
+        log.log(cls.getName() + " '" + c.getCaption()\r
+                + "' attached to application");\r
     }\r
 \r
     @Override\r