diff options
author | Henri Sara <henri.sara@gmail.com> | 2017-09-26 10:28:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-26 10:28:14 +0300 |
commit | 4d6cb7b107040ec9aedf9b73725675309a1c5729 (patch) | |
tree | b9ed625629cf2b247ee8758ac763721da62610bc /uitest/src/test | |
parent | e0b661fae56d52f36731945396b6b07c5c40a747 (diff) | |
download | vaadin-framework-4d6cb7b107040ec9aedf9b73725675309a1c5729.tar.gz vaadin-framework-4d6cb7b107040ec9aedf9b73725675309a1c5729.zip |
Relayout GridLayout when font loading completes (#10077)
If a GridLayout is used and font loading is not complete, force another layout after all fonts are loaded.
Fixes #9921
Fixes #8207
Diffstat (limited to 'uitest/src/test')
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabelTest.java | 28 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/fonticon/GridLayoutOnFontLoadTest.java | 36 |
2 files changed, 64 insertions, 0 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabelTest.java b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabelTest.java new file mode 100644 index 0000000000..b8caac693d --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabelTest.java @@ -0,0 +1,28 @@ +package com.vaadin.tests.components.gridlayout; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.GridLayoutElement; +import com.vaadin.testbench.elementsbase.AbstractElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class GridLayoutWithLabelTest extends MultiBrowserTest { + + @Test + public void selectingOptionShouldNotCauseLabelToChangeSize() { + openTestURL(); + AbstractElement gridLayout = $(GridLayoutElement.class).first(); + CheckBoxElement cb = $(CheckBoxElement.class).first(); + + int before = gridLayout.getSize().getWidth(); + cb.click(); // Turn on + cb.click(); // Turn off + int after = gridLayout.getSize().getWidth(); + + Assert.assertEquals( + "layout width should not have changed after checkbox was toggled", + before, after); + } +} diff --git a/uitest/src/test/java/com/vaadin/tests/fonticon/GridLayoutOnFontLoadTest.java b/uitest/src/test/java/com/vaadin/tests/fonticon/GridLayoutOnFontLoadTest.java new file mode 100644 index 0000000000..db5c08c653 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/fonticon/GridLayoutOnFontLoadTest.java @@ -0,0 +1,36 @@ +package com.vaadin.tests.fonticon; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.GridElement; +import com.vaadin.testbench.elements.TextAreaElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class GridLayoutOnFontLoadTest extends MultiBrowserTest { + + @Test + public void testComponentsDontOverlap() throws Exception { + openTestURL(); + + // Make sure fonts are loaded. + sleep(1000); + + ButtonElement button = $(ButtonElement.class).first(); + CheckBoxElement checkbox = $(CheckBoxElement.class).first(); + TextAreaElement textarea = $(TextAreaElement.class).first(); + GridElement grid = $(GridElement.class).first(); + + Assert.assertTrue( + "Button overlaps with checkbox (layout done before fonts loaded)", + button.getLocation().getX() + button.getSize().width <= checkbox + .getLocation().getX()); + Assert.assertTrue( + "TextArea overlaps with grid caption (layout done before fonts loaded)", + textarea.getLocation().getY() + textarea.getSize().height + + 10 < grid.getLocation().getY()); + } + +} |