diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2020-03-23 17:48:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-23 17:48:20 +0200 |
commit | f96263b21c3440f02d55c6d37a89a354c3093bdb (patch) | |
tree | a24a9adde1d87684be13af8fbaa4b5f082ea8051 /uitest/src/main/java/com | |
parent | 241e3d24091a4f27837be3dd113e9393b91c22db (diff) | |
download | vaadin-framework-f96263b21c3440f02d55c6d37a89a354c3093bdb.tar.gz vaadin-framework-f96263b21c3440f02d55c6d37a89a354c3093bdb.zip |
Tweaked layouttester tests to be more informative. (#11800) (#11813)
Diffstat (limited to 'uitest/src/main/java/com')
25 files changed, 297 insertions, 30 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseAlignment.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseAlignment.java index 20cb15240e..fb6c28c352 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseAlignment.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseAlignment.java @@ -31,7 +31,7 @@ public abstract class BaseAlignment extends BaseLayoutTestUI { } layout.setMargin(false); layout.setSpacing(false); - layout.setHeight("300px"); + layout.setHeight("100px"); layout.setWidth("200px"); layout.addComponent(components[i]); layout.setComponentAlignment(components[i], alignments[i]); diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutExpand.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutExpand.java index 637019c61f..fa5aee0544 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutExpand.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutExpand.java @@ -42,8 +42,6 @@ public class BaseLayoutExpand extends BaseLayoutTestUI { } Table t1 = getTestTable(); Table t2 = getTestTable(); - t1.setSizeFull(); - t2.setSizeFull(); l2.addComponent(t1); l2.addComponent(t2); diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutForSpacingMargin.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutForSpacingMargin.java index b122d48fe3..2331be46fe 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutForSpacingMargin.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutForSpacingMargin.java @@ -26,8 +26,6 @@ public class BaseLayoutForSpacingMargin extends BaseLayoutTestUI { private void buildLayout() { Table t1 = getTestTable(); Table t2 = getTestTable(); - t1.setSizeFull(); - t2.setSizeFull(); l2.addComponent(t1); l2.setMargin(false); l2.setSpacing(false); diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java index 7ae05f343a..cb08992bf4 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java @@ -28,10 +28,11 @@ public abstract class BaseLayoutTestUI extends AbstractReindeerTestUI { protected static final String CALENDAR_32_PNG = "../runo/icons/16/calendar.png"; protected static final String LOCK_16_PNG = "../runo/icons/16/lock.png"; protected static final String GLOBE_16_PNG = "../runo/icons/16/globe.png"; - public Alignment[] alignments = { Alignment.TOP_CENTER, Alignment.TOP_LEFT, - Alignment.TOP_RIGHT, Alignment.BOTTOM_CENTER, Alignment.BOTTOM_LEFT, - Alignment.BOTTOM_RIGHT, Alignment.MIDDLE_CENTER, - Alignment.MIDDLE_LEFT, Alignment.MIDDLE_RIGHT }; + public Alignment[] alignments = new Alignment[] { Alignment.TOP_LEFT, + Alignment.TOP_CENTER, Alignment.TOP_RIGHT, Alignment.MIDDLE_LEFT, + Alignment.MIDDLE_CENTER, Alignment.MIDDLE_RIGHT, + Alignment.BOTTOM_LEFT, Alignment.BOTTOM_CENTER, + Alignment.BOTTOM_RIGHT }; public final String[] CAPTIONS = { "", "VeryLongOneWordCaption", "Very long caption of 50 approximately symbols aaaaaaaaaaaa aaaaaa aaa " }; @@ -74,7 +75,8 @@ public abstract class BaseLayoutTestUI extends AbstractReindeerTestUI { private void fillComponents() { for (int i = 0; i < components.length; i++) { String name = "Field" + i; - TextField field = new TextField(); + TextField field = new TextField(alignments[i].getVerticalAlignment() + + " " + alignments[i].getHorizontalAlignment()); field.setValue(name); components[i] = field; } @@ -91,9 +93,7 @@ public abstract class BaseLayoutTestUI extends AbstractReindeerTestUI { l2.setMargin(false); final AbstractComponent c1 = getTestTable(); - c1.setSizeFull(); final AbstractComponent c2 = getTestTable(); - c2.setSizeFull(); class SetSizeButton extends Button { SetSizeButton(final String size) { @@ -106,6 +106,7 @@ public abstract class BaseLayoutTestUI extends AbstractReindeerTestUI { } else if (compType == "component") { c2.setHeight(size); c2.setWidth(size); + c2.setCaption("Configured width"); } }); } @@ -135,11 +136,13 @@ public abstract class BaseLayoutTestUI extends AbstractReindeerTestUI { newLabel.setSizeUndefined(); l2.addComponent(newLabel); }); + btn2.setCaption(btn2.getCaption() + " + add Label"); } protected Table getTestTable() { Table t = new Table(); - t.setPageLength(5); + t.setSizeFull(); + t.setCaption("100% default width"); t.addContainerProperty("test", String.class, null); t.addItem(new Object[] { "qwertyuiop asdfghjköäxccvbnm,m,." }, 1); t.addItem(new Object[] { "YGVYTCTCTRXRXRXRX" }, 2); @@ -207,6 +210,12 @@ public abstract class BaseLayoutTestUI extends AbstractReindeerTestUI { protected void setup(VaadinRequest request) { mainLayout.setMargin(false); mainLayout.setSpacing(false); + mainLayout.setSizeUndefined(); + getLayout().setSizeUndefined(); + if (getLayout().getParent() instanceof VerticalLayout) { + ((VerticalLayout) getLayout().getParent()).setSizeUndefined(); + } + mainLayout.addComponent(l1); mainLayout.addComponent(l2); addComponent(mainLayout); @@ -226,8 +235,8 @@ public abstract class BaseLayoutTestUI extends AbstractReindeerTestUI { AbstractOrderedLayout l2, String w, String h) { l1.setWidth(w); l1.setHeight(h); - l2.setWidth(h); - l2.setHeight(w); + l2.setWidth(w); + l2.setHeight(h); } protected void setDefaultForVertical(AbstractOrderedLayout l1, diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridAlignment.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridAlignment.java index c6da40e878..ea108c8d37 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridAlignment.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridAlignment.java @@ -8,6 +8,7 @@ public class GridAlignment extends GridBaseLayoutTestUI { protected void setup(VaadinRequest request) { buildLayout(); super.setup(request); + layout.setSizeFull(); } /** @@ -16,8 +17,6 @@ public class GridAlignment extends GridBaseLayoutTestUI { private void buildLayout() { layout.setColumns(3); layout.setRows(3); - // layout.setHeight("600px"); - // layout.setWidth("900px"); for (int i = 0; i < components.length; i++) { layout.addComponent(components[i]); layout.setComponentAlignment(components[i], alignments[i]); diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridBaseLayoutTestUI.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridBaseLayoutTestUI.java index d808b99bdc..7c5b223d15 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridBaseLayoutTestUI.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridBaseLayoutTestUI.java @@ -21,8 +21,7 @@ public abstract class GridBaseLayoutTestUI extends BaseLayoutTestUI { @Override protected void setup(VaadinRequest request) { - layout.setMargin(true); - layout.setSizeFull(); + layout.setSizeUndefined(); getUI().setContent(layout); } @@ -33,9 +32,7 @@ public abstract class GridBaseLayoutTestUI extends BaseLayoutTestUI { layout.setMargin(false); final AbstractComponent c1 = getTestTable(); - c1.setSizeFull(); final AbstractComponent c2 = getTestTable(); - c2.setSizeFull(); class SetSizeButton extends Button { SetSizeButton(final String size) { @@ -48,11 +45,12 @@ public abstract class GridBaseLayoutTestUI extends BaseLayoutTestUI { } else if (compType == "component") { c2.setHeight(size); c2.setWidth(size); + c2.setCaption("Configured width"); } }); } } - Button btn1 = new SetSizeButton("550px"); + Button btn1 = new SetSizeButton("350px"); Button btn2 = new SetSizeButton("-1px"); Button btn3 = new SetSizeButton("75%"); Button btn4 = new SetSizeButton("100%"); @@ -74,5 +72,6 @@ public abstract class GridBaseLayoutTestUI extends BaseLayoutTestUI { newLabel.setSizeUndefined(); layout.addComponent(newLabel); }); + btn2.setCaption(btn2.getCaption() + " + add Label"); } } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridComponentSizing.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridComponentSizing.java index 403fc30305..5b91b78b51 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridComponentSizing.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridComponentSizing.java @@ -8,5 +8,6 @@ public class GridComponentSizing extends GridBaseLayoutTestUI { protected void setup(VaadinRequest request) { getLayoutForLayoutSizing("component"); super.setup(request); + layout.setSizeFull(); } } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridIcon.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridIcon.java index e952574047..be9e36e96c 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridIcon.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridIcon.java @@ -1,6 +1,7 @@ package com.vaadin.tests.layouts.layouttester.GridLayout; import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; import com.vaadin.ui.Label; import com.vaadin.ui.Link; @@ -19,4 +20,13 @@ public class GridIcon extends GridBaseLayoutTestUI { layout.addComponent(createLabelsFields(TabSheet.class, true, "")); super.setup(request); } + + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + super.setLayoutMeasures(l1, l2, "400px", "-1px"); + l1.setSpacing(true); + l2.setSpacing(true); + mainLayout.setSpacing(true); + } } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutExpand.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutExpand.java index 8578e9f958..bb5be728d6 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutExpand.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutExpand.java @@ -10,6 +10,7 @@ public class GridLayoutExpand extends GridBaseLayoutTestUI { protected void setup(VaadinRequest request) { buildLayout(); super.setup(request); + layout.setSizeFull(); } private void buildLayout() { @@ -27,8 +28,6 @@ public class GridLayoutExpand extends GridBaseLayoutTestUI { } Table t1 = getTestTable(); Table t2 = getTestTable(); - t1.setSizeFull(); - t2.setSizeFull(); layout.setColumns(4); layout.setRows(4); layout.addComponent(new ExpandButton(1, 2, 1.0f, 0.0f), 0, 0); diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacing.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacing.java index 1e220cbd69..1b15b435bf 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacing.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacing.java @@ -17,8 +17,8 @@ public class GridLayoutMarginSpacing extends GridBaseLayoutTestUI { private void buildLayout() { Table t1 = getTestTable(); Table t2 = getTestTable(); - t1.setSizeFull(); - t2.setSizeFull(); + t1.setSizeUndefined(); + t2.setSizeUndefined(); final Button btn1 = new Button("Toggle margin on/off"); btn1.addClickListener(event -> { diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegError.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegError.java index dcd5c63310..27c82984a2 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegError.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegError.java @@ -2,6 +2,7 @@ package com.vaadin.tests.layouts.layouttester.GridLayout; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.TestDateField; +import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; import com.vaadin.ui.Label; @@ -31,4 +32,10 @@ public class GridLayoutRegError extends GridBaseLayoutTestUI { layout.addComponent(createLabelsFields(CheckBox.class, true, "")); } + + @Override + protected void setDefaultForVertical(AbstractOrderedLayout l1, + AbstractOrderedLayout l2) { + setLayoutMeasures(l1, l2, "800px", "800px"); + } } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutSizing.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutSizing.java index 6074cdae52..671fdf1163 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutSizing.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutSizing.java @@ -1,6 +1,12 @@ package com.vaadin.tests.layouts.layouttester.GridLayout; import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.ContentMode; +import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Label; public class GridLayoutSizing extends GridBaseLayoutTestUI { @@ -8,5 +14,63 @@ public class GridLayoutSizing extends GridBaseLayoutTestUI { protected void setup(VaadinRequest request) { getLayoutForLayoutSizing("layout"); super.setup(request); + layout.setSizeFull(); + } + + @Override + protected void getLayoutForLayoutSizing(final String compType) { + + layout.setSpacing(false); + layout.setMargin(false); + + final AbstractComponent c1 = getTestTable(); + final AbstractComponent c2 = getTestTable(); + + class SetSizeButton extends Button { + SetSizeButton(final String size) { + super(); + setCaption("Set size " + size); + addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + if (compType == "layout") { + layout.setHeight(size); + layout.setWidth(size); + } else if (compType == "component") { + c2.setHeight(size); + c2.setWidth(size); + } else { + } + + } + }); + } + + } + Button btn1 = new SetSizeButton("600px"); + Button btn2 = new SetSizeButton("-1px"); + Button btn3 = new SetSizeButton("75%"); + Button btn4 = new SetSizeButton("100%"); + + layout.addComponent(btn1); + layout.addComponent(btn2); + layout.addComponent(btn3); + layout.addComponent(btn4); + layout.addComponent(c1); + layout.addComponent(new Label( + "<div style='height: 1px'></div><hr /><div style='height: 1px'></div>", + ContentMode.HTML)); + layout.addComponent(c2); + btn2.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + Label newLabel = new Label("--- NEW LABEL ---"); + newLabel.setSizeUndefined(); + layout.addComponent(newLabel); + } + }); + btn2.setCaption(btn2.getCaption() + " + add Label"); } } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java index 2a20a751b6..4e666c7ba5 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java @@ -1,6 +1,7 @@ package com.vaadin.tests.layouts.layouttester.HLayout; import com.vaadin.tests.layouts.layouttester.BaseAddReplaceMove; +import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.HorizontalLayout; public class HAddReplaceMove extends BaseAddReplaceMove { @@ -12,4 +13,10 @@ public class HAddReplaceMove extends BaseAddReplaceMove { super(HorizontalLayout.class); } + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + super.setLayoutMeasures(l1, l2, "1200px", h); + } + } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HAlignment.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HAlignment.java index 6becfc75c5..156d5f21f3 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HAlignment.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HAlignment.java @@ -1,6 +1,7 @@ package com.vaadin.tests.layouts.layouttester.HLayout; import com.vaadin.tests.layouts.layouttester.BaseAlignment; +import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.HorizontalLayout; public class HAlignment extends BaseAlignment { @@ -9,4 +10,10 @@ public class HAlignment extends BaseAlignment { super(HorizontalLayout.class); } + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + super.setLayoutMeasures(l1, l2, "1000px", "200px"); + } + } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HComponentSizing.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HComponentSizing.java index 1c02002631..f107d8c4fc 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HComponentSizing.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HComponentSizing.java @@ -1,11 +1,36 @@ package com.vaadin.tests.layouts.layouttester.HLayout; +import java.util.Iterator; + +import com.vaadin.server.VaadinRequest; import com.vaadin.tests.layouts.layouttester.BaseComponentSizing; +import com.vaadin.ui.AbstractOrderedLayout; +import com.vaadin.ui.Component; import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; public class HComponentSizing extends BaseComponentSizing { public HComponentSizing() { super(HorizontalLayout.class); } + + @Override + protected void setup(VaadinRequest request) { + super.setup(request); + Iterator<Component> iterator = l2.iterator(); + while (iterator.hasNext()) { + Component component = iterator.next(); + if (component instanceof Label) { + component.setWidth("30px"); + } + } + } + + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + super.setLayoutMeasures(l1, l2, "900px", h); + l1.setSizeUndefined(); + } } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HIcon.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HIcon.java index 772cda2035..9f45c8bbf7 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HIcon.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HIcon.java @@ -1,6 +1,7 @@ package com.vaadin.tests.layouts.layouttester.HLayout; import com.vaadin.tests.layouts.layouttester.BaseIcon; +import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.HorizontalLayout; public class HIcon extends BaseIcon { @@ -9,4 +10,10 @@ public class HIcon extends BaseIcon { super(HorizontalLayout.class); } + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + super.setLayoutMeasures(l1, l2, "2900px", "200px"); + } + } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutMarginSpacing.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutMarginSpacing.java index 760f2d7497..6789650c70 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutMarginSpacing.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutMarginSpacing.java @@ -1,7 +1,14 @@ package com.vaadin.tests.layouts.layouttester.HLayout; +import java.util.Iterator; + +import com.vaadin.server.VaadinRequest; import com.vaadin.tests.layouts.layouttester.BaseLayoutForSpacingMargin; +import com.vaadin.ui.AbstractOrderedLayout; +import com.vaadin.ui.Component; import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.v7.ui.Table; public class HLayoutMarginSpacing extends BaseLayoutForSpacingMargin { @@ -9,4 +16,24 @@ public class HLayoutMarginSpacing extends BaseLayoutForSpacingMargin { super(HorizontalLayout.class); } + @Override + protected void setup(VaadinRequest request) { + super.setup(request); + Iterator<Component> iterator = l2.iterator(); + while (iterator.hasNext()) { + Component component = iterator.next(); + if (component instanceof Table) { + component.setSizeUndefined(); + } else if (component instanceof Label) { + component.setWidth("30px"); + } + } + } + + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + l1.setSizeUndefined(); + l2.setSizeUndefined(); + } } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutRegError.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutRegError.java index f78d1d4d6c..e5fda46012 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutRegError.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutRegError.java @@ -1,6 +1,7 @@ package com.vaadin.tests.layouts.layouttester.HLayout; import com.vaadin.tests.layouts.layouttester.BaseRegError; +import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.HorizontalLayout; public class HLayoutRegError extends BaseRegError { @@ -8,4 +9,10 @@ public class HLayoutRegError extends BaseRegError { public HLayoutRegError() { super(HorizontalLayout.class); } + + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + super.setLayoutMeasures(l1, l2, "3200px", "200px"); + } } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutSizing.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutSizing.java index 37c5e9d9e6..2f9cb29041 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutSizing.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutSizing.java @@ -1,11 +1,43 @@ package com.vaadin.tests.layouts.layouttester.HLayout; -import com.vaadin.tests.layouts.layouttester.BaseComponentSizing; +import java.util.Iterator; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.layouts.layouttester.BaseLayoutSizing; +import com.vaadin.ui.AbstractOrderedLayout; +import com.vaadin.ui.Component; import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.VerticalLayout; -public class HLayoutSizing extends BaseComponentSizing { +public class HLayoutSizing extends BaseLayoutSizing { public HLayoutSizing() { super(HorizontalLayout.class); } + + @Override + protected void setup(VaadinRequest request) { + super.setup(request); + Iterator<Component> iterator = l2.iterator(); + while (iterator.hasNext()) { + Component component = iterator.next(); + if (component instanceof Label) { + component.setWidth("30px"); + } + } + mainLayout.setSizeFull(); + getLayout().setSizeFull(); + if (getLayout().getParent() instanceof VerticalLayout) { + ((VerticalLayout) getLayout().getParent()).setSizeFull(); + } + mainLayout.setExpandRatio(l2, 2); + } + + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + super.setLayoutMeasures(l1, l2, "900px", h); + l1.setSizeUndefined(); + } } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VAlignment.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VAlignment.java index 3e020b52da..7b512d5b52 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VAlignment.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VAlignment.java @@ -1,10 +1,17 @@ package com.vaadin.tests.layouts.layouttester.VLayout; import com.vaadin.tests.layouts.layouttester.BaseAlignment; +import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.VerticalLayout; public class VAlignment extends BaseAlignment { public VAlignment() { super(VerticalLayout.class); } + + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + super.setLayoutMeasures(l1, l2, "400px", "500px"); + } } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VComponentSizing.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VComponentSizing.java index 2eb3616623..2fef294c2b 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VComponentSizing.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VComponentSizing.java @@ -1,6 +1,7 @@ package com.vaadin.tests.layouts.layouttester.VLayout; import com.vaadin.tests.layouts.layouttester.BaseComponentSizing; +import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.VerticalLayout; public class VComponentSizing extends BaseComponentSizing { @@ -9,4 +10,13 @@ public class VComponentSizing extends BaseComponentSizing { super(VerticalLayout.class); } + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + l1.setWidth("400px"); + l1.setHeight("-1px"); + l2.setWidth("400px"); + l2.setHeight("800px"); + } + } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VIcon.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VIcon.java index 1fa159a2be..4e9e215abc 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VIcon.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VIcon.java @@ -1,6 +1,7 @@ package com.vaadin.tests.layouts.layouttester.VLayout; import com.vaadin.tests.layouts.layouttester.BaseIcon; +import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.VerticalLayout; public class VIcon extends BaseIcon { @@ -9,4 +10,13 @@ public class VIcon extends BaseIcon { super(VerticalLayout.class); } + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + super.setLayoutMeasures(l1, l2, "400px", "-1px"); + l1.setSpacing(true); + l2.setSpacing(true); + mainLayout.setSpacing(true); + } + } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutMarginSpacing.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutMarginSpacing.java index 87598cd96c..4eeec256be 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutMarginSpacing.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutMarginSpacing.java @@ -1,7 +1,14 @@ package com.vaadin.tests.layouts.layouttester.VLayout; +import java.util.Iterator; + +import com.vaadin.server.VaadinRequest; import com.vaadin.tests.layouts.layouttester.BaseLayoutForSpacingMargin; +import com.vaadin.ui.AbstractOrderedLayout; +import com.vaadin.ui.Component; +import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; +import com.vaadin.v7.ui.Table; public class VLayoutMarginSpacing extends BaseLayoutForSpacingMargin { @@ -9,4 +16,25 @@ public class VLayoutMarginSpacing extends BaseLayoutForSpacingMargin { super(VerticalLayout.class); } + @Override + protected void setup(VaadinRequest request) { + super.setup(request); + Iterator<Component> iterator = l2.iterator(); + while (iterator.hasNext()) { + Component component = iterator.next(); + if (component instanceof Table) { + component.setSizeUndefined(); + } else if (component instanceof Label) { + component.setWidth("100%"); + } + } + } + + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + l1.setSizeUndefined(); + l2.setSizeUndefined(); + } + } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegError.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegError.java index cc64105e85..8990724b45 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegError.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegError.java @@ -1,6 +1,7 @@ package com.vaadin.tests.layouts.layouttester.VLayout; import com.vaadin.tests.layouts.layouttester.BaseRegError; +import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.VerticalLayout; public class VLayoutRegError extends BaseRegError { @@ -8,4 +9,10 @@ public class VLayoutRegError extends BaseRegError { public VLayoutRegError() { super(VerticalLayout.class); } + + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + super.setLayoutMeasures(l1, l2, "400px", "900px"); + } } diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizing.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizing.java index d6d91700c7..3e3f046882 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizing.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizing.java @@ -1,12 +1,21 @@ package com.vaadin.tests.layouts.layouttester.VLayout; -import com.vaadin.tests.layouts.layouttester.BaseComponentSizing; +import com.vaadin.tests.layouts.layouttester.BaseLayoutSizing; +import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.VerticalLayout; -public class VLayoutSizing extends BaseComponentSizing { +public class VLayoutSizing extends BaseLayoutSizing { public VLayoutSizing() { super(VerticalLayout.class); } + @Override + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + l1.setWidth("400px"); + l1.setHeight("-1px"); + l2.setWidth("400px"); + l2.setHeight("500px"); + } } |