From e4ea1764aeed241ac8397b1a216d70dda4f54177 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Thu, 15 Dec 2011 13:49:38 +0000 Subject: #8090 test case svn changeset:22409/svn branch:6.7 --- .../window/ReplacingComponentsInHandleParameters.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/window/ReplacingComponentsInHandleParameters.java b/tests/testbench/com/vaadin/tests/components/window/ReplacingComponentsInHandleParameters.java index d6fe10601f..9e02acac95 100644 --- a/tests/testbench/com/vaadin/tests/components/window/ReplacingComponentsInHandleParameters.java +++ b/tests/testbench/com/vaadin/tests/components/window/ReplacingComponentsInHandleParameters.java @@ -6,7 +6,6 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Label; import com.vaadin.ui.Window; public class ReplacingComponentsInHandleParameters extends TestBase { @@ -28,19 +27,22 @@ public class ReplacingComponentsInHandleParameters extends TestBase { event.getButton().setCaption("Clicked!"); } }; + final Window main = new Window() { @Override public void handleParameters(Map parameters) { super.handleParameters(parameters); removeAllComponents(); - addComponent(new Label( - "Reload window (without ?restartApplication), then click the button twice.")); - - Button btn = new Button("Click me", clickListener); + Button btn = new Button("Testing 2", clickListener); btn.setDebugId("TestId"); addComponent(btn); } }; + + Button btn = new Button("Testing", clickListener); + btn.setDebugId("TestId"); + main.addComponent(btn); + setMainWindow(main); } } -- cgit v1.2.3 From 218c86756735147f2cf2b0181011861fcc3d05e4 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Mon, 19 Dec 2011 11:33:02 +0000 Subject: TestBench test for #8090 svn changeset:22439/svn branch:6.7 --- .../window/ReplacingComponentsInHandleParameters.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/window/ReplacingComponentsInHandleParameters.java b/tests/testbench/com/vaadin/tests/components/window/ReplacingComponentsInHandleParameters.java index 9e02acac95..d6fe10601f 100644 --- a/tests/testbench/com/vaadin/tests/components/window/ReplacingComponentsInHandleParameters.java +++ b/tests/testbench/com/vaadin/tests/components/window/ReplacingComponentsInHandleParameters.java @@ -6,6 +6,7 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Label; import com.vaadin.ui.Window; public class ReplacingComponentsInHandleParameters extends TestBase { @@ -27,22 +28,19 @@ public class ReplacingComponentsInHandleParameters extends TestBase { event.getButton().setCaption("Clicked!"); } }; - final Window main = new Window() { @Override public void handleParameters(Map parameters) { super.handleParameters(parameters); removeAllComponents(); - Button btn = new Button("Testing 2", clickListener); + addComponent(new Label( + "Reload window (without ?restartApplication), then click the button twice.")); + + Button btn = new Button("Click me", clickListener); btn.setDebugId("TestId"); addComponent(btn); } }; - - Button btn = new Button("Testing", clickListener); - btn.setDebugId("TestId"); - main.addComponent(btn); - setMainWindow(main); } } -- cgit v1.2.3 From 37b5d311f95199bd12977b2a6a864d0bc59232f8 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Mon, 19 Dec 2011 14:58:59 +0000 Subject: Test case for #6870 svn changeset:22445/svn branch:6.7 --- .../com/vaadin/tests/components/table/TableHeaderZoom.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java b/tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java index f7d85f1a3c..90a9191036 100644 --- a/tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java +++ b/tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java @@ -10,14 +10,10 @@ public class TableHeaderZoom extends TestBase { @Override protected void setup() { Table table = new Table(); - table.setHeight("400px"); - table.setWidth("400px"); + table.setHeight("100px"); + table.setWidth("200px"); + table.setEnabled(false); table.addContainerProperty("Column 1", String.class, ""); - table.addContainerProperty("Column 2", String.class, ""); - - for (int i = 0; i < 100; ++i) { - table.addItem(new Object[] { "" + i, "foo" }, i); - } Window main = getMainWindow(); main.setContent(new CssLayout()); -- cgit v1.2.3 From d10b1c6f226ef761ea4a77e517c093b5ea7084eb Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Wed, 21 Dec 2011 16:37:45 +0000 Subject: Test for #8170 svn changeset:22465/svn branch:6.7 --- .../window/AttachShouldBeCalledForSubWindows.java | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java b/tests/testbench/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java index a6040c06d3..593491f1e9 100644 --- a/tests/testbench/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java +++ b/tests/testbench/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java @@ -10,7 +10,6 @@ import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Component; import com.vaadin.ui.Label; import com.vaadin.ui.Window; @@ -31,16 +30,7 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase log(this); super.attach(); } - - @Override - public void addWindow(Window w) { - log.log("Adding sub window"); - super.addWindow(w); - log.log("Sub window added"); - - } }; - mainWindow.setCaption("Main window"); mainWindow.addComponent(log); mainWindow.getContent().setSizeFull(); Label label = new Label("This is the main app") { @@ -55,14 +45,15 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase Window loginWindow = createSubWindow(); if (addSubWindowBeforeMainWindow) { mainWindow.addWindow(loginWindow); + log.log("Sub window added to application"); } - log.log("Setting main window"); setMainWindow(mainWindow); // At this point log.log("Main window set"); if (!addSubWindowBeforeMainWindow) { mainWindow.addWindow(loginWindow); + log.log("Sub window added to application"); } } @@ -94,13 +85,12 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase return w; } - public void log(Component c) { - Class cls = c.getClass(); + public void log(Object o) { + Class cls = o.getClass(); if (cls.isAnonymousClass()) { cls = cls.getSuperclass(); } - log.log(cls.getName() + " '" + c.getCaption() - + "' attached to application"); + log.log(cls.getName() + " attached to application"); } @Override -- cgit v1.2.3 From 6b17598182a7fd2162adf03c21b079569c6d6195 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Thu, 22 Dec 2011 15:35:32 +0000 Subject: Improved test cases for #8170 svn changeset:22474/svn branch:6.7 --- .../window/AttachShouldBeCalledForSubWindows.java | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java b/tests/testbench/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java index 593491f1e9..a6040c06d3 100644 --- a/tests/testbench/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java +++ b/tests/testbench/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java @@ -10,6 +10,7 @@ import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Component; import com.vaadin.ui.Label; import com.vaadin.ui.Window; @@ -30,7 +31,16 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase log(this); super.attach(); } + + @Override + public void addWindow(Window w) { + log.log("Adding sub window"); + super.addWindow(w); + log.log("Sub window added"); + + } }; + mainWindow.setCaption("Main window"); mainWindow.addComponent(log); mainWindow.getContent().setSizeFull(); Label label = new Label("This is the main app") { @@ -45,15 +55,14 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase Window loginWindow = createSubWindow(); if (addSubWindowBeforeMainWindow) { mainWindow.addWindow(loginWindow); - log.log("Sub window added to application"); } + log.log("Setting main window"); setMainWindow(mainWindow); // At this point log.log("Main window set"); if (!addSubWindowBeforeMainWindow) { mainWindow.addWindow(loginWindow); - log.log("Sub window added to application"); } } @@ -85,12 +94,13 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase return w; } - public void log(Object o) { - Class cls = o.getClass(); + public void log(Component c) { + Class cls = c.getClass(); if (cls.isAnonymousClass()) { cls = cls.getSuperclass(); } - log.log(cls.getName() + " attached to application"); + log.log(cls.getName() + " '" + c.getCaption() + + "' attached to application"); } @Override -- cgit v1.2.3 From 5be5334eb4c85f1ebaf1baece3296b7c9e6fb268 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Fri, 30 Dec 2011 13:45:56 +0000 Subject: Some test tweaks for #6870 svn changeset:22502/svn branch:6.7 --- .../com/vaadin/tests/components/table/TableHeaderZoom.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java b/tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java index 90a9191036..f7d85f1a3c 100644 --- a/tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java +++ b/tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java @@ -10,10 +10,14 @@ public class TableHeaderZoom extends TestBase { @Override protected void setup() { Table table = new Table(); - table.setHeight("100px"); - table.setWidth("200px"); - table.setEnabled(false); + table.setHeight("400px"); + table.setWidth("400px"); table.addContainerProperty("Column 1", String.class, ""); + table.addContainerProperty("Column 2", String.class, ""); + + for (int i = 0; i < 100; ++i) { + table.addItem(new Object[] { "" + i, "foo" }, i); + } Window main = getMainWindow(); main.setContent(new CssLayout()); -- cgit v1.2.3 From cd7927ce87c9e24cb018dddfbf80ab3a0bff5199 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Tue, 10 Jan 2012 11:33:14 +0000 Subject: Yet another layout tester, copied from V7 for reporting bugs in 6.7 svn changeset:22567/svn branch:6.7 --- .../orderedlayout/OrderedLayoutCases.java | 175 ++------------------- 1 file changed, 9 insertions(+), 166 deletions(-) (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java index ff3c304600..d8b01c4099 100644 --- a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java +++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java @@ -11,21 +11,17 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.TestUtils; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Alignment; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Component; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.NativeSelect; import com.vaadin.ui.VerticalLayout; public class OrderedLayoutCases extends TestBase { - private static final String[] dimensionValues = { "-1px", "5px", "350px", + private static final String[] dimensionValues = { "-1px", "5px", "300px", "800px", "100%", "50%" }; private static class SampleChild extends VerticalLayout { public SampleChild() { - setStyleName("sampleChild"); + setStyleName("showBorders"); addComponent(createSimpleSelector("Child width", new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { @@ -105,24 +101,18 @@ public class OrderedLayoutCases extends TestBase { } private AbstractOrderedLayout currentLayout; - private HorizontalLayout sizeBar; @Override - protected void setup() { - TestUtils - .injectCSS( - getMainWindow(), - ".sampleChild, .theLayout {border: 1px solid black;}" - + ".theLayout > div > div:first-child {background: aqua;}" - + ".theLayout > div > div:first-child + div {background: yellow;}" - + ".theLayout > div > div:first-child + div + div {background: lightgrey;}"); + public void setup() { + TestUtils.injectCSS(getMainWindow(), + ".showBorders {border: 1px solid black};"); currentLayout = new HorizontalLayout(); for (int i = 0; i < 3; i++) { currentLayout.addComponent(new SampleChild()); } - sizeBar = new HorizontalLayout(); + HorizontalLayout sizeBar = new HorizontalLayout(); sizeBar.setSpacing(true); sizeBar.addComponent(createSimpleSelector("Layout width", @@ -139,20 +129,6 @@ public class OrderedLayoutCases extends TestBase { .toString()); } }, dimensionValues)); - sizeBar.addComponent(createSimpleSelector("Spacing", - new ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - currentLayout.setSpacing(Boolean.parseBoolean(event - .getProperty().getValue().toString())); - } - }, "false", "true")); - sizeBar.addComponent(createSimpleSelector("Margin", - new ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - currentLayout.setMargin(Boolean.parseBoolean(event - .getProperty().getValue().toString())); - } - }, "false", "true")); sizeBar.addComponent(createSimpleSelector("Direction", new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { @@ -169,7 +145,7 @@ public class OrderedLayoutCases extends TestBase { newLayout.addComponent(currentLayout .getComponent(0)); } - newLayout.setStyleName("theLayout"); + newLayout.setStyleName("showBorders"); newLayout.setHeight(currentLayout.getHeight(), currentLayout.getHeightUnits()); @@ -181,149 +157,15 @@ public class OrderedLayoutCases extends TestBase { } }, "Horizontal", "Vertical")); - HorizontalLayout caseBar = new HorizontalLayout(); - caseBar.addComponent(new Button("Undefined without relative", - new ClickListener() { - public void buttonClick(ClickEvent event) { - resetState(); - // width: 350px to middle child - setChildState(1, 0, 2); - } - })); - caseBar.addComponent(new Button("Undefined with relative", - new ClickListener() { - public void buttonClick(ClickEvent event) { - resetState(); - // width: 100% to middle child - setChildState(1, 0, 4); - } - })); - caseBar.addComponent(new Button("Fixed with overflow", - new ClickListener() { - public void buttonClick(ClickEvent event) { - resetState(); - // layout width: 350px - setState(sizeBar, 0, 2); - // layout margin enabled - setState(sizeBar, 3, 1); - } - })); - caseBar.addComponent(new Button("Fixed with extra space", - new ClickListener() { - public void buttonClick(ClickEvent event) { - resetState(); - // Layout width: 800px - setState(sizeBar, 0, 3); - // layout margin enabled - setState(sizeBar, 3, 1); - // width: 350px to middle child - setChildState(1, 0, 2); - } - })); - - caseBar.addComponent(new Button("Expand with alignment", - new ClickListener() { - public void buttonClick(ClickEvent event) { - resetState(); - // Layout width: 800px - setState(sizeBar, 0, 3); - // Layout height: 350px - setState(sizeBar, 1, 2); - // Expand: 1 to middle child - setChildState(1, 3, 1); - // Align bottom left to middle child - setChildState(1, 4, 6); - } - })); - - caseBar.addComponent(new Button("Multiple expands", - new ClickListener() { - public void buttonClick(ClickEvent event) { - resetState(); - // Layout width: 800px - setState(sizeBar, 0, 3); - // Layout height: 350px - setState(sizeBar, 1, 2); - // Width 350px to middle child - setChildState(1, 0, 2); - // Apply to left and middle child - for (int i = 0; i < 2; i++) { - // Expand: 1 - setChildState(i, 3, 1); - // Align: middle center - setChildState(i, 4, 5); - } - } - })); - - caseBar.addComponent(new Button("Fixed + relative height", - new ClickListener() { - public void buttonClick(ClickEvent event) { - resetState(); - // Layout height: 100% - setState(sizeBar, 1, 4); - // Height: 350px to left child - setChildState(0, 1, 2); - // Height: 100% to middle child - setChildState(1, 1, 4); - // Alignment: bottom left to right child - setChildState(2, 4, 7); - } - })); - - caseBar.addComponent(new Button("Undefined + relative height", - new ClickListener() { - public void buttonClick(ClickEvent event) { - resetState(); - // Height: 350px to left child - setChildState(0, 1, 2); - // Height: 100% to middle child - setChildState(1, 1, 4); - // Alignment: bottom left to right child - setChildState(2, 4, 7); - } - })); - - caseBar.setSpacing(true); - - addComponent(caseBar); addComponent(sizeBar); addComponent(currentLayout); getLayout().setSpacing(true); - getLayout().getParent().setSizeFull(); + getMainWindow().getContent().setSizeFull(); getLayout().setSizeFull(); getLayout().setExpandRatio(currentLayout, 1); } - private void resetState() { - for (int i = 0; i < sizeBar.getComponentCount(); i++) { - setState(sizeBar, i, 0); - } - for (int i = 0; i < 3; i++) { - // Child width and height -> -1px - SampleChild child = (SampleChild) currentLayout.getComponent(i); - for (int j = 0; j < child.getComponentCount(); j++) { - if (j == 4) { - setState(child, j, 1); - } else { - setState(child, j, 0); - } - } - } - } - - private void setChildState(int childIndex, int selectIndex, int valueIndex) { - Component child = currentLayout.getComponent(childIndex); - setState(child, selectIndex, valueIndex); - } - - private static void setState(Component container, int selectIndex, int value) { - NativeSelect select = (NativeSelect) ((AbstractOrderedLayout) container) - .getComponent(selectIndex); - select.setValue(new ArrayList(select.getItemIds()).get(value)); - } - private static NativeSelect createSimpleSelector(String caption, ValueChangeListener listener, String... values) { return createSimpleSelector(caption, listener, Arrays.asList(values), @@ -343,6 +185,7 @@ public class OrderedLayoutCases extends TestBase { @Override protected Integer getTicketNumber() { + // TODO Auto-generated method stub return null; } -- cgit v1.2.3 From 3e090a01f8a4b42f5ee54f9fb83ccdc91402b372 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 11 Jan 2012 09:24:57 +0000 Subject: A bunch of tests for OrderedLayout svn changeset:22590/svn branch:6.7 --- .../orderedlayout/OrderedLayoutCases.java | 171 +++++++++++++++++++-- 1 file changed, 162 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java index d8b01c4099..dae44e3299 100644 --- a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java +++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java @@ -11,17 +11,21 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.TestUtils; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Component; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.NativeSelect; import com.vaadin.ui.VerticalLayout; public class OrderedLayoutCases extends TestBase { - private static final String[] dimensionValues = { "-1px", "5px", "300px", + private static final String[] dimensionValues = { "-1px", "5px", "350px", "800px", "100%", "50%" }; private static class SampleChild extends VerticalLayout { public SampleChild() { - setStyleName("showBorders"); + setStyleName("sampleChild"); addComponent(createSimpleSelector("Child width", new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { @@ -101,18 +105,24 @@ public class OrderedLayoutCases extends TestBase { } private AbstractOrderedLayout currentLayout; + private HorizontalLayout sizeBar; @Override - public void setup() { - TestUtils.injectCSS(getMainWindow(), - ".showBorders {border: 1px solid black};"); + protected void setup() { + TestUtils + .injectCSS( + getMainWindow(), + ".sampleChild, .theLayout {border: 1px solid black;}" + + ".theLayout > div > div:first-child {background: aqua;}" + + ".theLayout > div > div:first-child + div {background: yellow;}" + + ".theLayout > div > div:first-child + div + div {background: lightgrey;}"); currentLayout = new HorizontalLayout(); for (int i = 0; i < 3; i++) { currentLayout.addComponent(new SampleChild()); } - HorizontalLayout sizeBar = new HorizontalLayout(); + sizeBar = new HorizontalLayout(); sizeBar.setSpacing(true); sizeBar.addComponent(createSimpleSelector("Layout width", @@ -129,6 +139,20 @@ public class OrderedLayoutCases extends TestBase { .toString()); } }, dimensionValues)); + sizeBar.addComponent(createSimpleSelector("Spacing", + new ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + currentLayout.setSpacing(Boolean.parseBoolean(event + .getProperty().getValue().toString())); + } + }, "false", "true")); + sizeBar.addComponent(createSimpleSelector("Margin", + new ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + currentLayout.setMargin(Boolean.parseBoolean(event + .getProperty().getValue().toString())); + } + }, "false", "true")); sizeBar.addComponent(createSimpleSelector("Direction", new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { @@ -145,7 +169,7 @@ public class OrderedLayoutCases extends TestBase { newLayout.addComponent(currentLayout .getComponent(0)); } - newLayout.setStyleName("showBorders"); + newLayout.setStyleName("theLayout"); newLayout.setHeight(currentLayout.getHeight(), currentLayout.getHeightUnits()); @@ -157,15 +181,145 @@ public class OrderedLayoutCases extends TestBase { } }, "Horizontal", "Vertical")); + HorizontalLayout caseBar = new HorizontalLayout(); + caseBar.addComponent(new Button("Undefined without relative", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // width: 350px to middle child + setChildState(1, 0, 2); + } + })); + caseBar.addComponent(new Button("Undefined with relative", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // width: 100% to middle child + setChildState(1, 0, 4); + } + })); + caseBar.addComponent(new Button("Fixed with overflow", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // layout width: 350px + setState(sizeBar, 0, 2); + // layout margin enabled + setState(sizeBar, 3, 1); + } + })); + caseBar.addComponent(new Button("Fixed with extra space", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // Layout width: 800px + setState(sizeBar, 0, 3); + // layout margin enabled + setState(sizeBar, 3, 1); + // width: 350px to middle child + setChildState(1, 0, 2); + } + })); + + caseBar.addComponent(new Button("Expand with alignment", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // Layout width: 800px + setState(sizeBar, 0, 3); + // Layout height: 350px + setState(sizeBar, 1, 2); + // Expand: 1 to middle child + setChildState(1, 3, 1); + // Align bottom left to middle child + setChildState(1, 4, 6); + } + })); + + caseBar.addComponent(new Button("Multiple expands", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // Layout width: 800px + setState(sizeBar, 0, 3); + // Layout height: 350px + setState(sizeBar, 1, 2); + // Width 350px to middle child + setChildState(1, 0, 2); + // Apply to left and middle child + for (int i = 0; i < 2; i++) { + // Expand: 1 + setChildState(i, 3, 1); + // Align: middle center + setChildState(i, 4, 5); + } + } + })); + + caseBar.addComponent(new Button("Fixed + relative height", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // Layout height: 100% + setState(sizeBar, 1, 4); + // Height: 350px to left child + setChildState(0, 1, 2); + // Height: 100% to middle child + setChildState(1, 1, 4); + } + })); + + caseBar.addComponent(new Button("Undefined + relative height", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // Height: 350px to left child + setChildState(0, 1, 2); + // Height: 100% to middle child + setChildState(1, 1, 4); + } + })); + + caseBar.setSpacing(true); + + addComponent(caseBar); addComponent(sizeBar); addComponent(currentLayout); getLayout().setSpacing(true); - getMainWindow().getContent().setSizeFull(); + getLayout().getParent().setSizeFull(); getLayout().setSizeFull(); getLayout().setExpandRatio(currentLayout, 1); } + private void resetState() { + for (int i = 0; i < sizeBar.getComponentCount(); i++) { + setState(sizeBar, i, 0); + } + for (int i = 0; i < 3; i++) { + // Child width and height -> -1px + SampleChild child = (SampleChild) currentLayout.getComponent(i); + for (int j = 0; j < child.getComponentCount(); j++) { + if (j == 4) { + setState(child, j, 1); + } else { + setState(child, j, 0); + } + } + } + } + + private void setChildState(int childIndex, int selectIndex, int valueIndex) { + Component child = currentLayout.getComponent(childIndex); + setState(child, selectIndex, valueIndex); + } + + private static void setState(Component container, int selectIndex, int value) { + NativeSelect select = (NativeSelect) ((AbstractOrderedLayout) container) + .getComponent(selectIndex); + select.setValue(new ArrayList(select.getItemIds()).get(value)); + } + private static NativeSelect createSimpleSelector(String caption, ValueChangeListener listener, String... values) { return createSimpleSelector(caption, listener, Arrays.asList(values), @@ -185,7 +339,6 @@ public class OrderedLayoutCases extends TestBase { @Override protected Integer getTicketNumber() { - // TODO Auto-generated method stub return null; } -- cgit v1.2.3 From 10124fe027d2613a72ce9e26bfc01ee889eb2df7 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 11 Jan 2012 14:57:46 +0000 Subject: Add align bottom to the tests with heights just to make it more interesting svn changeset:22593/svn branch:6.7 --- .../com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java index dae44e3299..ff3c304600 100644 --- a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java +++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java @@ -266,6 +266,8 @@ public class OrderedLayoutCases extends TestBase { setChildState(0, 1, 2); // Height: 100% to middle child setChildState(1, 1, 4); + // Alignment: bottom left to right child + setChildState(2, 4, 7); } })); @@ -277,6 +279,8 @@ public class OrderedLayoutCases extends TestBase { setChildState(0, 1, 2); // Height: 100% to middle child setChildState(1, 1, 4); + // Alignment: bottom left to right child + setChildState(2, 4, 7); } })); -- cgit v1.2.3 From a2c034e7b8039fab2b2da06aee0540d08ab11b54 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 17 Jan 2012 15:31:58 +0000 Subject: #8272 Test automatically using WebLogic 12 svn changeset:22673/svn branch:6.7 --- tests/integration_tests.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml index fa8defd14e..67e5786b44 100644 --- a/tests/integration_tests.xml +++ b/tests/integration_tests.xml @@ -268,15 +268,15 @@ - + - - + + -- cgit v1.2.3 From a5429e808dff4dd45728e2f86150bda73b03bbfb Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 17 Jan 2012 16:08:30 +0000 Subject: Use ant script to cleanup instead of removing everything in the deploy directory svn changeset:22678/svn branch:6.7 --- tests/integration_base_files/cleanup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/integration_base_files/cleanup.sh b/tests/integration_base_files/cleanup.sh index 42fb5a434d..44e2e5f6ee 100644 --- a/tests/integration_base_files/cleanup.sh +++ b/tests/integration_base_files/cleanup.sh @@ -23,4 +23,5 @@ if [ -a /home/integration/demo.war ] fi echo Cleaning deploy dir -rm -rf /home/integration/deploy/* +ant -f /home/integration/deploy.xml clean + -- cgit v1.2.3 From d4f04f7adccc3040b37ec2593341e14f4123acc9 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 17 Jan 2012 16:57:03 +0000 Subject: Disable weblogic 12 test for now svn changeset:22680/svn branch:6.7 --- tests/integration_tests.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml index 67e5786b44..7b4e9757e5 100644 --- a/tests/integration_tests.xml +++ b/tests/integration_tests.xml @@ -326,7 +326,7 @@ - + -- cgit v1.2.3 From fd4eaf2cfa5e7b690e1acf37eb953e7b2087c0f1 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 19 Jan 2012 12:43:28 +0000 Subject: Reverted last change as it does not remove the lock file svn changeset:22707/svn branch:6.7 --- tests/integration_base_files/cleanup.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/integration_base_files/cleanup.sh b/tests/integration_base_files/cleanup.sh index 44e2e5f6ee..42fb5a434d 100644 --- a/tests/integration_base_files/cleanup.sh +++ b/tests/integration_base_files/cleanup.sh @@ -23,5 +23,4 @@ if [ -a /home/integration/demo.war ] fi echo Cleaning deploy dir -ant -f /home/integration/deploy.xml clean - +rm -rf /home/integration/deploy/* -- cgit v1.2.3 From 6da82c3ed2d7970d16d9bd9e80ac35c307bff242 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 19 Jan 2012 16:17:37 +0000 Subject: #8271 Enabled Jetty 8 test svn changeset:22711/svn branch:6.7 --- tests/integration_tests.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml index 7b4e9757e5..14a75191fe 100644 --- a/tests/integration_tests.xml +++ b/tests/integration_tests.xml @@ -139,13 +139,14 @@ - + + - + -- cgit v1.2.3 From 6abe5920cc4baeb2060ab89df31d2c0c8ece274e Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 19 Jan 2012 17:04:15 +0000 Subject: #8272 Enabled Weblogic 12 test svn changeset:22715/svn branch:6.7 --- tests/integration_tests.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml index 14a75191fe..14fa836a52 100644 --- a/tests/integration_tests.xml +++ b/tests/integration_tests.xml @@ -327,7 +327,7 @@ - + -- cgit v1.2.3 From ab6a049e2fe7747d99c6017941cebaec54848cfe Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 19 Jan 2012 19:51:19 +0000 Subject: Attempt at evening the load of the integration tests by starting all lightweight servers immediately and the more heavy servers later on svn changeset:22720/svn branch:6.7 --- tests/integration_tests.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml index 14fa836a52..0c62d560c3 100644 --- a/tests/integration_tests.xml +++ b/tests/integration_tests.xml @@ -139,14 +139,13 @@ - + - - + @@ -269,15 +268,16 @@ - + + - - + + -- cgit v1.2.3 From 8225e065795b321854c640b1dca9d7ccc4b87d08 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 27 Jan 2012 08:12:04 +0000 Subject: [merge from 6.7] Disable weblogic 12 test for now svn changeset:22775/svn branch:6.8 --- tests/integration_tests.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml index 0c62d560c3..8d342179f5 100644 --- a/tests/integration_tests.xml +++ b/tests/integration_tests.xml @@ -327,7 +327,7 @@ - + -- cgit v1.2.3 From 1393fa2b9592811300f5110d87d9d4a644d5060d Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 27 Jan 2012 08:15:30 +0000 Subject: [merge from 6.7] #8271 Enabled Jetty 8 test svn changeset:22777/svn branch:6.8 --- tests/integration_tests.xml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml index 8d342179f5..32a6480cd4 100644 --- a/tests/integration_tests.xml +++ b/tests/integration_tests.xml @@ -146,6 +146,13 @@ + + + + + + + -- cgit v1.2.3 From 31f14a53c620a2fbeaa0c46b4ffb033fe36b0e13 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 27 Jan 2012 08:16:00 +0000 Subject: [merge from 6.7] #8272 Enabled Weblogic 12 test svn changeset:22778/svn branch:6.8 --- tests/integration_tests.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml index 32a6480cd4..26dedcce9d 100644 --- a/tests/integration_tests.xml +++ b/tests/integration_tests.xml @@ -334,7 +334,7 @@ - + -- cgit v1.2.3 From 94dddf055a57b344d326c7c1e04a982862ce4382 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 27 Jan 2012 08:17:27 +0000 Subject: [merge from 6.7] Attempt at evening the load of the integration tests by starting all lightweight servers immediately and the more heavy servers later on svn changeset:22779/svn branch:6.8 --- tests/integration_tests.xml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml index 26dedcce9d..946dbc53fd 100644 --- a/tests/integration_tests.xml +++ b/tests/integration_tests.xml @@ -140,19 +140,13 @@ - - - - - - - + -- cgit v1.2.3 From 155a1b9bb98a71041371920d5976cf7ade10ffba Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Fri, 27 Jan 2012 08:45:00 +0000 Subject: Apply all settings when changing direction svn changeset:22784/svn branch:6.7 --- .../com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java index ff3c304600..d50952f070 100644 --- a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java +++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java @@ -176,7 +176,11 @@ public class OrderedLayoutCases extends TestBase { newLayout.setWidth(currentLayout.getWidth(), currentLayout.getWidthUnits()); + newLayout.setMargin(currentLayout.getMargin()); + newLayout.setSpacing(currentLayout.isSpacing()); + getLayout().replaceComponent(currentLayout, newLayout); + getLayout().setExpandRatio(newLayout, 1); currentLayout = newLayout; } }, "Horizontal", "Vertical")); -- cgit v1.2.3 From 0f7bf07b0a332cc6b5cb698b5575358b46579670 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 27 Jan 2012 13:10:57 +0000 Subject: #6902 Table empties field on Layout.replaceComponent svn changeset:22788/svn branch:6.7 --- .../terminal/gwt/client/ui/VScrollTable.java | 12 ++++++ .../table/TextFieldValueGoesMissing.html | 47 ++++++++++++++++++++++ .../table/TextFieldValueGoesMissing.java | 10 +++-- 3 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html (limited to 'tests') diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index 553934bf98..f7d23d4453 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -2592,6 +2592,17 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, break; } break; + case Event.ONCONTEXTMENU: + if (client.hasEventListeners(VScrollTable.this, + HEADER_CLICK_EVENT_ID)) { + // Prevent showing the browser's context menu when there is + // a right click listener. + event.preventDefault(); + } + break; + case Event.ONDBLCLICK: + fireHeaderClickedEvent(event); + break; case Event.ONTOUCHMOVE: case Event.ONMOUSEMOVE: if (dragging) { @@ -4736,6 +4747,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, Paintable paintable = client.getPaintable(uidl); paintable.updateFromUIDL(uidl, client); } + pendingComponentPaints.clear(); } } diff --git a/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html b/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html new file mode 100644 index 0000000000..4573cf4c50 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html @@ -0,0 +1,47 @@ + + + + + + +TextFieldValueGoesMissing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TextFieldValueGoesMissing
open/run/com.vaadin.tests.components.table.TextFieldValueGoesMissing?restartApplication
mouseClickvaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]73,10
enterCharactervaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]test
clickvaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
contextmenuvaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]
assertValuevaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]test
+ + diff --git a/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java b/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java index 254f1b0a90..f3ff5e983e 100644 --- a/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java +++ b/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java @@ -17,11 +17,15 @@ public class TextFieldValueGoesMissing extends TestBase { final Label label1 = new Label("1"); final Label label2 = new Label("2"); - Button button = new Button("Refresh"); + Button button = new Button("Replace label"); button.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { - verticalLayout.replaceComponent(label1, label2); + if (verticalLayout.getComponentIndex(label1) > -1) { + verticalLayout.replaceComponent(label1, label2); + } else { + verticalLayout.replaceComponent(label2, label1); + } } }); verticalLayout.addComponent(button); @@ -41,7 +45,7 @@ public class TextFieldValueGoesMissing extends TestBase { @Override protected String getDescription() { - return "Enter a text in the TextField in the table and press the 'replace label' button. This replaces the label which is in the same layout as the table but should not cause the TextField in the table to lose its contents"; + return "Enter a text in the TextField in the table and press the 'Replace label' button. This replaces the label which is in the same layout as the table but should not cause the TextField in the table to lose its contents"; } @Override -- cgit v1.2.3 From 96b723239a017aea19bd7b76d6bee2fc74e1e4b0 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Fri, 27 Jan 2012 13:21:33 +0000 Subject: #6718 TestBench test svn changeset:22792/svn branch:6.8 --- .../datefield/PopupDateFieldExtendedRange.html | 142 +++++++++++++++++++++ .../datefield/PopupDateFieldExtendedRange.java | 69 ++++++++++ 2 files changed, 211 insertions(+) create mode 100644 tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html create mode 100644 tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html b/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html new file mode 100644 index 0000000000..97398b4964 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html @@ -0,0 +1,142 @@ + + + + + + +PopupDateFieldExtendedRange + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PopupDateFieldExtendedRange
open/run/com.vaadin.tests.components.datefield.PopupDateFieldExtendedRange?restartApplication
mouseClickvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton12,18
screenCapture
mouseClickvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]#prevmon11,9
screenCapture
mouseClickvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]#prevy10,13
screenCapture
mouseClickvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton18,10
clickvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
mouseClickvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton16,12
screenCapture
mouseClickvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton17,10
mouseClickvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]#popupButton11,8
pressSpecialKeyvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]left
pressSpecialKeyvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]left
pressSpecialKeyvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]up
pressSpecialKeyvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]up
screenCapture
pressSpecialKeyvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]shift left
pressSpecialKeyvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]shift down
screenCapture
mouseClickvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]#popupButton9,4
mouseClickvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]#popupButton9,9
screenCapture
mouseClickvaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]#popupButton21,4
+ + diff --git a/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java b/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java new file mode 100644 index 0000000000..4fc8f87398 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java @@ -0,0 +1,69 @@ +package com.vaadin.tests.components.datefield; + +import java.util.Calendar; +import java.util.Locale; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.DateField; +import com.vaadin.ui.PopupDateField; + +@SuppressWarnings("serial") +public class PopupDateFieldExtendedRange extends TestBase { + + private Calendar date = Calendar.getInstance(); + + @Override + protected void setup() { + date.set(2011, 0, 1); + + getLayout().setSpacing(true); + + final PopupDateField[] fields = new PopupDateField[3]; + + fields[0] = makeDateField(); + fields[0].setLocale(new Locale("fi", "FI")); + fields[0].setCaption("Finnish locale"); + + fields[1] = makeDateField(); + fields[1].setLocale(new Locale("en", "US")); + fields[1].setCaption("US English locale"); + + fields[2] = makeDateField(); + fields[2].setLocale(new Locale("fi", "FI")); + fields[2].setShowISOWeekNumbers(true); + fields[2].setCaption("Finnish locale with week numbers"); + + for (PopupDateField f : fields) { + addComponent(f); + } + + addComponent(new Button("Change date", new ClickListener() { + public void buttonClick(ClickEvent event) { + date.set(2010, 1, 16); + for (PopupDateField f : fields) { + f.setValue(date.getTime()); + } + } + })); + } + + @Override + protected String getDescription() { + return "Show a few days of the preceding and following months in the datefield popup"; + } + + @Override + protected Integer getTicketNumber() { + return 6718; + } + + private PopupDateField makeDateField() { + PopupDateField pdf = new PopupDateField(); + pdf.setResolution(DateField.RESOLUTION_DAY); + pdf.setValue(date.getTime()); + return pdf; + } +} -- cgit v1.2.3 From b1ae3cd70e2ca4656bb28f77ca79fe0efd29dd67 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 27 Jan 2012 14:07:33 +0000 Subject: #8311 Verify that all source files use unix style line delimiters svn changeset:22796/svn branch:6.7 --- .../vaadin/tests/server/LicenseInJavaFiles.java | 54 ---------- .../com/vaadin/tests/server/SourceFileChecker.java | 114 +++++++++++++++++++++ 2 files changed, 114 insertions(+), 54 deletions(-) delete mode 100644 tests/server-side/com/vaadin/tests/server/LicenseInJavaFiles.java create mode 100644 tests/server-side/com/vaadin/tests/server/SourceFileChecker.java (limited to 'tests') diff --git a/tests/server-side/com/vaadin/tests/server/LicenseInJavaFiles.java b/tests/server-side/com/vaadin/tests/server/LicenseInJavaFiles.java deleted file mode 100644 index 6f3a05562b..0000000000 --- a/tests/server-side/com/vaadin/tests/server/LicenseInJavaFiles.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.vaadin.tests.server; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.HashSet; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.commons.io.IOUtils; - -public class LicenseInJavaFiles extends TestCase { - - /** - * The tests are run in the build directory. - */ - public static String SRC_DIR = "../src"; - - public void testJavaFilesContainsLicense() throws IOException { - File srcDir = new File(SRC_DIR); - System.out.println(new File(".").getAbsolutePath()); - HashSet missing = new HashSet(); - checkForLicense(srcDir, missing); - if (!missing.isEmpty()) { - throw new RuntimeException( - "The following files are missing license information:\n" - + missing.toString()); - } - } - - private void checkForLicense(File srcDir, HashSet missing) - throws IOException { - Assert.assertTrue("Source directory " + srcDir + " does not exist", - srcDir.exists()); - - for (File f : srcDir.listFiles()) { - if (f.isDirectory()) { - checkForLicense(f, missing); - } else if (f.getName().endsWith(".java")) { - checkForLicenseInFile(f, missing); - } - } - } - - private void checkForLicenseInFile(File f, HashSet missing) - throws IOException { - String contents = IOUtils.toString(new FileInputStream(f)); - if (!contents.contains("@" + "VaadinApache2LicenseForJavaFiles" + "@")) { - missing.add(f.getPath()); - } - - } -} diff --git a/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java new file mode 100644 index 0000000000..91aaf131f5 --- /dev/null +++ b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java @@ -0,0 +1,114 @@ +package com.vaadin.tests.server; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.HashSet; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.commons.io.IOUtils; + +public class SourceFileChecker extends TestCase { + + /** + * The tests are run in the build directory. + */ + public static String baseDirectory = null; + public static final String SRC_DIR = getBaseDir() + "src"; + public static final String TESTBENCH_SRC_DIR = getBaseDir() + + "tests/testbench"; + public static final String SERVERSIDE_SRC_DIR = getBaseDir() + + "tests/server-side"; + public static final String CLIENTSIDE_SRC_DIR = getBaseDir() + + "tests/client-side"; + + public static String getBaseDir() { + if (baseDirectory != null) { + return baseDirectory; + } + // Run in the "build" directory by build, in the project root by Eclipse + for (File f : new File("..").listFiles()) { + if (f.getName().equals("buildhelpers")) { + // We are in "build" + baseDirectory = "../"; + return baseDirectory; + } + } + + baseDirectory = ""; + return baseDirectory; + } + + private static final String[] ALL_SRC_DIRS = new String[] { SRC_DIR, + TESTBENCH_SRC_DIR, SERVERSIDE_SRC_DIR, CLIENTSIDE_SRC_DIR }; + + public void testJavaFilesContainsLicense() throws IOException { + validateJavaFiles(SRC_DIR, new LicenseChecker(), + "The following files are missing license information:\n{0}"); + } + + public void testJavaFilesUseUnixNewline() throws IOException { + for (String dir : ALL_SRC_DIRS) { + validateJavaFiles(dir, new DosNewlineDetector(), + "The following files contain CRLF instead of LF:\n{0}"); + } + } + + public interface FileValidator { + void validateFile(File f) throws Exception; + } + + private void validateJavaFiles(String directory, FileValidator validator, + String errorMessage) { + File srcDir = new File(directory); + System.out.println(new File(".").getAbsolutePath()); + HashSet missing = new HashSet(); + validateFiles(srcDir, missing, validator, ".java"); + if (!missing.isEmpty()) { + throw new RuntimeException(errorMessage.replace("{0}", + missing.toString())); + } + + } + + private void validateFiles(File srcDir, HashSet missing, + FileValidator validator, String suffix) { + Assert.assertTrue("Directory " + srcDir + " does not exist", + srcDir.exists()); + + for (File f : srcDir.listFiles()) { + if (f.isDirectory()) { + validateFiles(f, missing, validator, suffix); + } else if (f.getName().endsWith(suffix)) { + try { + validator.validateFile(f); + } catch (Throwable t) { + missing.add(f.getPath()); + } + } + } + } + + class DosNewlineDetector implements FileValidator { + + public void validateFile(File f) throws Exception { + String contents = IOUtils.toString(new FileInputStream(f)); + if (contents.contains("\r\n")) { + throw new IllegalArgumentException(); + } + + } + } + + class LicenseChecker implements FileValidator { + public void validateFile(File f) throws Exception { + String contents = IOUtils.toString(new FileInputStream(f)); + if (!contents.contains("@" + "VaadinApache2LicenseForJavaFiles" + + "@")) { + throw new IllegalArgumentException(); + } + } + } +} -- cgit v1.2.3