aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/window
diff options
context:
space:
mode:
authorAnna Koskinen <anna@vaadin.com>2014-07-24 18:06:16 +0300
committerVaadin Code Review <review@vaadin.com>2014-08-15 08:13:05 +0000
commit358583738aaf0def7b827e9fbe042e008dbdf8cd (patch)
treee8edce88e4d6314f187e2a0ecee9f36ef3593ed5 /uitest/src/com/vaadin/tests/components/window
parent8c4ddbb2837c8966551636cf140bba86c9671d1e (diff)
downloadvaadin-framework-358583738aaf0def7b827e9fbe042e008dbdf8cd.tar.gz
vaadin-framework-358583738aaf0def7b827e9fbe042e008dbdf8cd.zip
Upgraded TestTooSmallSubwindowSize from TB2 (#14292)
Change-Id: I351e94c6827e4585ddeb0060251f9ba7c5c55df4
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/window')
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html32
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java113
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java38
3 files changed, 142 insertions, 41 deletions
diff --git a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html
deleted file mode 100644
index f926696d63..0000000000
--- a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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="" />
-<title>TestTooSmallSubwindowSize</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TestTooSmallSubwindowSize</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.window.TestTooSmallSubwindowSize</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
index 46845748a3..669774f715 100644
--- a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
+++ b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
@@ -1,15 +1,22 @@
package com.vaadin.tests.components.window;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
-public class TestTooSmallSubwindowSize extends TestBase {
+/**
+ * Tests that the styles work correctly in tiny subwindows that have more
+ * content than can fit.
+ *
+ * @author Vaadin Ltd
+ */
+public class TestTooSmallSubwindowSize extends AbstractTestUI {
@Override
- protected String getDescription() {
- return "The size of the subwindow (outer size) is set to 60x60 pixels. Minimum size for the content area is 150x100, which means the window and shadow should be around 155x155 and the content area 150x100. The decoration at the lower left corner of the window must not be missing either.";
+ protected String getTestDescription() {
+ return "The size of the subwindows (outer size) is set to 60x60 pixels. Make sure the shadows fits the windows instead of the contents. The decorations at the lower right corners of the resizable windows must not be missing either.";
}
@Override
@@ -18,7 +25,14 @@ public class TestTooSmallSubwindowSize extends TestBase {
}
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
+ getUI().addWindow(createNonResizableWindow());
+ getUI().addWindow(createNonResizableWindowWithHorizontalScrollbar());
+ getUI().addWindow(createResizableWindow());
+ getUI().addWindow(createResizableWindowWithHorizontalScrollbar());
+ }
+
+ private Window createNonResizableWindow() {
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
Window w = new Window("Scroll", layout);
@@ -35,13 +49,94 @@ public class TestTooSmallSubwindowSize extends TestBase {
w.setPositionY(100);
// Set window size
- w.setWidth(60, Window.UNITS_PIXELS);
- w.setHeight(60, Window.UNITS_PIXELS);
+ w.setWidth(60, Unit.PIXELS);
+ w.setHeight(60, Unit.PIXELS);
+
+ // Disable resizing
+ w.setResizable(false);
+
+ return w;
+ }
+
+ private Window createNonResizableWindowWithHorizontalScrollbar() {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Scroll", layout);
+ Label desc = new Label(
+ "This is a new child window with a preset"
+ + " width, height and position. Resizing has been"
+ + " disabled for this window. Additionally, this text label"
+ + " is intentionally too large to fit the window. You could"
+ + " use the scrollbars to view different parts of the window content,"
+ + " except it's too small for that either.");
+ // disable wrapping
+ desc.setSizeUndefined();
+ layout.addComponent(desc);
+
+ // Set window position
+ w.setPositionX(200);
+ w.setPositionY(100);
+
+ // Set window size
+ w.setWidth(60, Unit.PIXELS);
+ w.setHeight(60, Unit.PIXELS);
// Disable resizing
- w.setResizable(true);
+ w.setResizable(false);
+
+ return w;
+ }
+
+ private Window createResizableWindow() {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Resize", layout);
+ Label desc = new Label(
+ "This is a new child window with a preset"
+ + " width, height and position. Resizing has not been"
+ + " disabled for this window. Additionally, this text label"
+ + " is intentionally too large to fit the window. You can resize or"
+ + " use the scrollbars to view different parts of the window content.");
+ layout.addComponent(desc);
+
+ // Set window position
+ w.setPositionX(300);
+ w.setPositionY(100);
+
+ // Set window size
+ w.setWidth(60, Unit.PIXELS);
+ w.setHeight(60, Unit.PIXELS);
+
+ // Don't disable resizing
+
+ return w;
+ }
+
+ private Window createResizableWindowWithHorizontalScrollbar() {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Resize", layout);
+ Label desc = new Label(
+ "This is a new child window with a preset"
+ + " width, height and position. Resizing has not been"
+ + " disabled for this window. Additionally, this text label"
+ + " is intentionally too large to fit the window. You can resize"
+ + " to view different parts of the window content.");
+ // disable wrapping
+ desc.setSizeUndefined();
+ layout.addComponent(desc);
+
+ // Set window position
+ w.setPositionX(400);
+ w.setPositionY(100);
+
+ // Set window size
+ w.setWidth(60, Unit.PIXELS);
+ w.setHeight(60, Unit.PIXELS);
+
+ // Don't disable resizing
- getMainWindow().addWindow(w);
+ return w;
}
}
diff --git a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java
new file mode 100644
index 0000000000..0019900884
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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.components.window;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that the styles work correctly in tiny subwindows that have more
+ * content than can fit.
+ *
+ * @author Vaadin Ltd
+ */
+public class TestTooSmallSubwindowSizeTest extends MultiBrowserTest {
+
+ @Test
+ public void testSubwindowStyles() throws IOException {
+ openTestURL();
+
+ compareScreen("initial");
+ }
+}