]> source.dussan.org Git - vaadin-framework.git/commitdiff
(non-automated) test case for #7923
authorLeif Åstrand <leif@vaadin.com>
Mon, 14 Nov 2011 10:09:31 +0000 (10:09 +0000)
committerLeif Åstrand <leif@vaadin.com>
Mon, 14 Nov 2011 10:09:31 +0000 (10:09 +0000)
svn changeset:21984/svn branch:6.7

WebContent/statictestfiles/EmbedSizeHostPage.html [new file with mode: 0644]
tests/testbench/com/vaadin/tests/integration/EmbedSizeTest.java [new file with mode: 0644]

diff --git a/WebContent/statictestfiles/EmbedSizeHostPage.html b/WebContent/statictestfiles/EmbedSizeHostPage.html
new file mode 100644 (file)
index 0000000..06dfd5d
--- /dev/null
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<style type="text/css">html, body {height:100%;margin:0;}</style><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="/VAADIN/themes/reindeer/favicon.ico" /><link rel="icon" type="image/vnd.microsoft.icon" href="/VAADIN/themes/reindeer/favicon.ico" /><title>com&#46;vaadin&#46;tests&#46;integration&#46;EmbedSizeTest</title>
+</head>
+<body scroll="auto" class="v-generated-body">
+<script type="text/javascript">
+//<![CDATA[
+if(!vaadin || !vaadin.vaadinConfigurations) {
+ if(!vaadin) { var vaadin = {}} 
+vaadin.vaadinConfigurations = {};
+if (!vaadin.themesLoaded) { vaadin.themesLoaded = {}; }
+vaadin.debug = true;
+document.write('<iframe tabIndex="-1" id="__gwt_historyFrame" style="position:absolute;width:0;height:0;border:0;overflow:hidden;" src="javascript:false"></iframe>');
+document.write("<script language='javascript' src='/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js?1321018813162'><\/script>");
+}
+vaadin.vaadinConfigurations["runcomvaadintestsintegrationEmbedSizeTest-225840176"] = {appUri:'/run/com.vaadin.tests.integration.EmbedSizeTest', themeUri:"/VAADIN/themes/reindeer", versionInfo : {vaadinVersion:"9.9.9.INTERNAL-DEBUG-BUILD",applicationVersion:"NONVERSIONED"},"comErrMsg": {"caption":"Communication problem","message" : "Take note of any unsaved data, and <u>click here<\/u> to continue.","url" : null},"authErrMsg": {"caption":"Authentication problem","message" : "Take note of any unsaved data, and <u>click here<\/u> to continue.","url" : null}};
+//]]>
+</script>
+<script type="text/javascript">
+//<![CDATA[
+if(!vaadin.themesLoaded['reindeer']) {
+var stylesheet = document.createElement('link');
+stylesheet.setAttribute('rel', 'stylesheet');
+stylesheet.setAttribute('type', 'text/css');
+stylesheet.setAttribute('href', '/VAADIN/themes/reindeer/styles.css');
+document.getElementsByTagName('head')[0].appendChild(stylesheet);
+vaadin.themesLoaded['reindeer'] = true;
+}
+//]]>
+</script>
+<script type="text/javascript">
+//<![CDATA[
+setTimeout('if (typeof com_vaadin_terminal_gwt_DefaultWidgetSet == "undefined") {alert("Failed to load the widgetset: /VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js?1321018813162")};',15000);
+//]]>
+</script>
+<div style="width: 80%; border: 1px solid black">
+<h1>Test page for resize events with embedded applications</h1>
+<div id="runcomvaadintestsintegrationEmbedSizeTest-225840176" class="v-app v-theme-reindeer v-app-EmbedSizeTest" ><div class="v-app-loading"></div></div>
+<noscript>You have to enable javascript in your browser to use an application built with Vaadin.</noscript></body>
+</div>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/integration/EmbedSizeTest.java b/tests/testbench/com/vaadin/tests/integration/EmbedSizeTest.java
new file mode 100644 (file)
index 0000000..479af4a
--- /dev/null
@@ -0,0 +1,55 @@
+package com.vaadin.tests.integration;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.Window.ResizeEvent;
+
+public class EmbedSizeTest extends TestBase {
+
+    private Log log = new Log(10);
+
+    @Override
+    protected void setup() {
+        Window mainWindow = getMainWindow();
+        mainWindow.setSizeUndefined();
+        mainWindow.getContent().setSizeUndefined();
+        mainWindow.setImmediate(true);
+
+        CheckBox lazyCheckBox = new CheckBox("Lazy resize",
+                new Button.ClickListener() {
+                    public void buttonClick(ClickEvent event) {
+                        boolean resizeLazy = Boolean.TRUE == event.getButton()
+                                .getValue();
+                        getMainWindow().setResizeLazy(resizeLazy);
+                        log.log("Resize lazy: " + resizeLazy);
+                    }
+                });
+        lazyCheckBox.setValue(Boolean.FALSE);
+        lazyCheckBox.setImmediate(true);
+        addComponent(lazyCheckBox);
+
+        addComponent(log);
+        mainWindow.addListener(new Window.ResizeListener() {
+            public void windowResized(ResizeEvent e) {
+                Window window = e.getWindow();
+                log.log("Resize event: " + window.getWidth() + " x "
+                        + window.getHeight());
+            }
+        });
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Resizing the browser window should send consistent resize events to the server even when the application is embedded";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return Integer.valueOf(7923);
+    }
+
+}