aboutsummaryrefslogtreecommitdiffstats
path: root/server/tests/src/com
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2014-12-14 20:01:52 +0200
committerMatti Hosio <mhosio@vaadin.com>2014-12-15 13:20:12 +0200
commit898e28d6aebc2b484f59f528a609bd59e5dfa4f5 (patch)
treecdb0bc9b76af30fb21b631c11e65093c0b5ceeb5 /server/tests/src/com
parenta27ea03db9f6ba5f4358c359645cd62617d2d205 (diff)
downloadvaadin-framework-898e28d6aebc2b484f59f528a609bd59e5dfa4f5.tar.gz
vaadin-framework-898e28d6aebc2b484f59f528a609bd59e5dfa4f5.zip
Add public API for loading design based on @DesignRoot (#7749)
Change-Id: Ic6f201a45d66aefe9ec93ba3be5a75b6532bf014
Diffstat (limited to 'server/tests/src/com')
-rw-r--r--server/tests/src/com/vaadin/tests/design/designroot/DesignRootTest.java53
-rw-r--r--server/tests/src/com/vaadin/tests/design/designroot/DesignWithAnnotation.java35
-rw-r--r--server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.html4
-rw-r--r--server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.java35
-rw-r--r--server/tests/src/com/vaadin/tests/design/designroot/ExtendedDesignWithAnnotation.java31
-rw-r--r--server/tests/src/com/vaadin/tests/design/designroot/ExtendedDesignWithEmptyAnnotation.java50
-rw-r--r--server/tests/src/com/vaadin/tests/design/designroot/ExtendedDesignWithEmptyAnnotationUI.java32
7 files changed, 240 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/design/designroot/DesignRootTest.java b/server/tests/src/com/vaadin/tests/design/designroot/DesignRootTest.java
new file mode 100644
index 0000000000..0d390ba184
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/designroot/DesignRootTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.designroot;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+// This test will not pass until default instance creation is changed. Will leave it ignored for now.
+@Ignore
+public class DesignRootTest {
+ @Test
+ public void designAnnotationWithoutFilename() {
+ DesignWithEmptyAnnotation d = new DesignWithEmptyAnnotation();
+ Assert.assertNotNull(d.ok);
+ Assert.assertNotNull(d.CaNCEL);
+ }
+
+ @Test
+ public void designAnnotationWithFilename() {
+ DesignWithAnnotation d = new DesignWithAnnotation();
+ Assert.assertNotNull(d.ok);
+ Assert.assertNotNull(d.cancel);
+ }
+
+ @Test
+ public void extendedDesignAnnotationWithoutFilename() {
+ DesignWithEmptyAnnotation d = new ExtendedDesignWithEmptyAnnotation();
+ Assert.assertNotNull(d.ok);
+ Assert.assertNotNull(d.CaNCEL);
+ }
+
+ @Test
+ public void extendedDesignAnnotationWithFilename() {
+ DesignWithAnnotation d = new ExtendedDesignWithAnnotation();
+ Assert.assertNotNull(d.ok);
+ Assert.assertNotNull(d.cancel);
+ }
+
+}
diff --git a/server/tests/src/com/vaadin/tests/design/designroot/DesignWithAnnotation.java b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithAnnotation.java
new file mode 100644
index 0000000000..1107d8c00c
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithAnnotation.java
@@ -0,0 +1,35 @@
+/*
+ * 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.designroot;
+
+import org.junit.Ignore;
+
+import com.vaadin.annotations.DesignRoot;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.declarative.Design;
+
+@DesignRoot("DesignWithEmptyAnnotation.html")
+@Ignore
+public class DesignWithAnnotation extends VerticalLayout {
+
+ public Button ok;
+ public Button cancel;
+
+ public DesignWithAnnotation() {
+ Design.read(this);
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.html b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.html
new file mode 100644
index 0000000000..27c323dfec
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.html
@@ -0,0 +1,4 @@
+<v-vertical-layout>
+ <v-button>OK</v-button>
+ <v-button>Cancel</v-button>
+</v-vertical-layout> \ No newline at end of file
diff --git a/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.java b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.java
new file mode 100644
index 0000000000..9723df9afa
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.java
@@ -0,0 +1,35 @@
+/*
+ * 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.designroot;
+
+import org.junit.Ignore;
+
+import com.vaadin.annotations.DesignRoot;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.declarative.Design;
+
+@DesignRoot
+@Ignore
+public class DesignWithEmptyAnnotation extends VerticalLayout {
+
+ protected Button ok;
+ protected Button CaNCEL;
+
+ public DesignWithEmptyAnnotation() {
+ Design.read(this);
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/designroot/ExtendedDesignWithAnnotation.java b/server/tests/src/com/vaadin/tests/design/designroot/ExtendedDesignWithAnnotation.java
new file mode 100644
index 0000000000..14e4269e80
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/designroot/ExtendedDesignWithAnnotation.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.designroot;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.TextField;
+
+@Ignore
+public class ExtendedDesignWithAnnotation extends DesignWithAnnotation {
+ private TextField customField = new TextField();
+
+ public ExtendedDesignWithAnnotation() {
+ customField.setInputPrompt("Something");
+ addComponent(customField);
+
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/designroot/ExtendedDesignWithEmptyAnnotation.java b/server/tests/src/com/vaadin/tests/design/designroot/ExtendedDesignWithEmptyAnnotation.java
new file mode 100644
index 0000000000..22865b098c
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/designroot/ExtendedDesignWithEmptyAnnotation.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.design.designroot;
+
+import org.junit.Ignore;
+
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.TextField;
+
+@Ignore
+public class ExtendedDesignWithEmptyAnnotation extends
+ DesignWithEmptyAnnotation {
+
+ private TextField customField = new TextField();
+
+ public ExtendedDesignWithEmptyAnnotation() {
+ super();
+ customField.setInputPrompt("Something");
+ addComponent(customField);
+
+ ok.addClickListener(new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Notification.show("OK");
+ }
+ });
+
+ CaNCEL.addClickListener(new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Notification.show("cancel");
+ }
+ });
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/design/designroot/ExtendedDesignWithEmptyAnnotationUI.java b/server/tests/src/com/vaadin/tests/design/designroot/ExtendedDesignWithEmptyAnnotationUI.java
new file mode 100644
index 0000000000..34f517d25d
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/designroot/ExtendedDesignWithEmptyAnnotationUI.java
@@ -0,0 +1,32 @@
+/*
+ * 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.designroot;
+
+import org.junit.Ignore;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.UI;
+
+@Ignore
+public class ExtendedDesignWithEmptyAnnotationUI extends UI {
+
+ @Override
+ protected void init(VaadinRequest request) {
+ setContent(new ExtendedDesignWithEmptyAnnotation());
+
+ }
+
+}