diff options
Diffstat (limited to 'server/src/test')
2 files changed, 47 insertions, 1 deletions
diff --git a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java index d1367f5349..b641f3b249 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java @@ -71,7 +71,7 @@ public class GridLayoutDeclarativeTest @Test public void testReadIntegerExpandRatioGridLayout() { - //To make sure that it can read from old declarative which use + // To make sure that it can read from old declarative which use // integer expand ratio Button b1 = new Button("Button 0,0"); b1.setCaptionAsHtml(true); @@ -342,4 +342,19 @@ public class GridLayoutDeclarativeTest Assert.assertEquals(null, context.getCustomAttributes( context.getComponentByLocalId("marginBottomComponent"))); } + + @Test + public void designWithPreconfiguredGridLayout() throws Exception { + String design = "<html>" // + + "<head>" // + + "<meta name='package-mapping' content='my:com.vaadin.tests.server.component.gridlayout'>" + + "</meta>" + "</head>" + "<body>" + + "<my-preconfigured-grid-layout></my-preconfigured-grid-layout>"; + + PreconfiguredGridLayout myLayout = (PreconfiguredGridLayout) Design + .read(new ByteArrayInputStream(design.getBytes("UTF-8"))); + Assert.assertEquals(2, myLayout.getRows()); + Assert.assertEquals(2, myLayout.getColumns()); + } + } diff --git a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/PreconfiguredGridLayout.java b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/PreconfiguredGridLayout.java new file mode 100644 index 0000000000..a9c8733bf7 --- /dev/null +++ b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/PreconfiguredGridLayout.java @@ -0,0 +1,31 @@ +/* + * Copyright 2000-2016 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.server.component.gridlayout; + +import com.vaadin.ui.Button; +import com.vaadin.ui.GridLayout; + +public class PreconfiguredGridLayout extends GridLayout { + public PreconfiguredGridLayout() { + setRows(2); + setColumns(2); + + addComponent(new Button("1-1")); + addComponent(new Button("2-1")); + addComponent(new Button("1-2")); + addComponent(new Button("2-2")); + } +} |