diff options
author | Johannes Dahlström <johannes.dahlstrom@vaadin.com> | 2012-01-16 07:03:15 +0000 |
---|---|---|
committer | Johannes Dahlström <johannes.dahlstrom@vaadin.com> | 2012-01-16 07:03:15 +0000 |
commit | 69d6bf76820929777168055bf0a941d691463a6b (patch) | |
tree | 1128b3d973e4ecec53559be30e8c8b24ca634754 /tests/testbench | |
parent | 326ccadd49971a36bcf4c356f114eba70a4e337f (diff) | |
download | vaadin-framework-69d6bf76820929777168055bf0a941d691463a6b.tar.gz vaadin-framework-69d6bf76820929777168055bf0a941d691463a6b.zip |
Merge from 6.7
svn changeset:22637/svn branch:6.8
Diffstat (limited to 'tests/testbench')
9 files changed, 736 insertions, 9 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.html b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.html new file mode 100644 index 0000000000..f367fc383b --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.html @@ -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.datefield.DatePopupStyleName?&restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDatePopupStyleName::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td> + <td>4,10</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>styled-popup</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java new file mode 100644 index 0000000000..ba4e324dc1 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java @@ -0,0 +1,33 @@ +package com.vaadin.tests.components.datefield;
+
+import java.util.Date;
+
+import com.vaadin.terminal.UserError;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.DateField;
+
+public class DatePopupStyleName extends TestBase {
+ @Override
+ public void setup() {
+ setTheme("reindeer-tests");
+
+ final DateField df = new DateField();
+ df.setValue(new Date(1203910239L));
+ df.setWidth("200px");
+ df.setRequired(true);
+ df.setComponentError(new UserError("abc"));
+ df.addStyleName("popup-style");
+ addComponent(df);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "The DateField is given a style name 'test', but that style isn't applied on the calendar popup element.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8083;
+ }
+
+}
diff --git a/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.html b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.html new file mode 100644 index 0000000000..70441efd9f --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.html @@ -0,0 +1,51 @@ +<?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.datefield.WidthRecalculationOnEnableStateChange?restartApplication</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldWidthRecalculationOnEnableStateChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>disabled</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldWidthRecalculationOnEnableStateChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>enabled</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldWidthRecalculationOnEnableStateChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>readonly</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java new file mode 100644 index 0000000000..f25a9f0350 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java @@ -0,0 +1,44 @@ +package com.vaadin.tests.components.datefield;
+
+import java.util.Date;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.DateField;
+
+public class WidthRecalculationOnEnableStateChange extends TestBase {
+ @Override
+ public void setup() {
+ setTheme("reindeer-tests");
+
+ final DateField df = new DateField();
+ df.setValue(new Date(1203910239L));
+ df.setWidth("200px");
+ df.addStyleName("enabled-readonly-styled");
+ addComponent(df);
+ addComponent(new Button("Toggle disabled for date field",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ df.setEnabled(!df.isEnabled());
+ }
+ }));
+ addComponent(new Button("Toggle read only for date field",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ df.setReadOnly(!df.isReadOnly());
+ }
+ }));
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Setting the disabled state doesn't recalculate the input element width. Setting the read-only state instead recalculates the width. In both cases, the popup button is hidden using CSS.<br><br>The DateField is also given a style name 'test', but that style isn't applied on the calendar popup element.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8085;
+ }
+
+}
diff --git a/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.html b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.html new file mode 100644 index 0000000000..14b5cc4c53 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.html @@ -0,0 +1,46 @@ +<?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.formlayout.FormLayoutCaptionStyles?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>v-caption-bold</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[1]</td> + <td>bold</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[1]</td> + <td>bold</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>v-caption-bold</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java new file mode 100644 index 0000000000..e74969f637 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java @@ -0,0 +1,55 @@ +package com.vaadin.tests.components.formlayout; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.TextField; + +public class FormLayoutCaptionStyles extends TestBase { + + @Override + protected void setup() { + setTheme("reindeer-tests"); + FormLayout fl = new FormLayout(); + + TextField f1 = createTextField("Text field 1", ""); + final TextField f2 = createTextField("Text field 2", "bold"); + + fl.addComponent(f1); + fl.addComponent(new Button("Toggle Text field 2 bold style", + new Button.ClickListener() { + + public void buttonClick(ClickEvent event) { + if ("bold".equals(f2.getStyleName())) { + f2.setStyleName(""); + } else { + f2.setStyleName("bold"); + } + + } + + })); + fl.addComponent(f2); + + addComponent(fl); + + } + + private TextField createTextField(String caption, String style) { + TextField tf = new TextField(caption); + tf.setStyleName(style); + return tf; + } + + @Override + protected String getDescription() { + return "The component style should be copied to the caption element. Changing the component style should update the caption style also"; + } + + @Override + protected Integer getTicketNumber() { + return 5982; + } + +} diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.html b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.html new file mode 100644 index 0000000000..9e1400521b --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.html @@ -0,0 +1,102 @@ +<?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.orderedlayout.OrderedLayoutCases?restartApplication</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>1-undefined-without-relative</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>2-undefined-with-relative</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>3-fixed-with-overflow</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>4-fixed-with-extra-space</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[7]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<!-- Going in the reverse direction from here to avoid some bugs where state is not properly updated --> +<tr> + <td>screenCapture</td> + <td></td> + <td>8-undefined-relative-height</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[6]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>7-fixed-relative-height</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>6-multiple-expands</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>5-expand-with-alignment</td> +</tr> +</tbody></table> +</body> +</html> 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<Object>(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; } diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/VerticalLayoutChangingChildrenSizes.html b/tests/testbench/com/vaadin/tests/components/orderedlayout/VerticalLayoutChangingChildrenSizes.html new file mode 100644 index 0000000000..edcf60176d --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/VerticalLayoutChangingChildrenSizes.html @@ -0,0 +1,211 @@ +<?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.orderedlayout.VerticalLayoutTest?restartApplication</td>
+ <td></td>
+</tr>
+<!--Hide event log-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item1</td>
+ <td>28,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item0</td>
+ <td>30,8</td>
+</tr>
+<!--Add components-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td>
+ <td>41,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>84,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>43,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item0</td>
+ <td>68,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>30,11</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>auto-auto-one-button</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td>
+ <td>35,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>85,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>83,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+ <td>28,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item1</td>
+ <td>40,10</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>auto-auto-two-buttons</td>
+</tr>
+<!--Component 0 -> 100%-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td>
+ <td>42,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>77,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+ <td>115,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item0</td>
+ <td>72,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item4</td>
+ <td>14,2</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>auto-auto-two-buttons-equal-width</td>
+</tr>
+<!--Component 1 -> 200px height-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td>
+ <td>22,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>117,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item3</td>
+ <td>104,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+ <td>74,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item2</td>
+ <td>23,8</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>auto-auto-two-buttons-lower-higher</td>
+</tr>
+<!--Back to what we had before-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td>
+ <td>24,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>104,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+ <td>114,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item0</td>
+ <td>87,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>17,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td>
+ <td>28,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>77,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item3</td>
+ <td>96,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+ <td>75,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>19,3</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>auto-auto-two-buttons</td>
+</tr>
+</tbody></table>
+</body>
+</html>
|