From 04d043f95fbdeb698a3c0c39334e76b367afa749 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Thu, 5 Jul 2012 14:12:18 +0300 Subject: [PATCH] Explicit test for attaching extensions (#6690) --- .../tests/extensions/BasicExtension.java | 15 ++++++++ .../tests/extensions/BasicExtensionTest.html | 32 +++++++++++++++++ .../tests/extensions/BasicExtensionTest.java | 34 +++++++++++++++++++ .../client/BasicExtensionTestConnector.java | 27 +++++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 tests/testbench/com/vaadin/tests/extensions/BasicExtension.java create mode 100644 tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.html create mode 100644 tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.java create mode 100644 tests/testbench/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java diff --git a/tests/testbench/com/vaadin/tests/extensions/BasicExtension.java b/tests/testbench/com/vaadin/tests/extensions/BasicExtension.java new file mode 100644 index 0000000000..551d24735a --- /dev/null +++ b/tests/testbench/com/vaadin/tests/extensions/BasicExtension.java @@ -0,0 +1,15 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ + +package com.vaadin.tests.extensions; + +import com.vaadin.terminal.AbstractClientConnector; +import com.vaadin.terminal.AbstractExtension; + +public class BasicExtension extends AbstractExtension { + @Override + public void extend(AbstractClientConnector target) { + super.extend(target); + } +} \ No newline at end of file diff --git a/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.html b/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.html new file mode 100644 index 0000000000..6e8a0bf97f --- /dev/null +++ b/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.html @@ -0,0 +1,32 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.extensions.BasicExtensionTest?restartApplication
assertText//div[1]BasicExtensionTestConnector extending LabelConnector
assertText//div[2]BasicExtensionTestConnector extending RootConnector
+ + diff --git a/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.java b/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.java new file mode 100644 index 0000000000..02bdadca34 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.java @@ -0,0 +1,34 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ + +package com.vaadin.tests.extensions; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.terminal.WrappedRequest; +import com.vaadin.tests.components.AbstractTestRoot; +import com.vaadin.ui.Label; + +@Widgetset("com.vaadin.tests.widgetset.TestingWidgetSet") +public class BasicExtensionTest extends AbstractTestRoot { + + @Override + protected void setup(WrappedRequest request) { + Label label = new Label(); + addComponent(label); + + new BasicExtension().extend(this); + new BasicExtension().extend(label); + } + + @Override + protected String getTestDescription() { + return "Simple test for extending components"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(6690); + } + +} diff --git a/tests/testbench/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java b/tests/testbench/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java new file mode 100644 index 0000000000..aa5bec83b4 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java @@ -0,0 +1,27 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ + +package com.vaadin.tests.widgetset.client; + +import com.google.gwt.dom.client.DivElement; +import com.google.gwt.dom.client.Document; +import com.vaadin.terminal.gwt.client.ServerConnector; +import com.vaadin.terminal.gwt.client.Util; +import com.vaadin.terminal.gwt.client.extensions.AbstractExtensionConnector; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.tests.extensions.BasicExtension; + +@Connect(BasicExtension.class) +public class BasicExtensionTestConnector extends AbstractExtensionConnector { + @Override + protected void extend(ServerConnector target) { + String message = Util.getSimpleName(this) + " extending " + + Util.getSimpleName(target); + + DivElement element = Document.get().createDivElement(); + element.setInnerText(message); + + Document.get().getBody().insertFirst(element); + } +} -- 2.39.5