summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorPekka Hyvönen <pekka@vaadin.com>2013-02-21 17:04:48 +0200
committerVaadin Code Review <review@vaadin.com>2013-04-04 12:52:55 +0000
commitd937722318c47831775d2f0e6c67b0f0f1d57688 (patch)
tree92d643f4faa5a13dd86ac175d31e2484ef36cf7a /uitest
parent69def694d5d98f518ad08c039195fd2ac8781d2f (diff)
downloadvaadin-framework-d937722318c47831775d2f0e6c67b0f0f1d57688.tar.gz
vaadin-framework-d937722318c47831775d2f0e6c67b0f0f1d57688.zip
Maximize Restore for Window #3400
Change-Id: I164ae83bd6cf98f7a3d7e76d8e717a56e8cb5183
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html228
-rw-r--r--uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java165
2 files changed, 393 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
new file mode 100644
index 0000000000..090579d81d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
@@ -0,0 +1,228 @@
+<?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:8888/run/" />
+<title>WindowMaximizeRestoreTest</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">WindowMaximizeRestoreTest</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.window.WindowMaximizeRestoreTest?restartApplication</td>
+ <td></td>
+</tr>
+<!--Test maximize-restore button-->
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>v-window-maximizebox</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>Window 1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>7,8</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>v-window-restorebox</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>9,7</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>v-window-maximizebox</td>
+</tr>
+<!--test double click on header-->
+<tr>
+ <td>doubleClickAt</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>v-window-restorebox</td>
+</tr>
+<tr>
+ <td>doubleClickAt</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>v-window-maximizebox</td>
+</tr>
+<!--Resizable = false should hide max-restore button-->
+<tr>
+ <td>assertVisible</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td>
+ <td>8,3</td>
+</tr>
+<tr>
+ <td>assertNotVisible</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td></td>
+</tr>
+<!--Test server side max-restore-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VNativeButton[0]</td>
+ <td>34,6</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>v-window-restorebox</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VNativeButton[0]</td>
+ <td>34,6</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>v-window-maximizebox</td>
+</tr>
+<!--test double click on header doesn't work-->
+<tr>
+ <td>doubleClickAt</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>v-window-maximizebox</td>
+</tr>
+<tr>
+ <td>doubleClickAt</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>v-window-maximizebox</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td>
+ <td>8,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[4]/VNativeButton[0]</td>
+ <td>26,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<!--test two windows with screen shot-->
+<tr>
+ <td>screenCapture</td>
+ <td>window-2-original-pos-window-1-centered</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>10,8</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td>window-1-maximized-on-top-of-window-2</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VNativeButton[0]</td>
+ <td>43,12</td>
+</tr>
+<!--maximize window 2 content-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[3]/VNativeButton[0]</td>
+ <td>100,9</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td>window-2-original-pos-window-1-centered</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>6,11</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td>window-2-maximized-on-top-of-window-1</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[2]</td>
+ <td>7,5</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td>window-2-closed-window-1-centered</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VFilterSelect[0]/domChild[1]</td>
+ <td>1,17</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[2]/td</td>
+ <td>122,6</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td>window-2-added-maximized-on-top-of-window-1</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[1]</td>
+ <td>6,11</td>
+</tr>
+<tr>
+ <td>doubleClickAt</td>
+ <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>113,10</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td>window-1-maximized-with-doubleclick</td>
+ <td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java
new file mode 100644
index 0000000000..fe45b036a1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java
@@ -0,0 +1,165 @@
+package com.vaadin.tests.components.window;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.window.WindowState.DisplayState;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.Window.CloseEvent;
+import com.vaadin.ui.Window.CloseListener;
+import com.vaadin.ui.Window.DisplayStateChangeEvent;
+import com.vaadin.ui.Window.DisplayStateChangeListener;
+
+public class WindowMaximizeRestoreTest extends AbstractTestUI {
+ Button.ClickListener addListener = new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ addWindow(createNewWindow());
+ }
+ };
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Button addButton = new Button("Add new Window");
+ addButton.addListener(addListener);
+ addComponent(addButton);
+
+ addWindowAgain = new ComboBox("Add Window Again");
+ addWindowAgain.setBuffered(false);
+ addWindowAgain.setImmediate(true);
+ addWindowAgain.addValueChangeListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+
+ Object value = event.getProperty().getValue();
+ if (value != null && value instanceof Window) {
+ UI.getCurrent().addWindow((Window) value);
+ addWindowAgain.removeItem(value);
+ }
+ }
+ });
+ addComponent(addWindowAgain);
+
+ addWindow(createNewWindow());
+ }
+
+ private int windowCount = 0;
+ private ComboBox addWindowAgain;
+
+ private Window createNewWindow() {
+ final Window w = new Window("Window " + (++windowCount));
+ final VerticalLayout content = new VerticalLayout();
+ w.setContent(content);
+ w.setData(windowCount);
+ w.setWidth("200px");
+ w.setHeight("300px");
+ w.setPositionX(200);
+ w.setPositionY(200);
+ final NativeButton maximize = new NativeButton("Maximize");
+ Button.ClickListener listener = new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (w.getDisplayState() == DisplayState.MAXIMIZED) {
+ w.setDisplayState(DisplayState.NORMAL);
+ maximize.setCaption("Maximize");
+ } else {
+ w.setDisplayState(DisplayState.MAXIMIZED);
+ maximize.setCaption("Restore");
+ }
+ }
+
+ };
+ maximize.addClickListener(listener);
+ ((ComponentContainer) w.getContent()).addComponent(maximize);
+
+ w.addDisplayStateChangeListener(new DisplayStateChangeListener() {
+
+ @Override
+ public void displayStateChanged(DisplayStateChangeEvent event) {
+ DisplayState state = (event.getWindow().getDisplayState());
+ if (state == DisplayState.NORMAL) {
+ w.setCaption("Window " + w.getData() + " Normal");
+ maximize.setCaption("Maximize");
+ } else if (state == DisplayState.MAXIMIZED) {
+ w.setCaption("Window " + w.getData() + " Maximized");
+ maximize.setCaption("Restore");
+ }
+ }
+ });
+ final CheckBox resizeable = new CheckBox("Resizeable");
+ resizeable.setValue(w.isResizable());
+ resizeable.addValueChangeListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ w.setResizable(resizeable.getValue());
+ }
+ });
+ ((ComponentContainer) w.getContent()).addComponent(resizeable);
+ final CheckBox closeable = new CheckBox("Closeable");
+ closeable.setValue(w.isClosable());
+ closeable.addValueChangeListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ w.setClosable(closeable.getValue());
+ }
+ });
+ ((ComponentContainer) w.getContent()).addComponent(closeable);
+ NativeButton contentFull = new NativeButton("Set Content Size Full",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ w.getContent().setSizeFull();
+ }
+ });
+ contentFull.setWidth("100%");
+ ((ComponentContainer) w.getContent()).addComponent(contentFull);
+
+ NativeButton center = new NativeButton("Center");
+ center.addClickListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ w.center();
+ }
+ });
+ ((ComponentContainer) w.getContent()).addComponent(center);
+
+ w.addCloseListener(new CloseListener() {
+
+ @Override
+ public void windowClose(CloseEvent e) {
+ Item item = addWindowAgain.addItem(w);
+ addWindowAgain.setItemCaption(w, "Window "
+ + w.getData().toString());
+ }
+ });
+
+ return w;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3400;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Tests the default maximize & restore funtionality. Max. makes window 100%*100% and pos(0, 0), and restore returns it to the values that are set in windows state.";
+ }
+}