// TODO Auto-generated catch block
e.printStackTrace();
}
- layout.setHeight("300px");
+ layout.setHeight("100px");
layout.setWidth("200px");
layout.addComponent(components[i]);
layout.setComponentAlignment(components[i], alignments[i]);
}
Table t1 = getTestTable();
Table t2 = getTestTable();
- t1.setSizeFull();
- t2.setSizeFull();
l2.addComponent(t1);
l2.addComponent(t2);
private void buildLayout() {
Table t1 = getTestTable();
Table t2 = getTestTable();
- t1.setSizeFull();
- t2.setSizeFull();
l2.addComponent(t1);
l2.setMargin(false);
l2.setSpacing(false);
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 = new Alignment[] { 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 = new String[] { "",
"VeryLongOneWordCaption",
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;
}
l2.setMargin(false);
final AbstractComponent c1 = getTestTable();
- c1.setSizeFull();
final AbstractComponent c2 = getTestTable();
- c2.setSizeFull();
class SetSizeButton extends Button {
SetSizeButton(final String size) {
} else if (compType == "component") {
c2.setHeight(size);
c2.setWidth(size);
+ c2.setCaption("Configured width");
} else {
}
}
});
+ 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);
*/
@Override
protected void setup(VaadinRequest request) {
+ mainLayout.setSizeUndefined();
+ getLayout().setSizeUndefined();
+ if (getLayout().getParent() instanceof VerticalLayout) {
+ ((VerticalLayout) getLayout().getParent()).setSizeUndefined();
+ }
+
mainLayout.addComponent(l1);
mainLayout.addComponent(l2);
addComponent(mainLayout);
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,
protected void setup(VaadinRequest request) {
buildLayout();
super.setup(request);
+ layout.setSizeFull();
}
/**
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]);
@Override
protected void setup(VaadinRequest request) {
- layout.setMargin(true);
- layout.setSizeFull();
+ layout.setSizeUndefined();
getUI().setContent(layout);
}
layout.setMargin(false);
final AbstractComponent c1 = getTestTable();
- c1.setSizeFull();
final AbstractComponent c2 = getTestTable();
- c2.setSizeFull();
class SetSizeButton extends Button {
SetSizeButton(final String size) {
} else if (compType == "component") {
c2.setHeight(size);
c2.setWidth(size);
+ c2.setCaption("Configured width");
} else {
}
}
}
- 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%");
layout.addComponent(newLabel);
}
});
+ btn2.setCaption(btn2.getCaption() + " + add Label");
}
}
protected void setup(VaadinRequest request) {
getLayoutForLayoutSizing("component");
super.setup(request);
+ layout.setSizeFull();
}
}
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.ComboBox;
import com.vaadin.ui.Label;
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);
+ }
}
protected void setup(VaadinRequest request) {
buildLayout();
super.setup(request);
+ layout.setSizeFull();
}
private void buildLayout() {
}
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);
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(new ClickListener() {
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.CheckBox;
import com.vaadin.ui.ComboBox;
layout.addComponent(createLabelsFields(CheckBox.class, true, ""));
}
+
+ @Override
+ protected void setDefaultForVertical(AbstractOrderedLayout l1,
+ AbstractOrderedLayout l2) {
+ setLayoutMeasures(l1, l2, "800px", "800px");
+ }
}
package com.vaadin.tests.layouts.layouttester.GridLayout;
import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.label.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;
/**
*
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");
}
}
*/
package com.vaadin.tests.layouts.layouttester.HLayout;
-import com.vaadin.annotations.Theme;
import com.vaadin.tests.layouts.layouttester.BaseAddReplaceMove;
+import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.HorizontalLayout;
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);
+ }
+
}
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 {
super(HorizontalLayout.class);
}
+ @Override
+ protected void setLayoutMeasures(AbstractOrderedLayout l1,
+ AbstractOrderedLayout l2, String w, String h) {
+ super.setLayoutMeasures(l1, l2, "1000px", "200px");
+ }
+
}
*/
package com.vaadin.tests.layouts.layouttester.HLayout;
-import com.vaadin.annotations.Theme;
+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 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();
+ }
}
*/
package com.vaadin.tests.layouts.layouttester.HLayout;
-import com.vaadin.annotations.Theme;
import com.vaadin.tests.layouts.layouttester.BaseIcon;
+import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.HorizontalLayout;
/**
super(HorizontalLayout.class);
}
+ @Override
+ protected void setLayoutMeasures(AbstractOrderedLayout l1,
+ AbstractOrderedLayout l2, String w, String h) {
+ super.setLayoutMeasures(l1, l2, "2900px", "200px");
+ }
+
}
*/
package com.vaadin.tests.layouts.layouttester.HLayout;
-import com.vaadin.annotations.Theme;
+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.ui.Table;
/**
*
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();
+ }
}
*/
package com.vaadin.tests.layouts.layouttester.HLayout;
-import com.vaadin.annotations.Theme;
import com.vaadin.tests.layouts.layouttester.BaseRegError;
+import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.HorizontalLayout;
/**
public HLayoutRegError() {
super(HorizontalLayout.class);
}
+
+ @Override
+ protected void setLayoutMeasures(AbstractOrderedLayout l1,
+ AbstractOrderedLayout l2, String w, String h) {
+ super.setLayoutMeasures(l1, l2, "3200px", "200px");
+ }
}
*/
package com.vaadin.tests.layouts.layouttester.HLayout;
-import com.vaadin.annotations.Theme;
-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.Table;
+import com.vaadin.ui.VerticalLayout;
/**
*
* @author Vaadin Ltd
*/
-public class HLayoutSizing extends BaseComponentSizing {
+public class HLayoutSizing extends BaseLayoutSizing {
/**
* @param layoutClass
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();
+ }
}
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");
+ }
}
*/
package com.vaadin.tests.layouts.layouttester.VLayout;
-import com.vaadin.annotations.Theme;
import com.vaadin.tests.layouts.layouttester.BaseComponentSizing;
+import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.VerticalLayout;
/**
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");
+ }
+
}
*/
package com.vaadin.tests.layouts.layouttester.VLayout;
-import com.vaadin.annotations.Theme;
import com.vaadin.tests.layouts.layouttester.BaseIcon;
+import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.VerticalLayout;
/**
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);
+ }
+
}
*/
package com.vaadin.tests.layouts.layouttester.VLayout;
-import com.vaadin.annotations.Theme;
+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.Table;
import com.vaadin.ui.VerticalLayout;
/**
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();
+ }
+
}
*/
package com.vaadin.tests.layouts.layouttester.VLayout;
-import com.vaadin.annotations.Theme;
import com.vaadin.tests.layouts.layouttester.BaseRegError;
+import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.VerticalLayout;
/**
public VLayoutRegError() {
super(VerticalLayout.class);
}
+
+ @Override
+ protected void setLayoutMeasures(AbstractOrderedLayout l1,
+ AbstractOrderedLayout l2, String w, String h) {
+ super.setLayoutMeasures(l1, l2, "400px", "900px");
+ }
}
*/
package com.vaadin.tests.layouts.layouttester.VLayout;
-import com.vaadin.annotations.Theme;
-import com.vaadin.tests.layouts.layouttester.BaseComponentSizing;
+import com.vaadin.tests.layouts.layouttester.BaseLayoutSizing;
+import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.VerticalLayout;
/**
* @author Vaadin Ltd
*/
-public class VLayoutSizing extends BaseComponentSizing {
+public class VLayoutSizing extends BaseLayoutSizing {
/**
* @param layoutClass
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");
+ }
}
openTestURL();
sleep(500);
compareScreen("initial");
- String[] states = { "marginOnSpaceOff", "marginOnfSpaceOn" };
+ String[] states = { "marginOnSpaceOff", "marginOnSpaceOn",
+ "marginOffSpaceOn" };
ButtonElement marginBtn = $(ButtonElement.class).get(0);
ButtonElement spaceBtn = $(ButtonElement.class).get(1);
marginBtn.click();
spaceBtn.click();
sleep(1000);
compareScreen(states[1]);
+ marginBtn.click();
+ sleep(1000);
+ compareScreen(states[2]);
}
}
\ No newline at end of file
* @author Vaadin Ltd
*/
public abstract class BaseLayoutSizingTest extends MultiBrowserTest {
+ protected String[] states = new String[] { "setSize350px", "setSize_-1px",
+ "setSize75Percent", "setSize100Percent" };
+
@Test
public void LayoutSizing() throws IOException, InterruptedException {
openTestURL();
sleep(500);
compareScreen("initial");
- String[] states = { "setSize350px", "setSize_-1px", "setSize75Percent",
- "setSize100Percent" };
List<ButtonElement> buttons = $(ButtonElement.class).all();
int index = 0;
// go through all buttons click them and see result
package com.vaadin.tests.layouts.layouttester.GridLayout;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.CheckBoxElement;
import com.vaadin.tests.layouts.layouttester.BaseLayoutRegErrorTest;
/**
*/
public class GridLayoutRegErrorTest extends BaseLayoutRegErrorTest {
+ @Override
+ public void LayoutRegError() throws IOException {
+ super.LayoutRegError();
+
+ // The layout is too high to fit into one screenshot, we need to scroll
+ // and take another.
+
+ List<CheckBoxElement> checkBoxes = $(CheckBoxElement.class).all();
+ assertEquals(3, checkBoxes.size());
+ CheckBoxElement lastCheckBox = checkBoxes.get(2);
+
+ new Actions(driver).moveToElement(lastCheckBox).build().perform();
+
+ compareScreen("RegError-Scrolled");
+ }
}
\ No newline at end of file
package com.vaadin.tests.layouts.layouttester.GridLayout;
+import java.io.IOException;
+
import com.vaadin.tests.layouts.layouttester.BaseLayoutSizingTest;
/**
*/
public class GridLayoutSizingTest extends BaseLayoutSizingTest {
+ @Override
+ public void LayoutSizing() throws IOException, InterruptedException {
+ states[0] = "setSize600px";
+ super.LayoutSizing();
+ }
}
\ No newline at end of file
package com.vaadin.tests.layouts.layouttester.HLayout;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.HorizontalLayoutElement;
import com.vaadin.tests.layouts.layouttester.BaseIconTest;
public class HIconTest extends BaseIconTest {
+
+ @Override
+ public void LayoutIcon() throws IOException {
+ super.LayoutIcon();
+
+ // The layout is too wide to fit into one screenshot, we need to scroll
+ // and take another.
+
+ List<HorizontalLayoutElement> layouts = $(HorizontalLayoutElement.class)
+ .all();
+ assertEquals(8, layouts.size());
+ HorizontalLayoutElement lastOfRow1 = layouts.get(3);
+ HorizontalLayoutElement lastOfRow2 = layouts.get(7);
+
+ // scroll to both to ensure both contents are fully in view
+ new Actions(driver).moveToElement(lastOfRow1).build().perform();
+ new Actions(driver).moveToElement(lastOfRow2).build().perform();
+
+ compareScreen("icon-scrolled");
+ }
}
package com.vaadin.tests.layouts.layouttester.HLayout;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.HorizontalLayoutElement;
import com.vaadin.tests.layouts.layouttester.BaseLayoutRegErrorTest;
public class HLayoutRegErrorTest extends BaseLayoutRegErrorTest {
+
+ @Override
+ public void LayoutRegError() throws IOException {
+ super.LayoutRegError();
+
+ // The layout is too wide to fit into one screenshot, we need to scroll
+ // and take two more.
+
+ List<HorizontalLayoutElement> layouts = $(HorizontalLayoutElement.class)
+ .all();
+ assertEquals(10, layouts.size());
+ HorizontalLayoutElement group2row1 = layouts.get(2);
+ HorizontalLayoutElement group2row2 = layouts.get(7);
+ HorizontalLayoutElement group3row1 = layouts.get(3);
+ HorizontalLayoutElement group3row2 = layouts.get(8);
+ HorizontalLayoutElement lastOfRow1 = layouts.get(4);
+ HorizontalLayoutElement lastOfRow2 = layouts.get(9);
+
+ // scroll to both to ensure both contents are fully in view
+ new Actions(driver).moveToElement(group3row1).build().perform();
+ new Actions(driver).moveToElement(group3row2).build().perform();
+ // scroll back to get the previous group at the left edge
+ new Actions(driver).moveToElement(group2row1).build().perform();
+ new Actions(driver).moveToElement(group2row2).build().perform();
+
+ compareScreen("RegError-Scrolled-Middle");
+
+ // scroll to last ones
+ new Actions(driver).moveToElement(lastOfRow1).build().perform();
+ new Actions(driver).moveToElement(lastOfRow2).build().perform();
+
+ compareScreen("RegError-Scrolled-End");
+ }
}
package com.vaadin.tests.layouts.layouttester.VLayout;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.tests.layouts.layouttester.BaseAlignmentTest;
public class VAlignmentTest extends BaseAlignmentTest {
+
+ @Override
+ public void layoutAlignment() throws IOException {
+ super.layoutAlignment();
+
+ // The layout is too high to fit into one screenshot, we need to scroll
+ // and take another.
+
+ List<TextFieldElement> textFields = $(TextFieldElement.class).all();
+ assertEquals(9, textFields.size());
+ TextFieldElement lastTextField = textFields.get(8);
+
+ new Actions(driver).moveToElement(lastTextField).build().perform();
+
+ compareScreen("alignment-scrolled");
+ }
}
package com.vaadin.tests.layouts.layouttester.VLayout;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.VerticalLayoutElement;
import com.vaadin.tests.layouts.layouttester.BaseComponentSizingTest;
public class VComponentSizingTest extends BaseComponentSizingTest {
+
+ @Override
+ public void ComponentSizing() throws IOException, InterruptedException {
+ openTestURL();
+ sleep(500);
+
+ // The layout is too high to fit into one screenshot, we need to scroll
+ // down to see relevant content. And keep doing it since interacting
+ // with the controls scrolls back up again.
+
+ List<VerticalLayoutElement> layouts = $(VerticalLayoutElement.class)
+ .all();
+ assertEquals(5, layouts.size());
+ VerticalLayoutElement lastLayout = layouts.get(4);
+
+ compareScreen("initial");
+
+ new Actions(driver).moveToElement(lastLayout).build().perform();
+ compareScreen("scrolled");
+
+ String[] states = { "setSize350px", "setSize_-1px", "setSize75Percent",
+ "setSize100Percent" };
+ List<ButtonElement> buttons = $(ButtonElement.class).all();
+ int index = 0;
+ // go through all buttons click them and see result
+ for (ButtonElement btn : buttons) {
+ btn.click();
+ sleep(500);
+ new Actions(driver).moveToElement(lastLayout).build().perform();
+ compareScreen(states[index]);
+
+ index++;
+ }
+ }
}
package com.vaadin.tests.layouts.layouttester.VLayout;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.CheckBoxElement;
import com.vaadin.tests.layouts.layouttester.BaseLayoutRegErrorTest;
/**
* @author Vaadin Ltd
*/
public class VLayoutRegErrorTest extends BaseLayoutRegErrorTest {
+
+ @Override
+ public void LayoutRegError() throws IOException {
+ super.LayoutRegError();
+
+ // The layout is too high to fit into one screenshot, we need to scroll
+ // and take another.
+
+ List<CheckBoxElement> checkBoxes = $(CheckBoxElement.class).all();
+ assertEquals(3, checkBoxes.size());
+ CheckBoxElement lastCheckBox = checkBoxes.get(2);
+
+ new Actions(driver).moveToElement(lastCheckBox).build().perform();
+
+ compareScreen("RegError-Scrolled");
+ }
}