summaryrefslogtreecommitdiffstats
path: root/server/src/test/java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-10-14 22:11:59 +0300
committerVaadin Code Review <review@vaadin.com>2016-11-16 07:31:08 +0000
commit1469891b6f0cb15bf9d684bdb35df8d9531c62f3 (patch)
tree7c88178a08d66f49c77b0cebfe8313e74a70dc8b /server/src/test/java
parent7535fbf6338be95f79910e4575d1e39796e5c701 (diff)
downloadvaadin-framework-1469891b6f0cb15bf9d684bdb35df8d9531c62f3.tar.gz
vaadin-framework-1469891b6f0cb15bf9d684bdb35df8d9531c62f3.zip
Keep expand ratio for last row/column when reducing grid layout size (#20297)
Change-Id: Iff53a803596f4fc1eae8e4bfa307b9c1f4df961a
Diffstat (limited to 'server/src/test/java')
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java
index 1eabf2fb62..64b466612f 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java
@@ -75,6 +75,30 @@ public class GridLayoutTest {
assertOrder(grid, new int[] { 0, 1, 2, 3 });
}
+ @Test
+ public void removeRowsExpandRatiosPreserved() {
+ GridLayout gl = new GridLayout(3, 3);
+ gl.setRowExpandRatio(0, 0);
+ gl.setRowExpandRatio(1, 1);
+ gl.setRowExpandRatio(2, 2);
+
+ gl.setRows(2);
+ assertEquals(0, gl.getRowExpandRatio(0), 0);
+ assertEquals(1, gl.getRowExpandRatio(1), 0);
+ }
+
+ @Test
+ public void removeColsExpandRatiosPreserved() {
+ GridLayout gl = new GridLayout(3, 3);
+ gl.setColumnExpandRatio(0, 0);
+ gl.setColumnExpandRatio(1, 1);
+ gl.setColumnExpandRatio(2, 2);
+
+ gl.setColumns(2);
+ assertEquals(0, gl.getColumnExpandRatio(0), 0);
+ assertEquals(1, gl.getColumnExpandRatio(1), 0);
+ }
+
private void assertContentPositions(GridLayout grid) {
assertEquals(grid.getComponentCount(), children.length);
int c = 0;