]> source.dussan.org Git - vaadin-framework.git/commitdiff
added test case
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 19 Aug 2008 09:56:00 +0000 (09:56 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 19 Aug 2008 09:56:00 +0000 (09:56 +0000)
svn changeset:5212/svn branch:trunk

src/com/itmill/toolkit/tests/tickets/Ticket1969.java [new file with mode: 0644]

diff --git a/src/com/itmill/toolkit/tests/tickets/Ticket1969.java b/src/com/itmill/toolkit/tests/tickets/Ticket1969.java
new file mode 100644 (file)
index 0000000..cc11d04
--- /dev/null
@@ -0,0 +1,104 @@
+package com.itmill.toolkit.tests.tickets;\r
+\r
+import com.itmill.toolkit.terminal.UserError;\r
+import com.itmill.toolkit.tests.TestForTablesInitialColumnWidthLogicRendering;\r
+import com.itmill.toolkit.ui.Button;\r
+import com.itmill.toolkit.ui.Label;\r
+import com.itmill.toolkit.ui.OrderedLayout;\r
+import com.itmill.toolkit.ui.TabSheet;\r
+import com.itmill.toolkit.ui.Table;\r
+import com.itmill.toolkit.ui.Window;\r
+import com.itmill.toolkit.ui.Button.ClickEvent;\r
+\r
+public class Ticket1969 extends com.itmill.toolkit.Application {\r
+\r
+    public void init() {\r
+        final Window main = new Window(getClass().getName().substring(\r
+                getClass().getName().lastIndexOf(".") + 1));\r
+        setMainWindow(main);\r
+\r
+        main.getLayout().setSizeFull();\r
+\r
+        TabSheet ts = new TabSheet();\r
+        ts.setSizeFull();\r
+\r
+        final Table t = TestForTablesInitialColumnWidthLogicRendering\r
+                .getTestTable(7, 2000);\r
+        t.setSizeFull();\r
+        ts.addTab(t, "Table, scrollins should not flash", null);\r
+\r
+        final Label testContent = new Label(\r
+                "TabSheet by default uses caption, icon, errors etc. from Components. ");\r
+\r
+        testContent.setCaption("Introduction to test");\r
+\r
+        ts.addTab(testContent);\r
+\r
+        final OrderedLayout actions = new OrderedLayout();\r
+\r
+        actions.setCaption("Test actions");\r
+\r
+        ts.addTab(actions);\r
+\r
+        Button b;\r
+\r
+        b = new Button(\r
+                "change introduction caption (should add * to tab name)",\r
+                new Button.ClickListener() {\r
+                    public void buttonClick(ClickEvent event) {\r
+                        testContent.setCaption(testContent.getCaption() + "*");\r
+                    }\r
+                });\r
+        actions.addComponent(b);\r
+\r
+        b = new Button("change tab caption (should add * to tab name)",\r
+                new Button.ClickListener() {\r
+                    public void buttonClick(ClickEvent event) {\r
+                        actions.setCaption(actions.getCaption() + "*");\r
+                    }\r
+                });\r
+\r
+        actions.addComponent(b);\r
+\r
+        final UserError e = new UserError("Test error");\r
+\r
+        b = new Button("Toggle error", new Button.ClickListener() {\r
+            public void buttonClick(ClickEvent event) {\r
+                if (testContent.getComponentError() == null) {\r
+                    testContent.setComponentError(e);\r
+                } else {\r
+                    testContent.setComponentError(null);\r
+                }\r
+            }\r
+        });\r
+        actions.addComponent(b);\r
+\r
+        b = new Button("Change table caption", new Button.ClickListener() {\r
+            public void buttonClick(ClickEvent event) {\r
+                t.setCaption(t.getCaption() + "*");\r
+            }\r
+        });\r
+        actions.addComponent(b);\r
+\r
+        b = new Button("Toggle Table error", new Button.ClickListener() {\r
+            public void buttonClick(ClickEvent event) {\r
+                if (t.getComponentError() == null) {\r
+                    t.setComponentError(e);\r
+                } else {\r
+                    t.setComponentError(null);\r
+                }\r
+            }\r
+        });\r
+\r
+        actions.addComponent(b);\r
+\r
+        for (int i = 0; i < 20; i++) {\r
+            Label l = new Label("Test Content");\r
+            l.setCaption("Extra tab " + i);\r
+            ts.addComponent(l);\r
+        }\r
+\r
+        main.addComponent(ts);\r
+\r
+    }\r
+}
\ No newline at end of file