aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java
diff options
context:
space:
mode:
authorAnna Koskinen <Ansku@users.noreply.github.com>2020-12-01 11:34:32 +0200
committerGitHub <noreply@github.com>2020-12-01 11:34:32 +0200
commitd59c3d303be95d38320f94b5d7cde068824d81fd (patch)
treedc2d852dc3409c96a26cea100a591af83a3be890 /uitest/src/main/java
parentcd1dccd153ecfcdcb73e4f59f8f24c49b3f97ed7 (diff)
downloadvaadin-framework-d59c3d303be95d38320f94b5d7cde068824d81fd.tar.gz
vaadin-framework-d59c3d303be95d38320f94b5d7cde068824d81fd.zip
Ensure Composite's contents gets re-measured on resize. (#12154)
Fixes: #12153
Diffstat (limited to 'uitest/src/main/java')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/composite/CompositeVerticalLayoutGridResize.java82
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/composite/CompositeVerticalLayoutSplitPanelResize.java59
2 files changed, 141 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/composite/CompositeVerticalLayoutGridResize.java b/uitest/src/main/java/com/vaadin/tests/components/composite/CompositeVerticalLayoutGridResize.java
new file mode 100644
index 0000000000..68663c9396
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/composite/CompositeVerticalLayoutGridResize.java
@@ -0,0 +1,82 @@
+package com.vaadin.tests.components.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Composite;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.VerticalLayout;
+
+public class CompositeVerticalLayoutGridResize extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ addComponent(new CompositeGrid());
+
+ getLayout().setSizeFull();
+ getLayout().getParent().setSizeFull();
+ }
+
+ public class CompositeGrid extends Composite {
+ public CompositeGrid() {
+ VerticalLayout root = new VerticalLayout();
+ root.setId("root");
+ root.setMargin(false);
+ root.addComponentsAndExpand(buildGrid());
+
+ setCompositionRoot(root);
+ setSizeFull();
+ }
+
+ private Component buildGrid() {
+ List<Person> persons = new ArrayList<>();
+ for (int i = 0; i < 100; i++) {
+ persons.add(new Person("Firstname" + i, "Lastname" + i));
+ }
+
+ Grid<Person> grid = new Grid<Person>(Person.class);
+ grid.setItems(persons);
+ grid.setSizeFull();
+ return grid;
+ }
+ }
+
+ public class Person {
+ private String firstName, lastName;
+
+ public Person(String firstName, String lastName) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Composite contents should resize without a delay when the"
+ + " browser is resized, not only when interacted with.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12153;
+ }
+}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/composite/CompositeVerticalLayoutSplitPanelResize.java b/uitest/src/main/java/com/vaadin/tests/components/composite/CompositeVerticalLayoutSplitPanelResize.java
new file mode 100644
index 0000000000..a9e4ab4c6f
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/composite/CompositeVerticalLayoutSplitPanelResize.java
@@ -0,0 +1,59 @@
+package com.vaadin.tests.components.composite;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Composite;
+import com.vaadin.ui.HorizontalSplitPanel;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.VerticalSplitPanel;
+
+public class CompositeVerticalLayoutSplitPanelResize extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ addComponent(new CompositeVSP());
+
+ getLayout().setSizeFull();
+ getLayout().getParent().setSizeFull();
+ }
+
+ public class CompositeVSP extends Composite {
+ public CompositeVSP() {
+ VerticalSplitPanel verticalSplitPanel = new VerticalSplitPanel();
+ verticalSplitPanel.setSecondComponent(new CompositeHSP());
+
+ VerticalLayout root = new VerticalLayout();
+ root.setId("root");
+ root.setMargin(false);
+ root.addComponent(verticalSplitPanel);
+
+ setCompositionRoot(root);
+ setSizeFull();
+ }
+ }
+
+ public class CompositeHSP extends Composite {
+ public CompositeHSP() {
+ HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
+
+ VerticalLayout root = new VerticalLayout();
+ root.setSizeFull();
+ root.setMargin(false);
+ root.addComponent(horizontalSplitPanel);
+
+ setCompositionRoot(root);
+ setSizeFull();
+ }
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Composite contents should resize without a delay when the"
+ + " browser is resized, not only when interacted with.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12153;
+ }
+}