summaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2012-11-16 15:34:23 +0200
committerVaadin Code Review <review@vaadin.com>2012-11-19 09:57:16 +0000
commit977c8b01c042f2ffec36e3cb5c7ad517b738d06e (patch)
tree33f83d3070a0a5fbae9f3f3800d6b9f2b2535ddf /uitest/src
parent9a3a22cc9f8f95054e3528b0ffcc0b9e92cffbea (diff)
downloadvaadin-framework-977c8b01c042f2ffec36e3cb5c7ad517b738d06e.tar.gz
vaadin-framework-977c8b01c042f2ffec36e3cb5c7ad517b738d06e.zip
Read browser width and height from request in Page.init (#9073)
* Also change default screen width and height in WebBrowser to -1 for consistency * Test for reading browser details in UI.init Change-Id: I24339fd3742857392e1fc768696eeb2fb5551a90
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.html112
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java56
2 files changed, 168 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.html b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.html
new file mode 100644
index 0000000000..3fd7a0d560
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.html
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8070/" />
+<title>UIInitBrowserDetails</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">UIInitBrowserDetails</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/UIInitBrowserDetails?restartApplication</td>
+ <td></td>
+</tr>
+<!--location-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[4]</td>
+ <td>null</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[2]</td>
+ <td>null</td>
+</tr>
+<!--browser window width-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[4]</td>
+ <td>null</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[5]</td>
+ <td>-1</td>
+</tr>
+<!--browser window height-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[10]</td>
+ <td>null</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[8]</td>
+ <td>-1</td>
+</tr>
+<!--screen width-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[10]</td>
+ <td>null</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[11]</td>
+ <td>-1</td>
+</tr>
+<!--screen height-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[13]</td>
+ <td>null</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[14]</td>
+ <td>-1</td>
+</tr>
+<!--timezone offset-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[16]</td>
+ <td>null</td>
+</tr>
+<!--raw timezone offset-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[19]</td>
+ <td>null</td>
+</tr>
+<!--dst saving-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[22]</td>
+ <td>null</td>
+</tr>
+<!--dst in effect-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[25]</td>
+ <td>null</td>
+</tr>
+<!--current date-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[28]</td>
+ <td>null</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[29]</td>
+ <td>null</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java
new file mode 100644
index 0000000000..587c9f0f9b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java
@@ -0,0 +1,56 @@
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.tests.components.ui;
+
+import com.vaadin.server.Page;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.WebBrowser;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+
+public class UIInitBrowserDetails extends AbstractTestUI {
+
+ private GridLayout l = new GridLayout(3, 1);
+ private VaadinRequest r;
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ r = request;
+ l.setWidth("100%");
+ addComponent(l);
+
+ Page p = getPage();
+ WebBrowser wb = p.getWebBrowser();
+
+ addDetail("location", "loc", p.getLocation());
+
+ addDetail("browser window width", "cw", p.getBrowserWindowWidth());
+ addDetail("browser window height", "ch", p.getBrowserWindowHeight());
+ addDetail("screen width", "sw", wb.getScreenWidth());
+ addDetail("screen height", "sh", wb.getScreenHeight());
+
+ addDetail("timezone offset", "tzo", wb.getTimezoneOffset());
+ addDetail("raw timezone offset", "rtzo", wb.getRawTimezoneOffset());
+ addDetail("dst saving", "dstd", wb.getDSTSavings());
+ addDetail("dst in effect", "dston", wb.isDSTInEffect());
+ addDetail("current date", "curdate", wb.getCurrentDate());
+ }
+
+ @Override
+ public String getTestDescription() {
+ return "Browser details should be available in UI init";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(9037);
+ }
+
+ private void addDetail(String name, String param, Object value) {
+ l.addComponents(new Label(name), new Label(r.getParameter(param)),
+ new Label("" + value));
+ }
+}