aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatti Hosio <mhosio@vaadin.com>2014-12-17 12:57:39 +0200
committerVaadin Code Review <review@vaadin.com>2014-12-17 14:23:04 +0000
commitd65749f0cac74bfe16edf511f5a4d8c912404efe (patch)
treecacd7f256362d1c1f95b8bddc072cc85f6abfd0d
parent39edc4b3acf6b4596abf799705b1087b109e10ef (diff)
downloadvaadin-framework-d65749f0cac74bfe16edf511f5a4d8c912404efe.tar.gz
vaadin-framework-d65749f0cac74bfe16edf511f5a4d8c912404efe.zip
Unit tests for nested templates (#7749)
Change-Id: I0190870de8d7d15406cbe54ae8dc0b7761a13910
-rw-r--r--server/tests/src/com/vaadin/tests/design/nested/TestNestedCustomLayouts.java76
-rw-r--r--server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomAbsoluteLayout.java31
-rw-r--r--server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomAccordion.java31
-rw-r--r--server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomCssLayout.java31
-rw-r--r--server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomFormLayout.java31
-rw-r--r--server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomGridLayout.java31
-rw-r--r--server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomHorizontalLayout.java31
-rw-r--r--server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomHorizontalSplitPanel.java31
-rw-r--r--server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomPanel.java31
-rw-r--r--server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomTabSheet.java31
-rw-r--r--server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomVerticalLayout.java31
-rw-r--r--server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomVerticalSplitPanel.java31
12 files changed, 417 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/design/nested/TestNestedCustomLayouts.java b/server/tests/src/com/vaadin/tests/design/nested/TestNestedCustomLayouts.java
new file mode 100644
index 0000000000..2abadaf98e
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/nested/TestNestedCustomLayouts.java
@@ -0,0 +1,76 @@
+/*
+ * 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.design.nested;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.junit.Test;
+
+import com.vaadin.tests.design.nested.customlayouts.CustomAbsoluteLayout;
+import com.vaadin.tests.design.nested.customlayouts.CustomAccordion;
+import com.vaadin.tests.design.nested.customlayouts.CustomCssLayout;
+import com.vaadin.tests.design.nested.customlayouts.CustomFormLayout;
+import com.vaadin.tests.design.nested.customlayouts.CustomGridLayout;
+import com.vaadin.tests.design.nested.customlayouts.CustomHorizontalLayout;
+import com.vaadin.tests.design.nested.customlayouts.CustomHorizontalSplitPanel;
+import com.vaadin.tests.design.nested.customlayouts.CustomPanel;
+import com.vaadin.tests.design.nested.customlayouts.CustomTabSheet;
+import com.vaadin.tests.design.nested.customlayouts.CustomVerticalLayout;
+import com.vaadin.tests.design.nested.customlayouts.CustomVerticalSplitPanel;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.declarative.Design;
+
+/**
+ * Test case for nested custom layouts. The children of the custom layouts must
+ * not be rendered.
+ *
+ * @author Vaadin Ltd
+ */
+public class TestNestedCustomLayouts extends TestCase {
+
+ @Test
+ public void testNestedLayouts() throws IOException {
+ VerticalLayout rootLayout = new VerticalLayout();
+ rootLayout.addComponent(new CustomAbsoluteLayout());
+ rootLayout.addComponent(new CustomAccordion());
+ rootLayout.addComponent(new CustomCssLayout());
+ rootLayout.addComponent(new CustomFormLayout());
+ rootLayout.addComponent(new CustomGridLayout());
+ rootLayout.addComponent(new CustomHorizontalLayout());
+ rootLayout.addComponent(new CustomHorizontalSplitPanel());
+ rootLayout.addComponent(new CustomPanel());
+ rootLayout.addComponent(new CustomTabSheet());
+ rootLayout.addComponent(new CustomVerticalLayout());
+ rootLayout.addComponent(new CustomVerticalSplitPanel());
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ Design.write(rootLayout, out);
+ Document doc = Jsoup.parse(out.toString("UTF-8"));
+ Element rootNode = doc.body().child(0);
+ assertTrue("Root node must have children",
+ rootNode.children().size() > 0);
+ for (Element child : rootNode.children()) {
+ // make sure that the nested custom layouts do not render children
+ assertEquals("Child nodes must not have children", 0, child
+ .children().size());
+ }
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomAbsoluteLayout.java b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomAbsoluteLayout.java
new file mode 100644
index 0000000000..ed2b27215e
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomAbsoluteLayout.java
@@ -0,0 +1,31 @@
+/*
+ * 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.design.nested.customlayouts;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.AbsoluteLayout;
+import com.vaadin.ui.Label;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Ignore
+public class CustomAbsoluteLayout extends AbsoluteLayout {
+ public CustomAbsoluteLayout() {
+ this.addComponent(new Label());
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomAccordion.java b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomAccordion.java
new file mode 100644
index 0000000000..7d45917520
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomAccordion.java
@@ -0,0 +1,31 @@
+/*
+ * 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.design.nested.customlayouts;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.Accordion;
+import com.vaadin.ui.Label;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Ignore
+public class CustomAccordion extends Accordion {
+ public CustomAccordion() {
+ addComponent(new Label());
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomCssLayout.java b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomCssLayout.java
new file mode 100644
index 0000000000..328a025e01
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomCssLayout.java
@@ -0,0 +1,31 @@
+/*
+ * 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.design.nested.customlayouts;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Label;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Ignore
+public class CustomCssLayout extends CssLayout {
+ public CustomCssLayout() {
+ this.addComponent(new Label());
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomFormLayout.java b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomFormLayout.java
new file mode 100644
index 0000000000..179b195926
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomFormLayout.java
@@ -0,0 +1,31 @@
+/*
+ * 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.design.nested.customlayouts;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.Label;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Ignore
+public class CustomFormLayout extends FormLayout {
+ public CustomFormLayout() {
+ this.addComponent(new Label());
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomGridLayout.java b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomGridLayout.java
new file mode 100644
index 0000000000..0b3b90ca1f
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomGridLayout.java
@@ -0,0 +1,31 @@
+/*
+ * 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.design.nested.customlayouts;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Ignore
+public class CustomGridLayout extends GridLayout {
+ public CustomGridLayout() {
+ this.addComponent(new Label());
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomHorizontalLayout.java b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomHorizontalLayout.java
new file mode 100644
index 0000000000..b742f7c629
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomHorizontalLayout.java
@@ -0,0 +1,31 @@
+/*
+ * 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.design.nested.customlayouts;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Ignore
+public class CustomHorizontalLayout extends HorizontalLayout {
+ public CustomHorizontalLayout() {
+ this.addComponent(new Label());
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomHorizontalSplitPanel.java b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomHorizontalSplitPanel.java
new file mode 100644
index 0000000000..deeb311858
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomHorizontalSplitPanel.java
@@ -0,0 +1,31 @@
+/*
+ * 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.design.nested.customlayouts;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.HorizontalSplitPanel;
+import com.vaadin.ui.Label;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Ignore
+public class CustomHorizontalSplitPanel extends HorizontalSplitPanel {
+ public CustomHorizontalSplitPanel() {
+ addComponent(new Label());
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomPanel.java b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomPanel.java
new file mode 100644
index 0000000000..fa7827bdfd
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomPanel.java
@@ -0,0 +1,31 @@
+/*
+ * 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.design.nested.customlayouts;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Ignore
+public class CustomPanel extends Panel {
+ public CustomPanel() {
+ setContent(new Label());
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomTabSheet.java b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomTabSheet.java
new file mode 100644
index 0000000000..6298b67727
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomTabSheet.java
@@ -0,0 +1,31 @@
+/*
+ * 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.design.nested.customlayouts;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Ignore
+public class CustomTabSheet extends TabSheet {
+ public CustomTabSheet() {
+ addComponent(new Label());
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomVerticalLayout.java b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomVerticalLayout.java
new file mode 100644
index 0000000000..7859ae0227
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomVerticalLayout.java
@@ -0,0 +1,31 @@
+/*
+ * 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.design.nested.customlayouts;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Ignore
+public class CustomVerticalLayout extends VerticalLayout {
+ public CustomVerticalLayout() {
+ this.addComponent(new Label());
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomVerticalSplitPanel.java b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomVerticalSplitPanel.java
new file mode 100644
index 0000000000..f6eb460c1b
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/nested/customlayouts/CustomVerticalSplitPanel.java
@@ -0,0 +1,31 @@
+/*
+ * 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.design.nested.customlayouts;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalSplitPanel;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Ignore
+public class CustomVerticalSplitPanel extends VerticalSplitPanel {
+ public CustomVerticalSplitPanel() {
+ addComponent(new Label());
+ }
+}