diff options
author | Markus Koivisto <markus@vaadin.com> | 2014-07-30 17:28:41 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-07-31 07:28:22 +0000 |
commit | 92da25c0b494e059985486bfaaabf434ac59afa1 (patch) | |
tree | 2e064be2bd417ac662271945d937dc107aa82331 /uitest/src/com | |
parent | 161d5289e23fdf1d9cb8e97d2e55f948b43fe0aa (diff) | |
download | vaadin-framework-92da25c0b494e059985486bfaaabf434ac59afa1.tar.gz vaadin-framework-92da25c0b494e059985486bfaaabf434ac59afa1.zip |
Fix typo that caused spanned cells to be removed in Gridlayout (#14335)
Gridlayout removes columns and rows with no content. Gridlayout is
supposed to check for spanned cells and not remove otherwise empty rows
or columns if they are covered by a span.
Change-Id: I1c25a8e6426e6ce0e24f9110a6b994598c395e7a
Diffstat (limited to 'uitest/src/com')
-rw-r--r-- | uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java | 54 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumnsTest.java | 50 |
2 files changed, 104 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java new file mode 100644 index 0000000000..fc37455752 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java @@ -0,0 +1,54 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.gridlayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Label; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridSpanEmptyColumns extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + GridLayout gridLayout = new GridLayout(3, 1); + gridLayout.setWidth("1000px"); + + Label bigCell = new Label("big cell"); + bigCell.setId("bigCell"); + Label smallCell = new Label("small cell"); + smallCell.setId("smallCell"); + gridLayout.addComponent(bigCell, 0, 0, 1, 0); // spans first two columns + gridLayout.addComponent(smallCell, 2, 0, 2, 0); // last column only + + addComponent(gridLayout); + } + + @Override + protected String getTestDescription() { + return "A 3x1 grid has a spanned component on the first two cells and a component on the last cell. The two components should occupy 2/3 and 1/3 of the available space respectively, instead of 1/2 each."; + } + + @Override + protected Integer getTicketNumber() { + return 14335; + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumnsTest.java b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumnsTest.java new file mode 100644 index 0000000000..f2b86fb69b --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumnsTest.java @@ -0,0 +1,50 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.gridlayout; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; + +import org.junit.Test; + +import com.vaadin.testbench.elements.LabelElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Tests that GridLayout handles elements spanning otherwise empty columns + * correctly (#14335) + * + * @since 7.2.5 + * @author markus + */ +public class GridSpanEmptyColumnsTest extends MultiBrowserTest { + + @Test + public void componentsShouldMoveRight() throws IOException { + openTestURL(); + + LabelElement bigCell = $(LabelElement.class).id("bigCell"); + LabelElement smallCell = $(LabelElement.class).id("smallCell"); + + // Width is 1000px. Big cell should take up 2/3, small cell should take + // up 1/3. + assertEquals(667, bigCell.getSize().width); + assertEquals(333, smallCell.getSize().width); + + } + +}
\ No newline at end of file |