From 358583738aaf0def7b827e9fbe042e008dbdf8cd Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Thu, 24 Jul 2014 18:06:16 +0300 Subject: Upgraded TestTooSmallSubwindowSize from TB2 (#14292) Change-Id: I351e94c6827e4585ddeb0060251f9ba7c5c55df4 --- .../window/TestTooSmallSubwindowSize.html | 32 ------ .../window/TestTooSmallSubwindowSize.java | 113 +++++++++++++++++++-- .../window/TestTooSmallSubwindowSizeTest.java | 38 +++++++ 3 files changed, 142 insertions(+), 41 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html create mode 100644 uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java (limited to 'uitest/src/com/vaadin/tests/components/window') 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 @@ - - - - - - -TestTooSmallSubwindowSize - - - - - - - - - - - - - - - - - - - - - - -
TestTooSmallSubwindowSize
open/run/com.vaadin.tests.components.window.TestTooSmallSubwindowSize
waitForVaadin
screenCapture
- - 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"); + } +} -- cgit v1.2.3