diff options
Diffstat (limited to 'uitest/src')
149 files changed, 10944 insertions, 192 deletions
diff --git a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java index ec060bc73a..070cd2834d 100644 --- a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java +++ b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java @@ -69,9 +69,12 @@ public class DevelopmentServerLauncher { // Pass-through of arguments for Jetty final Map<String, String> serverArgs = parseArguments(args); + if (!serverArgs.containsKey("shutdownPort")) { + serverArgs.put("shutdownPort", "8889"); + } - if (serverArgs.containsKey("shutdownPort")) { - int port = Integer.parseInt(serverArgs.get("shutdownPort")); + int port = Integer.parseInt(serverArgs.get("shutdownPort")); + if (port > 0) { try { // Try to notify another instance that it's time to close Socket socket = new Socket((String) null, port); @@ -105,7 +108,7 @@ public class DevelopmentServerLauncher { try { assert false; - throw new RuntimeException("You should run " + System.err.println("You should run " + DevelopmentServerLauncher.class.getSimpleName() + " with assertions enabled. Add -ea as a VM argument."); } catch (AssertionError e) { diff --git a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java index b6774ae56a..ed611117d0 100644 --- a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java +++ b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java @@ -52,7 +52,12 @@ public class ThreadLocalInstances extends AbstractTestCase { private final FlagSeResource resource = new FlagSeResource() { @Override public DownloadStream getStream() { - reportCurrentStatus("resource handler"); + ThreadLocalInstances.this.getContext().lock(); + try { + reportCurrentStatus("resource handler"); + } finally { + ThreadLocalInstances.this.getContext().unlock(); + } return super.getStream(); } }; diff --git a/uitest/src/com/vaadin/tests/applicationcontext/CloseSession.java b/uitest/src/com/vaadin/tests/applicationcontext/CloseSession.java index 446638f8a2..cca76cc9e3 100644 --- a/uitest/src/com/vaadin/tests/applicationcontext/CloseSession.java +++ b/uitest/src/com/vaadin/tests/applicationcontext/CloseSession.java @@ -18,13 +18,16 @@ package com.vaadin.tests.applicationcontext; import javax.servlet.http.HttpSession; +import com.vaadin.server.Page; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinService; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedHttpSession; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.UI; public class CloseSession extends AbstractTestUI { private static final String OLD_HASH_PARAM = "oldHash"; @@ -158,6 +161,17 @@ public class CloseSession extends AbstractTestUI { @Override public void detach() { super.detach(); - System.out.println("UI " + getUIId() + " detached"); + log.log("Detach of " + this + " (" + getUIId() + ")"); + boolean correctUI = (UI.getCurrent() == this); + boolean correctPage = (Page.getCurrent() == getPage()); + boolean correctVaadinSession = (VaadinSession.getCurrent() == getSession()); + boolean correctVaadinService = (VaadinService.getCurrent() == getSession() + .getService()); + log.log("UI.current correct in detach: " + correctUI); + log.log("Page.current correct in detach: " + correctPage); + log.log("VaadinSession.current correct in detach: " + + correctVaadinSession); + log.log("VaadinService.current correct in detach: " + + correctVaadinService); } } diff --git a/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java b/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java new file mode 100644 index 0000000000..c88f482a7b --- /dev/null +++ b/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java @@ -0,0 +1,160 @@ +/* + * Copyright 2012 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.applicationcontext; + +import com.vaadin.server.Page; +import com.vaadin.server.VaadinRequest; +import com.vaadin.server.VaadinService; +import com.vaadin.server.VaadinSession; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.util.Log; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.UI; + +public class CloseUI extends AbstractTestUI { + private static final String OLD_HASH_PARAM = "oldHash"; + private static final String OLD_SESSION_ID_PARAM = "oldSessionId"; + + private final Log log = new Log(6); + + @Override + protected void setup(VaadinRequest request) { + System.out.println("UI " + getUIId() + " inited"); + + final int sessionHash = getSession().hashCode(); + final String sessionId = request.getWrappedSession().getId(); + + log.log("Current session hashcode: " + sessionHash); + log.log("Current WrappedSession id: " + sessionId); + + // Log previous values to make it easier to see what has changed + String oldHashValue = request.getParameter(OLD_HASH_PARAM); + if (oldHashValue != null) { + log.log("Old session hashcode: " + oldHashValue); + log.log("Same hash as current? " + + oldHashValue.equals(Integer.toString(sessionHash))); + } + + String oldSessionId = request.getParameter(OLD_SESSION_ID_PARAM); + if (oldSessionId != null) { + log.log("Old WrappedSession id: " + oldSessionId); + log.log("Same WrappedSession id? " + oldSessionId.equals(sessionId)); + } + + addComponent(log); + addComponent(new Button("Log 'hello'", new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + log.log("Hello"); + } + })); + addComponent(new Button("Close UI", new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + close(); + } + })); + + addComponent(new Button("Close UI (background)", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + new UIRunSafelyThread(CloseUI.this) { + @Override + protected void runSafely() { + close(); + }; + }.start(); + } + })); + addComponent(new Button( + "Close UI and redirect to /statictestfiles/static.html", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + getPage().setLocation("/statictestfiles/static.html"); + close(); + } + })); + addComponent(new Button( + "Close UI and redirect to /statictestfiles/static.html (background)", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + new UIRunSafelyThread(CloseUI.this) { + + @Override + protected void runSafely() { + getPage().setLocation( + "/statictestfiles/static.html"); + close(); + } + }.start(); + } + })); + + } + + private abstract class RunSafelyThread extends Thread { + private UI ui; + + public RunSafelyThread(UI ui) { + this.ui = ui; + } + + @Override + public void run() { + ui.accessSynchronously(new Runnable() { + + @Override + public void run() { + runSafely(); + } + }); + } + + protected abstract void runSafely(); + } + + @Override + protected String getTestDescription() { + return "Test for closing the session and redirecting the user"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(9859); + } + + @Override + public void detach() { + super.detach(); + log.log("Detach of " + this + " (" + getUIId() + ")"); + boolean correctUI = (UI.getCurrent() == this); + boolean correctPage = (Page.getCurrent() == getPage()); + boolean correctVaadinSession = (VaadinSession.getCurrent() == getSession()); + boolean correctVaadinService = (VaadinService.getCurrent() == getSession() + .getService()); + log.log("UI.current correct in detach: " + correctUI); + log.log("Page.current correct in detach: " + correctPage); + log.log("VaadinSession.current correct in detach: " + + correctVaadinSession); + log.log("VaadinService.current correct in detach: " + + correctVaadinService); + } +} diff --git a/uitest/src/com/vaadin/tests/applicationcontext/RpcForClosedUI.html b/uitest/src/com/vaadin/tests/applicationcontext/RpcForClosedUI.html new file mode 100644 index 0000000000..642e31b22c --- /dev/null +++ b/uitest/src/com/vaadin/tests/applicationcontext/RpcForClosedUI.html @@ -0,0 +1,44 @@ +<?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://192.168.2.75:8888/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/CloseUI?restartApplication</td> + <td></td> +</tr> +<!--Close the UI in a background thread--> +<tr> + <td>click</td> + <td>vaadin=runCloseUI::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Try to log 'hello'--> +<tr> + <td>click</td> + <td>vaadin=runCloseUI::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Ensure 'hello' was not logged--> +<tr> + <td>assertText</td> + <td>vaadin=runCloseUI::PID_SLog_row_0</td> + <td>2. Current WrappedSession id: *</td> +</tr> +<tr> + <td>assertTextNotPresent</td> + <td>Hello</td> + <td></td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java b/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java new file mode 100644 index 0000000000..c9af2c000d --- /dev/null +++ b/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java @@ -0,0 +1,24 @@ +package com.vaadin.tests.applicationcontext; + +import com.vaadin.ui.UI; + +public abstract class UIRunSafelyThread extends Thread { + private UI ui; + + public UIRunSafelyThread(UI ui) { + this.ui = ui; + } + + @Override + public void run() { + ui.accessSynchronously(new Runnable() { + + @Override + public void run() { + runSafely(); + } + }); + } + + protected abstract void runSafely(); +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/AbstractComponentTestCase.java b/uitest/src/com/vaadin/tests/components/AbstractComponentTestCase.java index 81ec4a9da4..8666956bdb 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractComponentTestCase.java +++ b/uitest/src/com/vaadin/tests/components/AbstractComponentTestCase.java @@ -226,6 +226,13 @@ public abstract class AbstractComponentTestCase<T extends AbstractComponent> } }; + protected Command<T, String> primaryStyleNameCommand = new Command<T, String>() { + @Override + public void execute(T c, String value, Object data) { + c.setPrimaryStyleName(value); + } + }; + @Override protected String getDescription() { return "Generic test case for " + getTestClass().getSimpleName(); diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonWithShortcutNotRendered.java b/uitest/src/com/vaadin/tests/components/button/ButtonWithShortcutNotRendered.java index b01e0a85d0..f866928054 100644 --- a/uitest/src/com/vaadin/tests/components/button/ButtonWithShortcutNotRendered.java +++ b/uitest/src/com/vaadin/tests/components/button/ButtonWithShortcutNotRendered.java @@ -83,6 +83,7 @@ public class ButtonWithShortcutNotRendered extends AbstractTestUI { addValueChangeListener(new Property.ValueChangeListener() { + @Override public void valueChange( com.vaadin.data.Property.ValueChangeEvent event) { final Item item = getItem(getValue()); @@ -162,6 +163,7 @@ public class ButtonWithShortcutNotRendered extends AbstractTestUI { } } + @Override public void buttonClick(ClickEvent event) { // NOP } diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.html b/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.html new file mode 100644 index 0000000000..8d10438c1d --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.html @@ -0,0 +1,77 @@ +<?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://127.0.0.1:8080/" /> +<title>ButtonsWaiAria</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">ButtonsWaiAria</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.button.ButtonsWaiAria?restartApplication</td> + <td></td> +</tr> +<tr> + <td>verifyElementPresent</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/</td> + <td></td> +</tr> +<tr> + <td>assertAttribute</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]@role</td> + <td>button</td> +</tr> +<tr> + <td>verifyElementPresent</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>xpath=/html/body/div/div/div[2]/div/div[2]/div/div[5]/div/span/img[@alt='']</td> + <td></td> +</tr> +<tr> + <td>verifyElementPresent</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/</td> + <td></td> +</tr> +<tr> + <td>assertAttribute</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]@alt</td> + <td>user icon</td> +</tr> +<tr> + <td>verifyElementPresent</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VButton[0]/</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::PID_Scheckboxaction-Enabled/domChild[0]</td> + <td>7,7</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/@aria-disabled</td> + <td>true</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::PID_Scheckboxaction-Enabled/domChild[0]</td> + <td>7,7</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>/html/body/div/div/div[2]/div/div[2]/div/div[3]/div[@aria-disabled]</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.java b/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.java new file mode 100644 index 0000000000..1208b8be3b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.java @@ -0,0 +1,51 @@ +package com.vaadin.tests.components.button; + +import com.vaadin.tests.components.ComponentTestCase; +import com.vaadin.ui.Button; +import com.vaadin.ui.NativeButton; + +public class ButtonsWaiAria extends ComponentTestCase<Button> { + + @Override + protected Class<Button> getTestClass() { + return Button.class; + } + + @Override + protected void initializeComponents() { + + Button l; + boolean nat = false; + + l = createButton("Default Button", nat); + addTestComponent(l); + + l = createButton("Icon Button, empty alt", nat); + l.setIcon(ICON_16_USER_PNG_CACHEABLE); + addTestComponent(l); + + l = createButton("Icon Button with alt", nat); + l.setIcon(ICON_16_USER_PNG_CACHEABLE, "user icon"); + addTestComponent(l); + + l = createButton("Tooltip Button", nat); + l.setDescription("Tooltip"); + addTestComponent(l); + } + + private Button createButton(String text, boolean nativeButton) { + Button b; + if (nativeButton) { + b = new NativeButton(text); + } else { + b = new Button(text); + } + + return b; + } + + @Override + protected String getDescription() { + return "A generic test for Buttons in different configurations"; + } +} diff --git a/uitest/src/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java b/uitest/src/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java new file mode 100644 index 0000000000..83fc4a03cb --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java @@ -0,0 +1,184 @@ +/** + * Copyright 2013 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.calendar; + +import java.util.Arrays; +import java.util.Date; + +import com.vaadin.data.fieldgroup.FieldGroup; +import com.vaadin.data.fieldgroup.FieldGroup.CommitException; +import com.vaadin.data.util.BeanItem; +import com.vaadin.data.util.BeanItemContainer; +import com.vaadin.event.Action; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.datefield.Resolution; +import com.vaadin.ui.Calendar; +import com.vaadin.ui.DateField; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.Table; +import com.vaadin.ui.TextField; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalSplitPanel; +import com.vaadin.ui.Window; +import com.vaadin.ui.Window.CloseEvent; +import com.vaadin.ui.components.calendar.ContainerEventProvider; +import com.vaadin.ui.components.calendar.event.BasicEvent; + +public class BeanItemContainerTestUI extends UI { + + private Calendar calendar; + + private Table table; + + private BeanItemContainer<BasicEvent> events = new BeanItemContainer<BasicEvent>( + BasicEvent.class); + + @SuppressWarnings("deprecation") + @Override + protected void init(VaadinRequest request) { + VerticalSplitPanel content = new VerticalSplitPanel(); + content.setSizeFull(); + setContent(content); + + // Create Calendar + calendar = new Calendar(); + calendar.setImmediate(true); + calendar.setSizeFull(); + calendar.setContainerDataSource(events); + calendar.setStartDate(new Date(100, 1, 1)); + calendar.setEndDate(new Date(100, 2, 1)); + + content.addComponent(calendar); + + // Add event table connected to same data source + table = createTable(); + table.setContainerDataSource(events); + table.setVisibleColumns(new Object[] { "caption", "description", + "start", "end" }); + content.addComponent(table); + } + + /** + * Creates a table with some actions + * + * @return + */ + private Table createTable() { + Table table = new Table(); + table.setSizeFull(); + table.addActionHandler(new Action.Handler() { + + private final Action ADD = new Action("Add event"); + private final Action EDIT = new Action("Edit event"); + private final Action REMOVE = new Action("Remove event"); + + @Override + public void handleAction(Action action, Object sender, Object target) { + if (action == ADD) { + BasicEvent event = new BasicEvent(); + event.setStart(new Date(100, 1, 1)); + event.setEnd(new Date(100, 1, 1)); + editEvent(event); + } else if (action == EDIT) { + editEvent((BasicEvent) target); + } else if (action == REMOVE) { + events.removeItem(target); + } + } + + @Override + public Action[] getActions(Object target, Object sender) { + if (target == null) { + return new Action[] { ADD }; + } else { + return new Action[] { EDIT, REMOVE }; + } + } + }); + return table; + } + + /** + * Opens up a modal dialog window where an event can be modified + * + * @param event + * The event to modify + */ + private void editEvent(final BasicEvent event) { + Window modal = new Window("Add event"); + modal.setModal(true); + modal.setResizable(false); + modal.setDraggable(false); + modal.setWidth("300px"); + final FieldGroup fieldGroup = new FieldGroup(); + + FormLayout formLayout = new FormLayout(); + TextField captionField = new TextField("Caption"); + captionField.setImmediate(true); + TextField descriptionField = new TextField("Description"); + descriptionField.setImmediate(true); + DateField startField = new DateField("Start"); + startField.setResolution(Resolution.MINUTE); + startField.setImmediate(true); + DateField endField = new DateField("End"); + endField.setImmediate(true); + endField.setResolution(Resolution.MINUTE); + + formLayout.addComponent(captionField); + formLayout.addComponent(descriptionField); + formLayout.addComponent(startField); + formLayout.addComponent(endField); + + fieldGroup.bind(captionField, ContainerEventProvider.CAPTION_PROPERTY); + fieldGroup.bind(descriptionField, + ContainerEventProvider.DESCRIPTION_PROPERTY); + fieldGroup.bind(startField, ContainerEventProvider.STARTDATE_PROPERTY); + fieldGroup.bind(endField, ContainerEventProvider.ENDDATE_PROPERTY); + + fieldGroup.setItemDataSource(new BeanItem<BasicEvent>(event, Arrays + .asList(ContainerEventProvider.CAPTION_PROPERTY, + ContainerEventProvider.DESCRIPTION_PROPERTY, + ContainerEventProvider.STARTDATE_PROPERTY, + ContainerEventProvider.ENDDATE_PROPERTY))); + modal.setContent(formLayout); + modal.addCloseListener(new Window.CloseListener() { + @Override + public void windowClose(CloseEvent e) { + // Commit changes to bean + try { + fieldGroup.commit(); + } catch (CommitException e1) { + e1.printStackTrace(); + } + + if (events.containsId(event)) { + /* + * BeanItemContainer does not notify container listeners + * when the bean changes so we need to trigger a + * ItemSetChange event + */ + BasicEvent dummy = new BasicEvent(); + events.addBean(dummy); + events.removeItem(dummy); + + } else { + events.addBean(event); + } + } + }); + getUI().addWindow(modal); + } +} diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarActions.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarActions.html new file mode 100644 index 0000000000..bec3f2aded --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarActions.html @@ -0,0 +1,51 @@ +<?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:8080/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarActionsUI?restartApplication</td> + <td></td> +</tr> +<tr> + <td>contextMenuAt</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarActionsUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[7]</td> + <td>100,20</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>addEventContextMenu</td> +</tr> +<tr> + <td>contextMenuAt</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarActionsUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[8]</td> + <td>100,20</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>removeEventContextMenu</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarActionsUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[8]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>NoContextMenu</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsUI.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsUI.java new file mode 100644 index 0000000000..ee898e0790 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsUI.java @@ -0,0 +1,110 @@ +/** + * Copyright 2013 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.calendar; + +import java.util.Date; +import java.util.Locale; + +import com.vaadin.event.Action; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Calendar; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.UI; +import com.vaadin.ui.components.calendar.CalendarDateRange; +import com.vaadin.ui.components.calendar.event.BasicEvent; + +public class CalendarActionsUI extends UI { + + @SuppressWarnings("deprecation") + @Override + protected void init(VaadinRequest request) { + GridLayout content = new GridLayout(1, 2); + content.setSizeFull(); + setContent(content); + + final Calendar calendar = new Calendar(); + calendar.setLocale(new Locale("fi", "FI")); + + calendar.setSizeFull(); + calendar.setStartDate(new Date(100, 1, 1)); + calendar.setEndDate(new Date(100, 2, 1)); + + calendar.addActionHandler(new Action.Handler() { + + public final Action NEW_EVENT = new Action("Add event"); + public final Action EDIT_EVENT = new Action("Edit event"); + public final Action REMOVE_EVENT = new Action("Remove event"); + + /* + * (non-Javadoc) + * + * @see + * com.vaadin.event.Action.Handler#handleAction(com.vaadin.event + * .Action, java.lang.Object, java.lang.Object) + */ + @Override + public void handleAction(Action action, Object sender, Object target) { + Date date = (Date) target; + if (action == NEW_EVENT) { + BasicEvent event = new BasicEvent("New event", + "Hello world", date, date); + calendar.addEvent(event); + } + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.event.Action.Handler#getActions(java.lang.Object, + * java.lang.Object) + */ + @Override + public Action[] getActions(Object target, Object sender) { + CalendarDateRange date = (CalendarDateRange) target; + + java.util.Calendar cal = java.util.Calendar.getInstance(); + cal.set(2000, 1, 1, 12, 0, 0); + + if (date.inRange(cal.getTime())) { + return new Action[] { NEW_EVENT, }; + } + + cal.add(java.util.Calendar.DAY_OF_WEEK, 1); + + if (date.inRange(cal.getTime())) { + return new Action[] { REMOVE_EVENT }; + } + + return null; + } + }); + + content.addComponent(calendar); + + content.addComponent(new Button("Set week view", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + calendar.setEndDate(new Date(100, 1, 7)); + } + })); + + content.setRowExpandRatio(0, 1); + + } +} diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarBasicNavigation.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarBasicNavigation.html new file mode 100644 index 0000000000..cccb88bfb2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarBasicNavigation.html @@ -0,0 +1,236 @@ +<?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>basicNavigation</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">basicNavigation</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&width=1000px&height=600px&restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td> + <td>Jan 2000</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td> + <td>Feb 2000</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td> + <td>Mar 2000</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td> + <td>Feb 2000</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td> + <td>Jan 2000</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>26</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[5]/domChild[6]/domChild[0]/domChild[0]</td> + <td>5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>9,44</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>Sunday 1/9/00</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td> + <td>Saturday 1/15/00</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>1 AM</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[23]</td> + <td>11 PM</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]/domChild[0]</td> + <td>4,6</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]/domChild[0]</td> + <td>4,5</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>Sunday 1/23/00</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td> + <td>Saturday 1/29/00</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>9,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>9,7</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>Sunday 1/9/00</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td> + <td>Saturday 1/15/00</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]</td> + <td>77,5</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>Tuesday 1/11/00</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>8,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>10,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>10,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>10,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>10,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>10,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>10,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>10,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>10,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>10,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>10,9</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>Friday 12/31/99</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>Sunday 1/30/00</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td> + <td>Saturday 2/5/00</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>26</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.html new file mode 100644 index 0000000000..425f95c529 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.html @@ -0,0 +1,59 @@ +<?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:7171/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarDragAndDrop?restartApplication</td> + <td></td> +</tr> +<!--// Test drag and drop in month view--> +<tr> + <td>drag</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[9]/domChild[0]/domChild[0]</td> + <td>76,7</td> +</tr> +<tr> + <td>drop</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[5]/domChild[0]/domChild[2]</td> + <td>54,9</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::PID_SCalendar/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[5]/domChild[0]/domChild[1]</td> + <td>12:00 AM Event 10</td> +</tr> +<!--//Test drag and drop in week view--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::PID_SCalendar/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td> + <td>7,85</td> +</tr> +<tr> + <td>drag</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[11]/domChild[0]/domChild[0]</td> + <td>34,12</td> +</tr> +<tr> + <td>drop</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::PID_SCalendar/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[15]</td> + <td>75,9</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::PID_SCalendar/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[48]/domChild[0]</td> + <td>7:30 AM: Event 13</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.java new file mode 100644 index 0000000000..7477fc84ce --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.java @@ -0,0 +1,123 @@ +/* + * Copyright 2000-2013 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.calendar; + +import java.util.GregorianCalendar; +import java.util.Locale; + +import com.vaadin.event.dd.DragAndDropEvent; +import com.vaadin.event.dd.DropHandler; +import com.vaadin.event.dd.acceptcriteria.AcceptAll; +import com.vaadin.event.dd.acceptcriteria.AcceptCriterion; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Calendar; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Table; +import com.vaadin.ui.Table.TableDragMode; +import com.vaadin.ui.Table.TableTransferable; +import com.vaadin.ui.components.calendar.CalendarTargetDetails; +import com.vaadin.ui.components.calendar.event.BasicEvent; + +public class CalendarDragAndDrop extends AbstractTestUI { + + private Calendar calendar; + + private Table table; + + private class TestDropHandler implements DropHandler { + + @Override + public void drop(DragAndDropEvent event) { + CalendarTargetDetails details = (CalendarTargetDetails) event + .getTargetDetails(); + + TableTransferable transferable = (TableTransferable) event + .getTransferable(); + + calendar.addEvent(new BasicEvent(transferable.getItemId() + .toString(), "This event was dragged here", details + .getDropTime())); + + table.removeItem(transferable.getItemId()); + } + + @Override + public AcceptCriterion getAcceptCriterion() { + return AcceptAll.get(); + } + } + + @Override + protected void setup(VaadinRequest request) { + setSizeFull(); + getContent().setSizeFull(); + getLayout().setSizeFull(); + + HorizontalLayout root = new HorizontalLayout(); + root.setSizeFull(); + addComponent(root); + + Locale locale = new Locale("en", "US"); + GregorianCalendar cal = new GregorianCalendar(locale); + cal.set(2013, 0, 1); + + calendar = new Calendar(); + calendar.setId("Calendar"); + calendar.setLocale(locale); + calendar.setDropHandler(new TestDropHandler()); + calendar.setSizeFull(); + root.addComponent(calendar); + + calendar.setStartDate(cal.getTime()); + cal.add(java.util.Calendar.MONTH, 1); + calendar.setEndDate(cal.getTime()); + + table = new Table(); + table.setSizeFull(); + table.setDragMode(TableDragMode.ROW); + table.addGeneratedColumn("COLUMN", new Table.ColumnGenerator() { + + @Override + public Object generateCell(Table source, Object itemId, + Object columnId) { + return itemId; + } + }); + + for (int eventNum = 1; eventNum < 50; eventNum++) { + table.addItem("Event " + eventNum); + } + + root.addComponent(table); + } + + @Override + protected String getTestDescription() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Integer getTicketNumber() { + return 11048; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarEventSizingNoOverlap.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarEventSizingNoOverlap.html new file mode 100644 index 0000000000..dcf6c1ec53 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarEventSizingNoOverlap.html @@ -0,0 +1,110 @@ +<?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>eventSizingNoOverlap</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">eventSizingNoOverlap</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&firstDay=1&lastDay=5&firstHour=8&lastHour=16&restartApplication</td> + <td></td> +</tr> +<!-- Go to week view --> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>4,57</td> +</tr> +<!-- Open add-event popup, enter event between 12:45-13:15 --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/9/00 12:45 PM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/9/00 13:15 PM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>12:45-13:15</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!-- Open add-event popup, enter event between 13:15-13:25 --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/9/00 13:15 PM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/9/00 13:25 PM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>13:15-13:25</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!-- Open add-event popup, enter event between 13:25-13:55 --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/9/00 13:25 PM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/9/00 13:55 PM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>13:25-13:55</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</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/calendar/CalendarMidnightEventsTest.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarMidnightEventsTest.html new file mode 100644 index 0000000000..8991e1983d --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarMidnightEventsTest.html @@ -0,0 +1,116 @@ +<?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>midnightEventsTest</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">midnightEventsTest</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&width=1000px&height=600px&secondsResolution&restartApplication</td> + <td></td> +</tr> +<!--Add event from 0:00 to 0:00--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[1]/domChild[0]/domChild[2]</td> + <td></td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/3/00 12:00:00 AM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/4/00 12:00:00 AM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Midnight to midnight</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Add event from 00:00 to 00:00 on the same day--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[1]/domChild[0]/domChild[2]</td> + <td>84,10</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/7/00 12:00:00 AM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Zero-length midnight event</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> +<!--Go to weekly view--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td> + <td>10,48</td> +</tr> +<!--Assert zero-length event exists--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[48]/domChild[0]</td> + <td>50,4</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Zero-length midnight event</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Assert that the the all day event does not overflow to the next day by checking that the first time-cell is empty--> +<tr> + <td>dragAndDrop</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[5]</td> + <td>+0,+5</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</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/calendar/CalendarMonthlyViewNewEvent.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvent.html new file mode 100644 index 0000000000..760beef6c0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvent.html @@ -0,0 +1,170 @@ +<?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>monthlyViewNewEvent</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">monthlyViewNewEvent</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&width=1000px&height=600px&restartApplication</td> + <td></td> +</tr> +<!--Create new event with the button--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td> + <td>10,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>52,8</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>12/26/99</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/1/00</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Test description</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Open previously created event, assert values--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>91,9</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>12/26/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/1/00</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td> + <td>on</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Test description</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Green</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Open previously created event, assert values and shorten the event--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>41,8</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>12/26/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/1/00</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td> + <td>on</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Test description</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Green</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>12/27/99</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>12/31/99</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Click the calendar where the event previously was, assert new event creation--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]</td> + <td>107,8</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvents.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvents.html new file mode 100644 index 0000000000..68690f81b4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvents.html @@ -0,0 +1,410 @@ +<?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>monthlyViewNewEvents</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">monthlyViewNewEvents</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&width=1000px&height=600px&restartApplication</td> + <td></td> +</tr> +<!--Create new event by dragging, make it all-day--> +<tr> + <td>drag</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]</td> + <td></td> +</tr> +<tr> + <td>drop</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[5]/domChild[0]/domChild[2]</td> + <td>98,83</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>12/27/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>12/31/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td> + <td>on</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Description</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Create new event by dragging--> +<tr> + <td>drag</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td></td> +</tr> +<tr> + <td>drop</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]</td> + <td>38,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td> + <td>7,9</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Second test event</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Desc</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Create new event by dragging, make it blue--> +<tr> + <td>drag</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[4]</td> + <td></td> +</tr> +<tr> + <td>drop</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[6]/domChild[0]/domChild[3]</td> + <td>125,80</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td> + <td>10,8</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Third test event</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Testing</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td> + <td>6,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item2</td> + <td>49,10</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[4]</td> + <td>45,85</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td> + <td>5,9</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Fourth test event</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Fourth event</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td> + <td>13,18</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item3</td> + <td>57,9</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Start asserting the previously entered events--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td> + <td>12,7</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>12/27/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>12/31/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td> + <td>on</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Description</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Green</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td> + <td>72,6</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>12/27/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>12/31/99</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>44,10</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>12/26/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>12/29/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Second test event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Desc</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Green</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>79,5</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>12/26/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>12/29/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Second test event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Desc</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Green</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[2]</td> + <td>47,9</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>12/30/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/1/00</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Third test event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Testing</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Blue</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[2]</td> + <td>72,9</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>12/30/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/1/00</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Third test event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Testing</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Blue</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[3]</td> + <td>37,9</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>12/29/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>12/29/99</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Fourth test event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Fourth event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Red</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td></td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarNotifications.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarNotifications.html new file mode 100644 index 0000000000..15bf29a0fd --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarNotifications.html @@ -0,0 +1,41 @@ +<?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:8080/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.NotificationTestUI?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarNotificationTestUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>83,11</td> +</tr> +<tr> + <td>mouseMove</td> + <td>vaadin=runcomvaadintestscomponentscalendarNotificationTestUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[3]/domChild[0]/domChild[3]</td> + <td>10,10</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//div[@id='runcomvaadintestscomponentscalendarNotificationTestUI-1842310749-overlays']/div</td> + <td>0,0</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>no-notification</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest1000x600px.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest1000x600px.html new file mode 100644 index 0000000000..bd4c671361 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest1000x600px.html @@ -0,0 +1,41 @@ +<?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>sizeTest1000x600px</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">sizeTest1000x600px</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&restartApplication&width=1000px&height=600px</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td> + <td>Jan 2000</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>month</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>7,53</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>week</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100percentXundefined.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100percentXundefined.html new file mode 100644 index 0000000000..64b5444d34 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100percentXundefined.html @@ -0,0 +1,41 @@ +<?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>sizeTest100percentXundefined</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">sizeTest100percentXundefined</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&restartApplication&width=100%25</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td> + <td>Jan 2000</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>month</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>10,53</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>week</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100x100percent.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100x100percent.html new file mode 100644 index 0000000000..0905034b13 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100x100percent.html @@ -0,0 +1,41 @@ +<?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>sizeTest100x100percent</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">sizeTest100x100percent</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&restartApplication&width=100%25&height=100%25</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td> + <td>Jan 2000</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>month</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>12,54</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>week</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest300pxXundefined.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest300pxXundefined.html new file mode 100644 index 0000000000..99327a01df --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest300pxXundefined.html @@ -0,0 +1,41 @@ +<?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>sizeTest300pxXundefined</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">sizeTest300pxXundefined</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&restartApplication&width=300px</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td> + <td>Jan 2000</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>month</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>11,52</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>week</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX100percent.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX100percent.html new file mode 100644 index 0000000000..2e4c811ff1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX100percent.html @@ -0,0 +1,41 @@ +<?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>sizeTestUndefinedX100percent</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">sizeTestUndefinedX100percent</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&restartApplication&height=100%25</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td> + <td>Jan 2000</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>month</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>9,53</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>week</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX300px.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX300px.html new file mode 100644 index 0000000000..cca66c7145 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX300px.html @@ -0,0 +1,41 @@ +<?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>sizeTestUndefinedX300px</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">sizeTestUndefinedX300px</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&restartApplication&height=300px</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td> + <td>Jan 2000</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>month</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>9,26</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>week</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedXUndefined.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedXUndefined.html new file mode 100644 index 0000000000..e4a8da691b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedXUndefined.html @@ -0,0 +1,41 @@ +<?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>sizeTestUndefinedXUndefined</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">sizeTestUndefinedXUndefined</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&restartApplication&width=&height=</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td> + <td>Jan 2000</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>month</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>8,52</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>week</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarTest.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarTest.java new file mode 100644 index 0000000000..a1bcca2e4e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarTest.java @@ -0,0 +1,1242 @@ +/** + * Copyright 2013 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.calendar; + +import java.text.DateFormatSymbols; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.Locale; +import java.util.Map; +import java.util.TimeZone; + +import com.vaadin.annotations.Theme; +import com.vaadin.data.Item; +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.data.fieldgroup.FieldGroup; +import com.vaadin.data.fieldgroup.FieldGroup.CommitException; +import com.vaadin.data.util.BeanItem; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.MarginInfo; +import com.vaadin.shared.ui.combobox.FilteringMode; +import com.vaadin.shared.ui.datefield.Resolution; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Calendar; +import com.vaadin.ui.Calendar.TimeFormat; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.DateField; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.Layout; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; +import com.vaadin.ui.components.calendar.CalendarComponentEvents.DateClickEvent; +import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventClick; +import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventClickHandler; +import com.vaadin.ui.components.calendar.CalendarComponentEvents.RangeSelectEvent; +import com.vaadin.ui.components.calendar.CalendarComponentEvents.RangeSelectHandler; +import com.vaadin.ui.components.calendar.CalendarComponentEvents.WeekClick; +import com.vaadin.ui.components.calendar.CalendarComponentEvents.WeekClickHandler; +import com.vaadin.ui.components.calendar.event.BasicEvent; +import com.vaadin.ui.components.calendar.event.BasicEventProvider; +import com.vaadin.ui.components.calendar.event.CalendarEvent; +import com.vaadin.ui.components.calendar.handler.BasicDateClickHandler; +import com.vaadin.ui.components.calendar.handler.BasicWeekClickHandler; + +/** Calendar component test application */ +@Theme("tests-calendar") +public class CalendarTest extends UI { + + private static final long serialVersionUID = -5436777475398410597L; + + private static final String DEFAULT_ITEMID = "DEFAULT"; + + private enum Mode { + MONTH, WEEK, DAY; + } + + /** + * This Gregorian calendar is used to control dates and time inside of this + * test application. + */ + private GregorianCalendar calendar; + + /** Target calendar component that this test application is made for. */ + private Calendar calendarComponent; + + private Date currentMonthsFirstDate; + + private final Label captionLabel = new Label(""); + + private Button monthButton; + + private Button weekButton; + + private Button nextButton; + + private Button prevButton; + + private ComboBox timeZoneSelect; + + private ComboBox formatSelect; + + private ComboBox localeSelect; + + private CheckBox hideWeekendsButton; + + private CheckBox readOnlyButton; + + private TextField captionField; + + private Window scheduleEventPopup; + + private final FormLayout scheduleEventFieldLayout = new FormLayout(); + private FieldGroup scheduleEventFieldGroup = new FieldGroup(); + + private Button deleteEventButton; + + private Button applyEventButton; + + private Mode viewMode = Mode.MONTH; + + private BasicEventProvider dataSource; + + private Button addNewEvent; + + /* + * When testBench is set to true, CalendarTest will have static content that + * is more suitable for Vaadin TestBench testing. Calendar will use a static + * date Mon 10 Jan 2000. Enable by starting the application with a + * "testBench" parameter in the URL. + */ + private boolean testBench = false; + + private String calendarHeight = null; + + private String calendarWidth = null; + + private CheckBox disabledButton; + + private Integer firstHour; + + private Integer lastHour; + + private Integer firstDay; + + private Integer lastDay; + + private Locale defaultLocale = Locale.US; + + private boolean showWeeklyView; + + private boolean useSecondResolution; + + private DateField startDateField; + private DateField endDateField; + + @SuppressWarnings("serial") + @Override + public void init(VaadinRequest request) { + GridLayout layout = new GridLayout(); + layout.setSizeFull(); + layout.setMargin(true); + setContent(layout); + + handleURLParams(request.getParameterMap()); + + initContent(); + } + + private void handleURLParams(Map<String, String[]> parameters) { + testBench = parameters.containsKey("testBench") + || parameters.containsKey("?testBench"); + + if (parameters.containsKey("width")) { + calendarWidth = parameters.get("width")[0]; + } + + if (parameters.containsKey("height")) { + calendarHeight = parameters.get("height")[0]; + } + + if (parameters.containsKey("firstDay")) { + firstDay = Integer.parseInt(parameters.get("firstDay")[0]); + } + + if (parameters.containsKey("lastDay")) { + lastDay = Integer.parseInt(parameters.get("lastDay")[0]); + } + + if (parameters.containsKey("firstHour")) { + firstHour = Integer.parseInt(parameters.get("firstHour")[0]); + } + + if (parameters.containsKey("lastHour")) { + lastHour = Integer.parseInt(parameters.get("lastHour")[0]); + } + + if (parameters.containsKey("locale")) { + String localeArray[] = parameters.get("locale")[0].split("_"); + defaultLocale = new Locale(localeArray[0], localeArray[1]); + setLocale(defaultLocale); + } + + if (parameters.containsKey(("secondsResolution"))) { + useSecondResolution = true; + } + + showWeeklyView = parameters.containsKey("weekly"); + + } + + public void initContent() { + // Set default Locale for this application + if (testBench) { + setLocale(defaultLocale); + + } else { + setLocale(Locale.getDefault()); + } + + // Initialize locale, timezone and timeformat selects. + localeSelect = createLocaleSelect(); + timeZoneSelect = createTimeZoneSelect(); + formatSelect = createCalendarFormatSelect(); + + initCalendar(); + initLayoutContent(); + addInitialEvents(); + } + + private Date resolveFirstDateOfWeek(Date today, + java.util.Calendar currentCalendar) { + int firstDayOfWeek = currentCalendar.getFirstDayOfWeek(); + currentCalendar.setTime(today); + while (firstDayOfWeek != currentCalendar + .get(java.util.Calendar.DAY_OF_WEEK)) { + currentCalendar.add(java.util.Calendar.DATE, -1); + } + return currentCalendar.getTime(); + } + + private Date resolveLastDateOfWeek(Date today, + java.util.Calendar currentCalendar) { + currentCalendar.setTime(today); + currentCalendar.add(java.util.Calendar.DATE, 1); + int firstDayOfWeek = currentCalendar.getFirstDayOfWeek(); + // Roll to weeks last day using firstdayofweek. Roll until FDofW is + // found and then roll back one day. + while (firstDayOfWeek != currentCalendar + .get(java.util.Calendar.DAY_OF_WEEK)) { + currentCalendar.add(java.util.Calendar.DATE, 1); + } + currentCalendar.add(java.util.Calendar.DATE, -1); + return currentCalendar.getTime(); + } + + private void addInitialEvents() { + Date originalDate = calendar.getTime(); + Date today = getToday(); + + // Add a event that last a whole week + + Date start = resolveFirstDateOfWeek(today, calendar); + Date end = resolveLastDateOfWeek(today, calendar); + CalendarTestEvent event = getNewEvent("Whole week event", start, end); + event.setAllDay(true); + event.setStyleName("color4"); + event.setDescription("Description for the whole week event."); + dataSource.addEvent(event); + + // Add a allday event + calendar.setTime(start); + calendar.add(GregorianCalendar.DATE, 3); + start = calendar.getTime(); + end = start; + event = getNewEvent("Allday event", start, end); + event.setAllDay(true); + event.setDescription("Some description."); + event.setStyleName("color3"); + dataSource.addEvent(event); + + // Add a second allday event + calendar.add(GregorianCalendar.DATE, 1); + start = calendar.getTime(); + end = start; + event = getNewEvent("Second allday event", start, end); + event.setAllDay(true); + event.setDescription("Some description."); + event.setStyleName("color2"); + dataSource.addEvent(event); + + calendar.add(GregorianCalendar.DATE, -3); + calendar.set(GregorianCalendar.HOUR_OF_DAY, 9); + calendar.set(GregorianCalendar.MINUTE, 30); + start = calendar.getTime(); + calendar.add(GregorianCalendar.HOUR_OF_DAY, 5); + calendar.set(GregorianCalendar.MINUTE, 0); + end = calendar.getTime(); + event = getNewEvent("Appointment", start, end); + event.setWhere("Office"); + event.setStyleName("color1"); + event.setDescription("A longer description, which should display correctly."); + dataSource.addEvent(event); + + calendar.add(GregorianCalendar.DATE, 1); + calendar.set(GregorianCalendar.HOUR_OF_DAY, 11); + calendar.set(GregorianCalendar.MINUTE, 0); + start = calendar.getTime(); + calendar.add(GregorianCalendar.HOUR_OF_DAY, 8); + end = calendar.getTime(); + event = getNewEvent("Training", start, end); + event.setStyleName("color2"); + dataSource.addEvent(event); + + calendar.add(GregorianCalendar.DATE, 4); + calendar.set(GregorianCalendar.HOUR_OF_DAY, 9); + calendar.set(GregorianCalendar.MINUTE, 0); + start = calendar.getTime(); + calendar.add(GregorianCalendar.HOUR_OF_DAY, 9); + end = calendar.getTime(); + event = getNewEvent("Free time", start, end); + dataSource.addEvent(event); + + calendar.setTime(originalDate); + } + + private void initLayoutContent() { + initNavigationButtons(); + initHideWeekEndButton(); + initReadOnlyButton(); + initDisabledButton(); + initAddNewEventButton(); + + HorizontalLayout hl = new HorizontalLayout(); + hl.setWidth("100%"); + hl.setSpacing(true); + hl.setMargin(new MarginInfo(false, false, true, false)); + hl.addComponent(prevButton); + hl.addComponent(captionLabel); + hl.addComponent(monthButton); + hl.addComponent(weekButton); + hl.addComponent(nextButton); + hl.setComponentAlignment(prevButton, Alignment.MIDDLE_LEFT); + hl.setComponentAlignment(captionLabel, Alignment.MIDDLE_CENTER); + hl.setComponentAlignment(monthButton, Alignment.MIDDLE_CENTER); + hl.setComponentAlignment(weekButton, Alignment.MIDDLE_CENTER); + hl.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT); + + monthButton.setVisible(viewMode == Mode.WEEK); + weekButton.setVisible(viewMode == Mode.DAY); + + HorizontalLayout controlPanel = new HorizontalLayout(); + controlPanel.setSpacing(true); + controlPanel.setMargin(new MarginInfo(false, false, true, false)); + controlPanel.setWidth("100%"); + controlPanel.addComponent(localeSelect); + controlPanel.addComponent(timeZoneSelect); + controlPanel.addComponent(formatSelect); + controlPanel.addComponent(hideWeekendsButton); + controlPanel.addComponent(readOnlyButton); + controlPanel.addComponent(disabledButton); + controlPanel.addComponent(addNewEvent); + + controlPanel.setComponentAlignment(timeZoneSelect, + Alignment.MIDDLE_LEFT); + controlPanel.setComponentAlignment(formatSelect, Alignment.MIDDLE_LEFT); + controlPanel.setComponentAlignment(localeSelect, Alignment.MIDDLE_LEFT); + controlPanel.setComponentAlignment(hideWeekendsButton, + Alignment.MIDDLE_LEFT); + controlPanel.setComponentAlignment(readOnlyButton, + Alignment.MIDDLE_LEFT); + controlPanel.setComponentAlignment(disabledButton, + Alignment.MIDDLE_LEFT); + controlPanel.setComponentAlignment(addNewEvent, Alignment.MIDDLE_LEFT); + + GridLayout layout = (GridLayout) getContent(); + layout.addComponent(controlPanel); + layout.addComponent(hl); + layout.addComponent(calendarComponent); + layout.setRowExpandRatio(layout.getRows() - 1, 1.0f); + } + + private void initNavigationButtons() { + monthButton = new Button("Month view", new ClickListener() { + + private static final long serialVersionUID = 1L; + + @Override + public void buttonClick(ClickEvent event) { + switchToMonthView(); + } + }); + + weekButton = new Button("Week view", new ClickListener() { + + private static final long serialVersionUID = 1L; + + @Override + public void buttonClick(ClickEvent event) { + // simulate week click + WeekClickHandler handler = (WeekClickHandler) calendarComponent + .getHandler(WeekClick.EVENT_ID); + handler.weekClick(new WeekClick(calendarComponent, calendar + .get(GregorianCalendar.WEEK_OF_YEAR), calendar + .get(GregorianCalendar.YEAR))); + } + }); + + nextButton = new Button("Next", new Button.ClickListener() { + private static final long serialVersionUID = 1L; + + @Override + public void buttonClick(ClickEvent event) { + handleNextButtonClick(); + } + }); + + prevButton = new Button("Prev", new Button.ClickListener() { + private static final long serialVersionUID = 1L; + + @Override + public void buttonClick(ClickEvent event) { + handlePreviousButtonClick(); + } + }); + } + + private void initHideWeekEndButton() { + hideWeekendsButton = new CheckBox("Hide weekends"); + hideWeekendsButton.setImmediate(true); + hideWeekendsButton + .addValueChangeListener(new Property.ValueChangeListener() { + + private static final long serialVersionUID = 1L; + + @Override + public void valueChange(ValueChangeEvent event) { + setWeekendsHidden(hideWeekendsButton.getValue()); + } + }); + } + + private void setWeekendsHidden(boolean weekendsHidden) { + if (weekendsHidden) { + int firstToShow = (GregorianCalendar.MONDAY - calendar + .getFirstDayOfWeek()) % 7; + calendarComponent.setFirstVisibleDayOfWeek(firstToShow + 1); + calendarComponent.setLastVisibleDayOfWeek(firstToShow + 5); + } else { + calendarComponent.setFirstVisibleDayOfWeek(1); + calendarComponent.setLastVisibleDayOfWeek(7); + } + + } + + private void initReadOnlyButton() { + readOnlyButton = new CheckBox("Read-only mode"); + readOnlyButton.setImmediate(true); + readOnlyButton + .addValueChangeListener(new Property.ValueChangeListener() { + + private static final long serialVersionUID = 1L; + + @Override + public void valueChange(ValueChangeEvent event) { + calendarComponent.setReadOnly(readOnlyButton.getValue()); + } + }); + } + + private void initDisabledButton() { + disabledButton = new CheckBox("Disabled"); + disabledButton.setImmediate(true); + disabledButton + .addValueChangeListener(new Property.ValueChangeListener() { + + private static final long serialVersionUID = 1L; + + @Override + public void valueChange(ValueChangeEvent event) { + calendarComponent.setEnabled(!disabledButton.getValue()); + } + }); + } + + public void initAddNewEventButton() { + addNewEvent = new Button("Add new event"); + addNewEvent.addClickListener(new Button.ClickListener() { + + private static final long serialVersionUID = -8307244759142541067L; + + @Override + public void buttonClick(ClickEvent event) { + Date start = getToday(); + start.setHours(0); + start.setMinutes(0); + start.setSeconds(0); + + Date end = getEndOfDay(calendar, start); + + showEventPopup(createNewEvent(start, end), true); + } + }); + } + + private void initFormFields(Layout formLayout, + Class<? extends CalendarEvent> eventClass) { + + startDateField = createDateField("Start date"); + endDateField = createDateField("End date"); + + final CheckBox allDayField = createCheckBox("All-day"); + allDayField.addValueChangeListener(new Property.ValueChangeListener() { + + private static final long serialVersionUID = -7104996493482558021L; + + @Override + public void valueChange(ValueChangeEvent event) { + Object value = event.getProperty().getValue(); + if (value instanceof Boolean && Boolean.TRUE.equals(value)) { + setFormDateResolution(Resolution.DAY); + + } else { + setFormDateResolution(Resolution.MINUTE); + } + } + + }); + + captionField = createTextField("Caption"); + final TextField whereField = createTextField("Where"); + final TextArea descriptionField = createTextArea("Description"); + descriptionField.setRows(3); + + final ComboBox styleNameField = createStyleNameComboBox(); + + formLayout.addComponent(startDateField); + formLayout.addComponent(endDateField); + formLayout.addComponent(allDayField); + formLayout.addComponent(captionField); + if (eventClass == CalendarTestEvent.class) { + formLayout.addComponent(whereField); + } + formLayout.addComponent(descriptionField); + formLayout.addComponent(styleNameField); + + scheduleEventFieldGroup.bind(startDateField, "start"); + scheduleEventFieldGroup.bind(endDateField, "end"); + scheduleEventFieldGroup.bind(captionField, "caption"); + scheduleEventFieldGroup.bind(descriptionField, "description"); + if (eventClass == CalendarTestEvent.class) { + scheduleEventFieldGroup.bind(whereField, "where"); + } + scheduleEventFieldGroup.bind(styleNameField, "styleName"); + scheduleEventFieldGroup.bind(allDayField, "allDay"); + } + + private CheckBox createCheckBox(String caption) { + CheckBox cb = new CheckBox(caption); + cb.setImmediate(true); + return cb; + } + + private TextField createTextField(String caption) { + TextField f = new TextField(caption); + f.setNullRepresentation(""); + return f; + } + + private TextArea createTextArea(String caption) { + TextArea f = new TextArea(caption); + f.setNullRepresentation(""); + return f; + } + + private DateField createDateField(String caption) { + DateField f = new DateField(caption); + if (useSecondResolution) { + f.setResolution(Resolution.SECOND); + } else { + f.setResolution(Resolution.MINUTE); + } + return f; + } + + private ComboBox createStyleNameComboBox() { + ComboBox s = new ComboBox("Color"); + s.addContainerProperty("c", String.class, ""); + s.setItemCaptionPropertyId("c"); + Item i = s.addItem("color1"); + i.getItemProperty("c").setValue("Green"); + i = s.addItem("color2"); + i.getItemProperty("c").setValue("Blue"); + i = s.addItem("color3"); + i.getItemProperty("c").setValue("Red"); + i = s.addItem("color4"); + i.getItemProperty("c").setValue("Orange"); + return s; + } + + private void initCalendar() { + dataSource = new BasicEventProvider(); + + calendarComponent = new Calendar(dataSource); + calendarComponent.setLocale(getLocale()); + calendarComponent.setImmediate(true); + + if (calendarWidth != null || calendarHeight != null) { + if (calendarHeight != null) { + calendarComponent.setHeight(calendarHeight); + } + if (calendarWidth != null) { + calendarComponent.setWidth(calendarWidth); + } + } else { + calendarComponent.setSizeFull(); + } + + if (firstHour != null && lastHour != null) { + calendarComponent.setFirstVisibleHourOfDay(firstHour); + calendarComponent.setLastVisibleHourOfDay(lastHour); + } + + if (firstDay != null && lastDay != null) { + calendarComponent.setFirstVisibleDayOfWeek(firstDay); + calendarComponent.setLastVisibleDayOfWeek(lastDay); + } + + Date today = getToday(); + calendar = new GregorianCalendar(getLocale()); + calendar.setTime(today); + + updateCaptionLabel(); + + if (!showWeeklyView) { + int rollAmount = calendar.get(GregorianCalendar.DAY_OF_MONTH) - 1; + calendar.add(GregorianCalendar.DAY_OF_MONTH, -rollAmount); + resetTime(false); + currentMonthsFirstDate = calendar.getTime(); + calendarComponent.setStartDate(currentMonthsFirstDate); + calendar.add(GregorianCalendar.MONTH, 1); + calendar.add(GregorianCalendar.DATE, -1); + calendarComponent.setEndDate(calendar.getTime()); + } + + addCalendarEventListeners(); + } + + private Date getToday() { + if (testBench) { + GregorianCalendar testDate = new GregorianCalendar(); + testDate.set(GregorianCalendar.YEAR, 2000); + testDate.set(GregorianCalendar.MONTH, 0); + testDate.set(GregorianCalendar.DATE, 10); + testDate.set(GregorianCalendar.HOUR_OF_DAY, 0); + testDate.set(GregorianCalendar.MINUTE, 0); + testDate.set(GregorianCalendar.SECOND, 0); + testDate.set(GregorianCalendar.MILLISECOND, 0); + return testDate.getTime(); + } + return new Date(); + } + + @SuppressWarnings("serial") + private void addCalendarEventListeners() { + // Register week clicks by changing the schedules start and end dates. + calendarComponent.setHandler(new BasicWeekClickHandler() { + + @Override + public void weekClick(WeekClick event) { + // let BasicWeekClickHandler handle calendar dates, and update + // only the other parts of UI here + super.weekClick(event); + updateCaptionLabel(); + switchToWeekView(); + } + }); + + calendarComponent.setHandler(new EventClickHandler() { + + @Override + public void eventClick(EventClick event) { + showEventPopup(event.getCalendarEvent(), false); + } + }); + + calendarComponent.setHandler(new BasicDateClickHandler() { + + @Override + public void dateClick(DateClickEvent event) { + // let BasicDateClickHandler handle calendar dates, and update + // only the other parts of UI here + super.dateClick(event); + switchToDayView(); + } + }); + + calendarComponent.setHandler(new RangeSelectHandler() { + + @Override + public void rangeSelect(RangeSelectEvent event) { + handleRangeSelect(event); + } + }); + } + + private ComboBox createTimeZoneSelect() { + ComboBox s = new ComboBox("Timezone"); + s.addContainerProperty("caption", String.class, ""); + s.setItemCaptionPropertyId("caption"); + s.setFilteringMode(FilteringMode.CONTAINS); + + Item i = s.addItem(DEFAULT_ITEMID); + i.getItemProperty("caption").setValue( + "Default (" + TimeZone.getDefault().getID() + ")"); + for (String id : TimeZone.getAvailableIDs()) { + if (!s.containsId(id)) { + i = s.addItem(id); + i.getItemProperty("caption").setValue(id); + } + } + + if (testBench) { + s.select("America/New_York"); + } else { + s.select(DEFAULT_ITEMID); + } + s.setImmediate(true); + s.addValueChangeListener(new ValueChangeListener() { + + private static final long serialVersionUID = 1L; + + @Override + public void valueChange(ValueChangeEvent event) { + + updateCalendarTimeZone(event.getProperty().getValue()); + } + }); + + return s; + } + + private ComboBox createCalendarFormatSelect() { + ComboBox s = new ComboBox("Calendar format"); + s.addContainerProperty("caption", String.class, ""); + s.setItemCaptionPropertyId("caption"); + + Item i = s.addItem(DEFAULT_ITEMID); + i.getItemProperty("caption").setValue("Default by locale"); + i = s.addItem(TimeFormat.Format12H); + i.getItemProperty("caption").setValue("12H"); + i = s.addItem(TimeFormat.Format24H); + i.getItemProperty("caption").setValue("24H"); + + s.select(DEFAULT_ITEMID); + s.setImmediate(true); + s.addValueChangeListener(new ValueChangeListener() { + + private static final long serialVersionUID = 1L; + + @Override + public void valueChange(ValueChangeEvent event) { + updateCalendarFormat(event.getProperty().getValue()); + } + }); + + return s; + } + + private ComboBox createLocaleSelect() { + ComboBox s = new ComboBox("Locale"); + s.addContainerProperty("caption", String.class, ""); + s.setItemCaptionPropertyId("caption"); + s.setFilteringMode(FilteringMode.CONTAINS); + + for (Locale l : Locale.getAvailableLocales()) { + if (!s.containsId(l)) { + Item i = s.addItem(l); + i.getItemProperty("caption").setValue(getLocaleItemCaption(l)); + } + } + + s.select(getLocale()); + s.setImmediate(true); + s.addValueChangeListener(new ValueChangeListener() { + + private static final long serialVersionUID = 1L; + + @Override + public void valueChange(ValueChangeEvent event) { + updateCalendarLocale((Locale) event.getProperty().getValue()); + } + }); + + return s; + } + + private void updateCalendarTimeZone(Object timezoneId) { + TimeZone tz = null; + if (!DEFAULT_ITEMID.equals(timezoneId)) { + tz = TimeZone.getTimeZone((String) timezoneId); + } + + // remember the week that was showing, so we can re-set it later + Date startDate = calendarComponent.getStartDate(); + calendar.setTime(startDate); + int weekNumber = calendar.get(java.util.Calendar.WEEK_OF_YEAR); + calendarComponent.setTimeZone(tz); + calendar.setTimeZone(calendarComponent.getTimeZone()); + + if (viewMode == Mode.WEEK) { + calendar.set(java.util.Calendar.WEEK_OF_YEAR, weekNumber); + calendar.set(java.util.Calendar.DAY_OF_WEEK, + calendar.getFirstDayOfWeek()); + + calendarComponent.setStartDate(calendar.getTime()); + calendar.add(java.util.Calendar.DATE, 6); + calendarComponent.setEndDate(calendar.getTime()); + } + } + + private void updateCalendarFormat(Object format) { + TimeFormat calFormat = null; + if (format instanceof TimeFormat) { + calFormat = (TimeFormat) format; + } + + calendarComponent.setTimeFormat(calFormat); + } + + private String getLocaleItemCaption(Locale l) { + String country = l.getDisplayCountry(getLocale()); + String language = l.getDisplayLanguage(getLocale()); + StringBuilder caption = new StringBuilder(country); + if (caption.length() != 0) { + caption.append(", "); + } + caption.append(language); + return caption.toString(); + } + + private void updateCalendarLocale(Locale l) { + int oldFirstDayOfWeek = calendar.getFirstDayOfWeek(); + setLocale(l); + calendarComponent.setLocale(l); + calendar = new GregorianCalendar(l); + int newFirstDayOfWeek = calendar.getFirstDayOfWeek(); + + // we are showing 1 week, and the first day of the week has changed + // update start and end dates so that the same week is showing + if (viewMode == Mode.WEEK && oldFirstDayOfWeek != newFirstDayOfWeek) { + calendar.setTime(calendarComponent.getStartDate()); + calendar.add(java.util.Calendar.DAY_OF_WEEK, 2); + // starting at the beginning of the week + calendar.set(GregorianCalendar.DAY_OF_WEEK, newFirstDayOfWeek); + Date start = calendar.getTime(); + + // ending at the end of the week + calendar.add(GregorianCalendar.DATE, 6); + Date end = calendar.getTime(); + + calendarComponent.setStartDate(start); + calendarComponent.setEndDate(end); + + // Week days depend on locale so this must be refreshed + setWeekendsHidden(hideWeekendsButton.getValue()); + } + + } + + private void handleNextButtonClick() { + switch (viewMode) { + case MONTH: + nextMonth(); + break; + case WEEK: + nextWeek(); + break; + case DAY: + nextDay(); + break; + } + } + + private void handlePreviousButtonClick() { + switch (viewMode) { + case MONTH: + previousMonth(); + break; + case WEEK: + previousWeek(); + break; + case DAY: + previousDay(); + break; + } + } + + private void handleRangeSelect(RangeSelectEvent event) { + Date start = event.getStart(); + Date end = event.getEnd(); + + /* + * If a range of dates is selected in monthly mode, we want it to end at + * the end of the last day. + */ + if (event.isMonthlyMode()) { + end = getEndOfDay(calendar, end); + } + + showEventPopup(createNewEvent(start, end), true); + } + + private void showEventPopup(CalendarEvent event, boolean newEvent) { + if (event == null) { + return; + } + + updateCalendarEventPopup(newEvent); + updateCalendarEventForm(event); + + if (!getWindows().contains(scheduleEventPopup)) { + addWindow(scheduleEventPopup); + } + } + + /* Initializes a modal window to edit schedule event. */ + private void createCalendarEventPopup() { + VerticalLayout layout = new VerticalLayout(); + layout.setMargin(true); + layout.setSpacing(true); + + scheduleEventPopup = new Window(null, layout); + scheduleEventPopup.setWidth("400px"); + scheduleEventPopup.setModal(true); + scheduleEventPopup.center(); + + layout.addComponent(scheduleEventFieldLayout); + + applyEventButton = new Button("Apply", new ClickListener() { + + private static final long serialVersionUID = 1L; + + @Override + public void buttonClick(ClickEvent event) { + try { + commitCalendarEvent(); + } catch (CommitException e) { + e.printStackTrace(); + } + } + }); + Button cancel = new Button("Cancel", new ClickListener() { + + private static final long serialVersionUID = 1L; + + @Override + public void buttonClick(ClickEvent event) { + discardCalendarEvent(); + } + }); + deleteEventButton = new Button("Delete", new ClickListener() { + + private static final long serialVersionUID = 1L; + + @Override + public void buttonClick(ClickEvent event) { + deleteCalendarEvent(); + } + }); + scheduleEventPopup.addCloseListener(new Window.CloseListener() { + + private static final long serialVersionUID = 1L; + + @Override + public void windowClose(Window.CloseEvent e) { + discardCalendarEvent(); + } + }); + + HorizontalLayout buttons = new HorizontalLayout(); + buttons.setSpacing(true); + buttons.addComponent(deleteEventButton); + buttons.addComponent(applyEventButton); + buttons.addComponent(cancel); + layout.addComponent(buttons); + layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT); + } + + private void updateCalendarEventPopup(boolean newEvent) { + if (scheduleEventPopup == null) { + createCalendarEventPopup(); + } + + if (newEvent) { + scheduleEventPopup.setCaption("New event"); + } else { + scheduleEventPopup.setCaption("Edit event"); + } + + deleteEventButton.setVisible(!newEvent); + deleteEventButton.setEnabled(!calendarComponent.isReadOnly()); + applyEventButton.setEnabled(!calendarComponent.isReadOnly()); + } + + private void updateCalendarEventForm(CalendarEvent event) { + BeanItem<CalendarEvent> item = new BeanItem<CalendarEvent>(event); + scheduleEventFieldLayout.removeAllComponents(); + scheduleEventFieldGroup = new FieldGroup(); + initFormFields(scheduleEventFieldLayout, event.getClass()); + scheduleEventFieldGroup.setBuffered(true); + scheduleEventFieldGroup.setItemDataSource(item); + } + + private void setFormDateResolution(Resolution resolution) { + if (startDateField != null && endDateField != null) { + startDateField.setResolution(resolution); + endDateField.setResolution(resolution); + } + } + + private CalendarEvent createNewEvent(Date startDate, Date endDate) { + + BasicEvent event = new BasicEvent(); + event.setCaption(""); + event.setStart(startDate); + event.setEnd(endDate); + event.setStyleName("color1"); + return event; + } + + /* Removes the event from the data source and fires change event. */ + private void deleteCalendarEvent() { + BasicEvent event = getFormCalendarEvent(); + if (dataSource.containsEvent(event)) { + dataSource.removeEvent(event); + } + removeWindow(scheduleEventPopup); + } + + /* Adds/updates the event in the data source and fires change event. */ + private void commitCalendarEvent() throws CommitException { + scheduleEventFieldGroup.commit(); + BasicEvent event = getFormCalendarEvent(); + if (event.getEnd() == null) { + event.setEnd(event.getStart()); + } + if (!dataSource.containsEvent(event)) { + dataSource.addEvent(event); + } + + removeWindow(scheduleEventPopup); + } + + private void discardCalendarEvent() { + scheduleEventFieldGroup.discard(); + removeWindow(scheduleEventPopup); + } + + @SuppressWarnings("unchecked") + private BasicEvent getFormCalendarEvent() { + BeanItem<CalendarEvent> item = (BeanItem<CalendarEvent>) scheduleEventFieldGroup + .getItemDataSource(); + CalendarEvent event = item.getBean(); + return (BasicEvent) event; + } + + private void nextMonth() { + rollMonth(1); + } + + private void previousMonth() { + rollMonth(-1); + } + + private void nextWeek() { + rollWeek(1); + } + + private void previousWeek() { + rollWeek(-1); + } + + private void nextDay() { + rollDate(1); + } + + private void previousDay() { + rollDate(-1); + } + + private void rollMonth(int direction) { + calendar.setTime(currentMonthsFirstDate); + calendar.add(GregorianCalendar.MONTH, direction); + resetTime(false); + currentMonthsFirstDate = calendar.getTime(); + calendarComponent.setStartDate(currentMonthsFirstDate); + + updateCaptionLabel(); + + calendar.add(GregorianCalendar.MONTH, 1); + calendar.add(GregorianCalendar.DATE, -1); + resetCalendarTime(true); + } + + private void rollWeek(int direction) { + calendar.add(GregorianCalendar.WEEK_OF_YEAR, direction); + calendar.set(GregorianCalendar.DAY_OF_WEEK, + calendar.getFirstDayOfWeek()); + resetCalendarTime(false); + resetTime(true); + calendar.add(GregorianCalendar.DATE, 6); + calendarComponent.setEndDate(calendar.getTime()); + } + + private void rollDate(int direction) { + calendar.add(GregorianCalendar.DATE, direction); + resetCalendarTime(false); + resetCalendarTime(true); + } + + private void updateCaptionLabel() { + DateFormatSymbols s = new DateFormatSymbols(getLocale()); + String month = s.getShortMonths()[calendar.get(GregorianCalendar.MONTH)]; + captionLabel.setValue(month + " " + + calendar.get(GregorianCalendar.YEAR)); + } + + private CalendarTestEvent getNewEvent(String caption, Date start, Date end) { + CalendarTestEvent event = new CalendarTestEvent(); + event.setCaption(caption); + event.setStart(start); + event.setEnd(end); + + return event; + } + + /* + * Switch the view to week view. + */ + public void switchToWeekView() { + viewMode = Mode.WEEK; + weekButton.setVisible(false); + monthButton.setVisible(true); + } + + /* + * Switch the Calendar component's start and end date range to the target + * month only. (sample range: 01.01.2010 00:00.000 - 31.01.2010 23:59.999) + */ + public void switchToMonthView() { + viewMode = Mode.MONTH; + monthButton.setVisible(false); + weekButton.setVisible(false); + + calendar.setTime(currentMonthsFirstDate); + calendarComponent.setStartDate(currentMonthsFirstDate); + + updateCaptionLabel(); + + calendar.add(GregorianCalendar.MONTH, 1); + calendar.add(GregorianCalendar.DATE, -1); + resetCalendarTime(true); + } + + /* + * Switch to day view (week view with a single day visible). + */ + public void switchToDayView() { + viewMode = Mode.DAY; + monthButton.setVisible(true); + weekButton.setVisible(true); + } + + private void resetCalendarTime(boolean resetEndTime) { + resetTime(resetEndTime); + if (resetEndTime) { + calendarComponent.setEndDate(calendar.getTime()); + } else { + calendarComponent.setStartDate(calendar.getTime()); + updateCaptionLabel(); + } + } + + /* + * Resets the calendar time (hour, minute second and millisecond) either to + * zero or maximum value. + */ + private void resetTime(boolean max) { + if (max) { + calendar.set(GregorianCalendar.HOUR_OF_DAY, + calendar.getMaximum(GregorianCalendar.HOUR_OF_DAY)); + calendar.set(GregorianCalendar.MINUTE, + calendar.getMaximum(GregorianCalendar.MINUTE)); + calendar.set(GregorianCalendar.SECOND, + calendar.getMaximum(GregorianCalendar.SECOND)); + calendar.set(GregorianCalendar.MILLISECOND, + calendar.getMaximum(GregorianCalendar.MILLISECOND)); + } else { + calendar.set(GregorianCalendar.HOUR_OF_DAY, 0); + calendar.set(GregorianCalendar.MINUTE, 0); + calendar.set(GregorianCalendar.SECOND, 0); + calendar.set(GregorianCalendar.MILLISECOND, 0); + } + } + + private static Date getEndOfDay(java.util.Calendar calendar, Date date) { + java.util.Calendar calendarClone = (java.util.Calendar) calendar + .clone(); + + calendarClone.setTime(date); + calendarClone.set(java.util.Calendar.MILLISECOND, + calendarClone.getActualMaximum(java.util.Calendar.MILLISECOND)); + calendarClone.set(java.util.Calendar.SECOND, + calendarClone.getActualMaximum(java.util.Calendar.SECOND)); + calendarClone.set(java.util.Calendar.MINUTE, + calendarClone.getActualMaximum(java.util.Calendar.MINUTE)); + calendarClone.set(java.util.Calendar.HOUR, + calendarClone.getActualMaximum(java.util.Calendar.HOUR)); + calendarClone.set(java.util.Calendar.HOUR_OF_DAY, + calendarClone.getActualMaximum(java.util.Calendar.HOUR_OF_DAY)); + + return calendarClone.getTime(); + } + + private static Date getStartOfDay(java.util.Calendar calendar, Date date) { + java.util.Calendar calendarClone = (java.util.Calendar) calendar + .clone(); + + calendarClone.setTime(date); + calendarClone.set(java.util.Calendar.MILLISECOND, 0); + calendarClone.set(java.util.Calendar.SECOND, 0); + calendarClone.set(java.util.Calendar.MINUTE, 0); + calendarClone.set(java.util.Calendar.HOUR, 0); + calendarClone.set(java.util.Calendar.HOUR_OF_DAY, 0); + + return calendarClone.getTime(); + } +} diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarTestEvent.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarTestEvent.java new file mode 100644 index 0000000000..29b8f62403 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarTestEvent.java @@ -0,0 +1,48 @@ +/* + * Copyright 2000-2013 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.calendar; + +import com.vaadin.ui.components.calendar.event.BasicEvent; + +/** + * Test CalendarEvent implementation. + * + * @see com.vaadin.addon.calendar.test.ui.Calendar.Event + */ +public class CalendarTestEvent extends BasicEvent { + + private static final long serialVersionUID = 2820133201983036866L; + private String where; + private Object data; + + public String getWhere() { + return where; + } + + public void setWhere(String where) { + this.where = where; + fireEventChange(); + } + + public Object getData() { + return data; + } + + public void setData(Object data) { + this.data = data; + fireEventChange(); + } +} diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarVisibleHours24H.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarVisibleHours24H.html new file mode 100644 index 0000000000..6b7bb26b76 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarVisibleHours24H.html @@ -0,0 +1,46 @@ +<?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>visibleHours24H</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">visibleHours24H</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&firstDay=1&lastDay=5&firstHour=8&lastHour=16&restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td> + <td>9,55</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[2]/VFilterSelect[0]#button</td> + <td>14,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[4]/td</td> + <td>120,15</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>9:00</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]</td> + <td>16:00</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html new file mode 100644 index 0000000000..fd51a0daad --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html @@ -0,0 +1,657 @@ +<?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>weeklyViewNewEvents</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">weeklyViewNewEvents</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&width=1000px&height=600px&restartApplication</td> + <td></td> +</tr> +<!--Go to weekly view--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> + <td>3,49</td> +</tr> +<!--Assert the default event contents--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[48]/domChild[0]/domChild[0]</td> + <td>26,5</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/10/00 09:30 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/10/00 02:00 PM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td> + <td>off</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Appointment</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[1]</td> + <td>Office</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>A longer description, which should display correctly.</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Green</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[0]/domChild[0]</td> + <td>21,12</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/11/00 11:00 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/11/00 07:00 PM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Training</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Blue</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]/domChild[48]/domChild[0]/domChild[0]</td> + <td>19,9</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/15/00 09:00 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/15/00 06:00 PM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Free time</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[6]/domChild[0]/domChild[0]</td> + <td>22,6</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/9/00</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/15/00</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td> + <td>on</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Whole week event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Description for the whole week event.</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Orange</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Assert the all-day events--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[1]</td> + <td>78,3</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/12/00</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/12/00</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Allday event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Some description.</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Red</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[4]/domChild[0]/domChild[1]</td> + <td>57,7</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/13/00</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/13/00</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Second allday event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Some description.</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Blue</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Enter new event--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/13/00 9:00 AM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/13/00 2:00 PM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Test event description</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[1]</td> + <td>3,15</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item4</td> + <td>36,6</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Assert previously created event--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[5]/domChild[0]/domChild[48]/domChild[0]</td> + <td>47,21</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/13/00 09:00 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/13/00 02:00 PM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Test event description</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>Orange</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>8,9</td> +</tr> +<!--Edit previously created events and change properties--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[5]/domChild[0]/domChild[48]/domChild[0]</td> + <td>33,16</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#popupButton</td> + <td>10,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VOverlay[0]/VCalendarPanel[0]#day11</td> + <td>16,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#popupButton</td> + <td>14,14</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VOverlay[0]/VCalendarPanel[0]#day11</td> + <td>14,10</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Assert the edited values--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[49]/domChild[0]</td> + <td>34,21</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/11/00 09:00 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/11/00 02:00 PM</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Create new event--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/11/00 10:00 AM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/11/00 8:00 PM</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event 2</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td> + <td>Second test event</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Assert previously created event still exists in the right place (as multiple events occupy the same time)--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[50]/domChild[0]</td> + <td>7,73</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/11/00 09:00 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/11/00 02:00 PM</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Assert previously created event still exists in the right place (as multiple events occupy the same time)--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[49]/domChild[0]/domChild[0]</td> + <td>12,32</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/11/00 11:00 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/11/00 07:00 PM</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>11,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[1]</td> + <td>4,9</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/11/00 10:00 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/11/00 08:00 PM</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[50]/domChild[0]</td> + <td>14,71</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/11/00 09:00 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/11/00 02:00 PM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[0]</td> + <td>16,111</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/11/00 10:00 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/11/00 08:00 PM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event 2</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[0]</td> + <td>14,209</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/11/00 10:00 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/11/00 08:00 PM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event 2</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[49]/domChild[0]/domChild[0]</td> + <td>20,113</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/11/00 11:00 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/11/00 07:00 PM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Training</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>7,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[50]/domChild[0]</td> + <td>21,87</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td> + <td>1/11/00 09:00 AM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td> + <td>1/11/00 02:00 PM</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>12,10</td> +</tr> +<!--Go to monthly view and assert inserted events--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[2]/domChild[0]/domChild[4]</td> + <td>36,10</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[2]/domChild[0]/domChild[3]</td> + <td>53,6</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Training</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[2]/domChild[0]/domChild[2]/domChild[0]</td> + <td>48,7</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Test event 2</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[4]/domChild[0]/domChild[1]</td> + <td>50,6</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> + <td>Whole week event</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/calendar/HiddenFwdBackButtons.java b/uitest/src/com/vaadin/tests/components/calendar/HiddenFwdBackButtons.java new file mode 100644 index 0000000000..8b789098e6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/HiddenFwdBackButtons.java @@ -0,0 +1,61 @@ +/* + * Copyright 2000-2013 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.calendar; + +import java.util.Date; +import java.util.Locale; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Calendar; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.UI; +import com.vaadin.ui.components.calendar.CalendarComponentEvents.BackwardHandler; +import com.vaadin.ui.components.calendar.CalendarComponentEvents.ForwardHandler; + +public class HiddenFwdBackButtons extends UI { + + @SuppressWarnings("deprecation") + @Override + protected void init(VaadinRequest request) { + GridLayout content = new GridLayout(1, 2); + content.setSizeFull(); + setContent(content); + + final Calendar calendar = new Calendar(); + calendar.setLocale(new Locale("fi", "FI")); + + calendar.setSizeFull(); + calendar.setStartDate(new Date(100, 1, 1)); + calendar.setEndDate(new Date(100, 1, 7)); + content.addComponent(calendar); + Button button = new Button("Hide forward and back buttons"); + button.addClickListener(new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + // This should hide the forward and back navigation buttons + calendar.setHandler((BackwardHandler) null); + calendar.setHandler((ForwardHandler) null); + } + }); + content.addComponent(button); + + content.setRowExpandRatio(0, 1); + + } +} diff --git a/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java b/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java new file mode 100644 index 0000000000..6e5718a652 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java @@ -0,0 +1,104 @@ +/* + * Copyright 2000-2013 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.calendar; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Locale; + +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Calendar; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Notification; +import com.vaadin.ui.UI; +import com.vaadin.ui.components.calendar.CalendarComponentEvents.DateClickEvent; +import com.vaadin.ui.components.calendar.CalendarComponentEvents.DateClickHandler; +import com.vaadin.ui.components.calendar.event.BasicEvent; +import com.vaadin.ui.components.calendar.event.CalendarEvent; +import com.vaadin.ui.components.calendar.event.CalendarEventProvider; + +public class NotificationTestUI extends UI { + + private DummyEventProvider provider; + + private static class DummyEventProvider implements CalendarEventProvider { + + private int index; + private List<CalendarEvent> events = new ArrayList<CalendarEvent>(); + + public void addEvent(Date date) { + BasicEvent e = new BasicEvent(); + e.setAllDay(true); + e.setStart(date); + e.setEnd(date); + e.setCaption("Some event " + ++index); + events.add(e); + } + + @Override + public List<CalendarEvent> getEvents(Date startDate, Date endDate) { + return events; + } + + } + + @Override + protected void init(com.vaadin.server.VaadinRequest request) { + GridLayout content = new GridLayout(1, 2); + content.setSizeFull(); + content.setRowExpandRatio(1, 1.0f); + setContent(content); + final Button btn = new Button("Show working notification", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + Notification + .show("This will disappear when you move your mouse!"); + } + }); + content.addComponent(btn); + + provider = new DummyEventProvider(); + final Calendar cal = new Calendar(provider); + cal.setLocale(Locale.US); + cal.setSizeFull(); + cal.setHandler(new DateClickHandler() { + @Override + public void dateClick(DateClickEvent event) { + provider.addEvent(event.getDate()); + Notification + .show("This should disappear, but if wont unless clicked."); + + // this requestRepaint call interferes with the notification + cal.markAsDirty(); + } + }); + content.addComponent(cal); + + java.util.Calendar javaCal = java.util.Calendar.getInstance(); + javaCal.set(java.util.Calendar.YEAR, 2000); + javaCal.set(java.util.Calendar.MONTH, 0); + javaCal.set(java.util.Calendar.DAY_OF_MONTH, 1); + Date start = javaCal.getTime(); + javaCal.set(java.util.Calendar.DAY_OF_MONTH, 31); + Date end = javaCal.getTime(); + + cal.setStartDate(start); + cal.setEndDate(end); + } +} diff --git a/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java b/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java index 5b086fb935..cc26cf8845 100644 --- a/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java +++ b/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java @@ -29,6 +29,7 @@ public class CheckBoxRevertValueChange extends AbstractTestUIWithLog { final CheckBox alwaysUnchecked = new CheckBox("You may not check me"); alwaysUnchecked .addValueChangeListener(new Property.ValueChangeListener() { + @Override public void valueChange(Property.ValueChangeEvent event) { if (alwaysUnchecked.getValue()) { log("I said no checking!"); @@ -40,6 +41,7 @@ public class CheckBoxRevertValueChange extends AbstractTestUIWithLog { alwaysChecked.setValue(true); alwaysChecked .addValueChangeListener(new Property.ValueChangeListener() { + @Override public void valueChange(Property.ValueChangeEvent event) { if (!alwaysChecked.getValue()) { log("I said no unchecking!"); diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java index 3c1e8a27d6..bd71850a89 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java @@ -38,6 +38,7 @@ public class ComboBoxDuplicateCaption extends TestBase { box.setImmediate(true); box.addValueChangeListener(new ValueChangeListener() { + @Override public void valueChange( com.vaadin.data.Property.ValueChangeEvent event) { Person p = (Person) event.getProperty().getValue(); diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSQLContainerFilteredValueChange.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSQLContainerFilteredValueChange.java index 23a75ae56e..75010f0ea9 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSQLContainerFilteredValueChange.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSQLContainerFilteredValueChange.java @@ -53,6 +53,7 @@ public class ComboBoxSQLContainerFilteredValueChange extends TestBase { myCombo.setWidth("100.0%"); myCombo.setHeight("-1px"); myCombo.addListener(new Property.ValueChangeListener() { + @Override public void valueChange(ValueChangeEvent event) { selectedLabel.setValue("Selected: " + event.getProperty().getValue()); @@ -72,6 +73,7 @@ public class ComboBoxSQLContainerFilteredValueChange extends TestBase { /** * (Re)creates the test table + * * @param connectionPool */ private void createTestTable(JDBCConnectionPool connectionPool) { @@ -97,6 +99,7 @@ public class ComboBoxSQLContainerFilteredValueChange extends TestBase { /** * Adds test data to the test table + * * @param connectionPool * @throws SQLException */ @@ -111,7 +114,7 @@ public class ComboBoxSQLContainerFilteredValueChange extends TestBase { statement.executeUpdate("INSERT INTO mytable VALUES(2, 'A1')"); statement.executeUpdate("INSERT INTO mytable VALUES(3, 'B0')"); statement.executeUpdate("INSERT INTO mytable VALUES(4, 'B1')"); - + statement.close(); conn.commit(); } catch (SQLException e) { diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldLocale.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldLocale.java index 5d06895d11..a4fe2b0285 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldLocale.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldLocale.java @@ -16,7 +16,7 @@ public class DateFieldLocale extends TestBase { final DateField dateField = new DateField("DateField"); dateField.setLocale(new Locale("fi", "FI")); dateField.setCaption(dateField.getLocale().toString()); - dateField.setValue(new Date()); + dateField.setValue(new Date(2013 - 1900, 7 - 1, 27)); dateField.setResolution(DateField.RESOLUTION_DAY); addComponent(new Button("Change locale", new ClickListener() { diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.html index 31216ed1b0..38034fd0c8 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.html +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.html @@ -68,12 +68,12 @@ </tr> <tr> <td>assertCSSClass</td> - <td>//body/div[last()]/div[last()]</td> + <td>//body/div[2]/div[last()]</td> <td>my-datefield-popup</td> </tr> <tr> <td>assertCSSClass</td> - <td>//body/div[last()]/div[last()]</td> + <td>//body/div[2]/div[last()]</td> <td>my-datefield-day</td> </tr> <tr> @@ -188,12 +188,12 @@ </tr> <tr> <td>assertCSSClass</td> - <td>//body/div[last()]/div[last()]</td> + <td>//body/div[2]/div[last()]</td> <td>my-second-datefield-popup</td> </tr> <tr> <td>assertCSSClass</td> - <td>//body/div[last()]/div[last()]</td> + <td>//body/div[2]/div[last()]</td> <td>my-second-datefield-day</td> </tr> <tr> diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges.java new file mode 100644 index 0000000000..2daa3e3f96 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges.java @@ -0,0 +1,270 @@ +package com.vaadin.tests.components.datefield; + +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.MarginInfo; +import com.vaadin.shared.ui.datefield.Resolution; +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.DateField; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.InlineDateField; +import com.vaadin.ui.Label; +import com.vaadin.ui.NativeSelect; +import com.vaadin.ui.VerticalLayout; + +public class DateFieldRanges extends AbstractTestUI { + + @Override + protected Integer getTicketNumber() { + return 6241; + } + + private Label label = new Label(); + private NativeSelect resoSelect = new NativeSelect("Resolution"); + private DateField fromRange = new DateField("Range start"); + private DateField toRange = new DateField("Range end"); + private DateField valueDF = new DateField("Value"); + private CheckBox immediateCB = new CheckBox("Immediate"); + private Button recreate = new Button("Recreate static datefields"); + private Button clearRangeButton = new Button("Clear range"); + + private GridLayout currentStaticContainer; + + private DateField inlineDynamicDateField; + private DateField dynamicDateField; + + private Calendar createCalendar() { + Calendar c = Calendar.getInstance(); + c.set(2013, 3, 26, 6, 1, 12); + return c; + } + + private Date newDate() { + return createCalendar().getTime(); + } + + private void initializeControlFields() { + resoSelect.addItem(Resolution.MINUTE); + resoSelect.addItem(Resolution.SECOND); + resoSelect.addItem(Resolution.HOUR); + resoSelect.addItem(Resolution.DAY); + resoSelect.addItem(Resolution.MONTH); + resoSelect.addItem(Resolution.YEAR); + resoSelect.setImmediate(true); + resoSelect.setValue(Resolution.DAY); + resoSelect.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + + Resolution r = (Resolution) resoSelect.getValue(); + inlineDynamicDateField.setResolution(r); + dynamicDateField.setResolution(r); + + } + }); + + fromRange.setValue(null); + fromRange.setImmediate(true); + fromRange.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + + inlineDynamicDateField.setRangeStart(fromRange.getValue()); + dynamicDateField.setRangeStart(fromRange.getValue()); + + } + }); + + toRange.setValue(null); + toRange.setImmediate(true); + toRange.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + + inlineDynamicDateField.setRangeEnd(toRange.getValue()); + dynamicDateField.setRangeEnd(toRange.getValue()); + + } + }); + + valueDF.setValue(null); + valueDF.setImmediate(true); + valueDF.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + + inlineDynamicDateField.setValue(valueDF.getValue()); + dynamicDateField.setValue(valueDF.getValue()); + + } + }); + + immediateCB.setValue(true); + immediateCB.setImmediate(true); + immediateCB.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + + inlineDynamicDateField.setImmediate(immediateCB.getValue()); + dynamicDateField.setImmediate(immediateCB.getValue()); + + } + }); + + recreate.addClickListener(new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + GridLayout newContainer = createStaticFields(); + replaceComponent(currentStaticContainer, newContainer); + currentStaticContainer = newContainer; + } + }); + + clearRangeButton.addClickListener(new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + fromRange.setValue(null); + toRange.setValue(null); + } + }); + + Calendar startCal = createCalendar(); + Calendar endCal = createCalendar(); + endCal.add(Calendar.DATE, 30); + + dynamicDateField = createDateField(startCal.getTime(), + endCal.getTime(), null, Resolution.DAY, false); + inlineDynamicDateField = createDateField(startCal.getTime(), + endCal.getTime(), null, Resolution.DAY, true); + + resoSelect.setId("resoSelect"); + fromRange.setId("fromRange"); + toRange.setId("toRange"); + valueDF.setId("valueDF"); + immediateCB.setId("immediateCB"); + recreate.setId("recreate"); + clearRangeButton.setId("clearRangeButton"); + dynamicDateField.setId("dynamicDateField"); + inlineDynamicDateField.setId("inlineDynamicDateField"); + + } + + @Override + protected void setup(VaadinRequest request) { + setLocale(new Locale("en", "US")); + getLayout().setWidth(100, Unit.PERCENTAGE); + getLayout().setHeight(null); + getLayout().setMargin(new MarginInfo(true, false, false, false)); + getLayout().setSpacing(true); + + initializeControlFields(); + + GridLayout gl = new GridLayout(2, 2); + gl.setSpacing(true); + + gl.addComponent(dynamicDateField); + gl.addComponent(inlineDynamicDateField); + + HorizontalLayout hl = new HorizontalLayout(); + hl.setSpacing(true); + hl.addComponent(resoSelect); + hl.addComponent(fromRange); + hl.addComponent(toRange); + hl.addComponent(valueDF); + hl.addComponent(immediateCB); + hl.addComponent(recreate); + hl.addComponent(clearRangeButton); + addComponent(hl); + addComponent(new Label("Dynamic DateFields")); + addComponent(gl); + currentStaticContainer = createStaticFields(); + addComponent(new Label("Static DateFields")); + addComponent(currentStaticContainer); + + addComponent(label); + + } + + private GridLayout createStaticFields() { + Calendar startCal = createCalendar(); + Calendar endCal = createCalendar(); + endCal.add(Calendar.DATE, 30); + GridLayout gl = new GridLayout(2, 2); + gl.setSpacing(true); + DateField df = createDateField(startCal.getTime(), endCal.getTime(), + null, Resolution.DAY, false); + gl.addComponent(df); + DateField inline = createDateField(startCal.getTime(), + endCal.getTime(), null, Resolution.DAY, true); + gl.addComponent(inline); + inline.setId("staticInline"); + VerticalLayout vl = new VerticalLayout(); + + return gl; + } + + private DateField createDateField(Date rangeStart, Date rangeEnd, + Date value, Resolution resolution, boolean inline) { + + DateField df = null; + + if (inline) { + df = new InlineDateField(); + } else { + df = new DateField(); + } + + final DateField gg = df; + updateValuesForDateField(df); + + df.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + label.setValue((gg.getValue() == null ? "Nothing" : gg + .getValue().toString()) + + " selected. isValid: " + + gg.isValid()); + } + }); + return df; + } + + @Override + protected String getTestDescription() { + return "Not defined yet"; + + } + + private void updateValuesForDateField(DateField df) { + Date fromVal = fromRange.getValue(); + Date toVal = toRange.getValue(); + Date value = valueDF.getValue(); + Resolution r = (Resolution) resoSelect.getValue(); + boolean immediate = immediateCB.getValue(); + + df.setValue(value); + df.setResolution(r); + df.setRangeStart(fromVal); + df.setRangeEnd(toVal); + df.setImmediate(immediate); + + } + +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_ChangingRangeSoValueFallsOutsideRangeCausesOutOfRangeExceptionIfImmediateField.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_ChangingRangeSoValueFallsOutsideRangeCausesOutOfRangeExceptionIfImmediateField.html new file mode 100644 index 0000000000..ca5c006e82 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_ChangingRangeSoValueFallsOutsideRangeCausesOutOfRangeExceptionIfImmediateField.html @@ -0,0 +1,186 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.datefield.DateFieldRanges?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>59,10</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>4/4/13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>36,13</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>2/2/13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>48,13</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>5/5/13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>50,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[8]</td> + <td>12,14</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::PID_SinlineDynamicDateField/VCalendarPanel[0]#header</td> + <td>April 2013</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#popupButton</td> + <td>14,15</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[15]</td> + <td>14,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[15]</td> + <td>14,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[4]/span</td> + <td>18,12</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>v-errorindicator</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::PID_SinlineDynamicDateField/VCalendarPanel[0]#header</td> + <td>March 2013</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertTextNotPresent</td> + <td>April 2013</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[7]</td> + <td>15,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[7]</td> + <td>15,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[6]</td> + <td>14,14</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[12]</td> + <td>18,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[12]</td> + <td>12,10</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[11]</td> + <td>17,14</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>February 2013</td> + <td></td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>v-errorindicator</td> +</tr> +<tr> + <td>mouseClick</td> + <td>//div[@id='staticInline']/table/tbody/tr[2]/td/table/tbody/tr[2]/td[5]/span</td> + <td>14,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>//div[@id='inlineDynamicDateField']/table/tbody/tr[2]/td/table/tbody/tr[2]/td[5]/span</td> + <td>15,6</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>v-errorindicator</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>v-errorindicator</td> +</tr> +<tr> + <td>mouseClick</td> + <td>//div[@id='staticInline']/table/tbody/tr[2]/td/table/tbody/tr[2]/td[8]/span</td> + <td>14,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>//div[@id='inlineDynamicDateField']/table/tbody/tr[2]/td/table/tbody/tr[2]/td[8]/span</td> + <td>19,4</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>v-errorindicator</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>v-errorindicator</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_EndRangeEarlierThanStartRangeCausesException.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_EndRangeEarlierThanStartRangeCausesException.html new file mode 100644 index 0000000000..b19f519cb1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_EndRangeEarlierThanStartRangeCausesException.html @@ -0,0 +1,91 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.datefield.DateFieldRanges?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>44,6</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>4</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>4</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>4/4/13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>41,14</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>3</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>3</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>3/3/13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>33,9</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/domChild[0]/domChild[0]/domChild[1]</td> + <td>v-errorindicator</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_InitialDatesOutsideRange.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_InitialDatesOutsideRange.html new file mode 100644 index 0000000000..eeeda5270b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_InitialDatesOutsideRange.html @@ -0,0 +1,121 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.datefield.DateFieldRanges</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>39,14</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>1</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>1</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>1/1/13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>31,13</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>1</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>2</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>1/2/11</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>111</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>1</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>1/1/10</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>52,12</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[5]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>v-errorindicator</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_MonthChangeMeansFocusDayRolledInsideRange.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_MonthChangeMeansFocusDayRolledInsideRange.html new file mode 100644 index 0000000000..6e1ca024cb --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_MonthChangeMeansFocusDayRolledInsideRange.html @@ -0,0 +1,100 @@ +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.datefield.DateFieldRanges</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>27,11</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>1</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>1</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>1/1/10</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>47,10</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>2</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>2</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>2/2/10</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>15,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VGridLayout[0]/VPopupCalendar[0]#popupButton</td> + <td>9,14</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>id=PID_VAADIN_POPUPCAL</td> + <td>left</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>id=PID_VAADIN_POPUPCAL</td> + <td>left</td> +</tr> +<tr> + <td>assertText</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[3]/span</td> + <td>January 2010</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>id=PID_VAADIN_POPUPCAL</td> + <td>right</td> +</tr> +<tr> + <td>assertText</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[3]/span</td> + <td>February 2010</td> +</tr> diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_NextYearClickableIfRangeAcceptsFractionOfNextYear.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_NextYearClickableIfRangeAcceptsFractionOfNextYear.html new file mode 100644 index 0000000000..f5d7ee97ca --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_NextYearClickableIfRangeAcceptsFractionOfNextYear.html @@ -0,0 +1,191 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.datefield.DateFieldRanges</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>37,13</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>1</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>1</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>1/1/15</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>35,7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>12</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>12</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>12/12/14</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>40,10</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>December 2014</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[8]</td> + <td>11,8</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>January 2015</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[7]</td> + <td>13,10</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>January 2015</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[8]</td> + <td>6,7</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>January 2015</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[6]</td> + <td>15,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[5]</td> + <td>8,8</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>December 2013</td> + <td></td> +</tr> +<tr> + <td>select</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::PID_SresoSelect/domChild[0]</td> + <td>label=MONTH</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[8]</td> + <td>13,11</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>January 2015</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[6]</td> + <td>12,13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[5]</td> + <td>12,13</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>December 2013</td> + <td></td> +</tr> +<tr> + <td>select</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::PID_SresoSelect/domChild[0]</td> + <td>label=YEAR</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[6]</td> + <td>8,12</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[6]</td> + <td>8,12</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[6]</td> + <td>8,12</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>2015</td> + <td></td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_PrevYearClickableIfRangeAcceptsFractionOfPrevYear.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_PrevYearClickableIfRangeAcceptsFractionOfPrevYear.html new file mode 100644 index 0000000000..4c671b266d --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_PrevYearClickableIfRangeAcceptsFractionOfPrevYear.html @@ -0,0 +1,146 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.datefield.DateFieldRanges</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>33,10</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>12</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>12</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>12/12/10</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>32,9</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>1</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>1</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>11</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>enter</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>1/1/11</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>January 2011</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[5]</td> + <td>13,12</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>December 2010</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[6]</td> + <td>9,7</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>December 2010</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[5]</td> + <td>5,0</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>December 2010</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[7]</td> + <td>16,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[7]</td> + <td>16,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[8]</td> + <td>19,8</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>February 2012</td> + <td></td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_SettingValueOutsideRangeCausesException.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_SettingValueOutsideRangeCausesException.html new file mode 100644 index 0000000000..c3f7e021a8 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_SettingValueOutsideRangeCausesException.html @@ -0,0 +1,136 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.datefield.DateFieldRanges</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>36,8</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>4</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>4</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td> + <td>4/4/12</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>40,11</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>3</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>3</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>3/3/12</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>40,5</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>5</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>5</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>shift 7</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>5/5/12</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]</td> + <td>393,89</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#popupButton</td> + <td>10,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[17]</td> + <td>12,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[5]/span</td> + <td>13,9</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>May 2012</td> + <td></td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.html b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.html new file mode 100644 index 0000000000..77c610f211 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.html @@ -0,0 +1,121 @@ +<?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/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.datefield.DynamicallyChangeDateRange?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::/VVerticalLayout[0]/Slot[0]/VPopupCalendar[0]#popupButton</td> + <td>11,8</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[3]/td[2]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[3]/td[3]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[6]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[7]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::</td> + <td>201,401</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::/VVerticalLayout[0]/Slot[0]/VPopupCalendar[0]#popupButton</td> + <td>14,16</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[2]/td[4]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[2]/td[5]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[5]/td[4]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[5]/td[5]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::</td> + <td>237,338</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::/VVerticalLayout[0]/Slot[0]/VPopupCalendar[0]#popupButton</td> + <td>14,15</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[3]/td[2]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[3]/td[3]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[6]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[7]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[3]/td[2]/span</td> + <td>v-datefield-calendarpanel-day-outside-range</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java new file mode 100644 index 0000000000..fb0fb2a546 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java @@ -0,0 +1,93 @@ +package com.vaadin.tests.components.datefield; + +import java.util.Date; +import java.util.Locale; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.DateField; +import com.vaadin.ui.InlineDateField; +import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.VerticalLayout; + +/** + * Main UI class + */ +@SuppressWarnings("serial") +public class DynamicallyChangeDateRange extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + setLocale(Locale.ENGLISH); + final VerticalLayout layout = new VerticalLayout(); + layout.setMargin(true); + setContent(layout); + + final PopupDateField df = new PopupDateField(); + df.setValue(new Date(2012 - 1900, 5 - 1, 12)); + setRange(df, 5); + layout.addComponent(df); + + final InlineDateField df2 = new InlineDateField(); + df2.setValue(new Date(2012 - 1900, 11 - 1, 16)); + + setRange(df2, 5); + // layout.addComponent(df2); + + Button button1 = new Button("Set Range Now+/-5d"); + button1.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + setRange(df, 5); + setRange(df2, 5); + } + }); + layout.addComponent(button1); + + Button button2 = new Button("Set Range Now+/-10d"); + button2.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + setRange(df, 10); + setRange(df2, 10); + } + }); + layout.addComponent(button2); + } + + /** + * @since + * @param df + * @param i + */ + private void setRange(DateField df, int days) { + df.setRangeStart(new Date(df.getValue().getTime() - days * 24 * 60 * 60 + * 1000)); + df.setRangeEnd(new Date(df.getValue().getTime() + days * 24 * 60 * 60 + * 1000)); + + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Verifies that the allowed date range can be updated dynamically"; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 11940; + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalRelativeSizeWithoutExpand.java b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalRelativeSizeWithoutExpand.java index 86525da3ef..0ac9a008d2 100755 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalRelativeSizeWithoutExpand.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalRelativeSizeWithoutExpand.java @@ -1,4 +1,5 @@ package com.vaadin.tests.components.orderedlayout; + import com.vaadin.data.util.BeanItemContainer; import com.vaadin.server.VaadinRequest; import com.vaadin.ui.Panel; diff --git a/uitest/src/com/vaadin/tests/components/page/PageReload.html b/uitest/src/com/vaadin/tests/components/page/PageReload.html new file mode 100644 index 0000000000..20d61a48f1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/page/PageReload.html @@ -0,0 +1,46 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.page.PageReload?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentspagePageReload::PID_SLog_row_0</td> + <td>1. UI id: 0</td> +</tr> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.page.PageReload</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentspagePageReload::PID_SLog_row_0</td> + <td>1. UI id: 1</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>vaadin=runcomvaadintestscomponentspagePageReload::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentspagePageReload::PID_SLog_row_0</td> + <td>1. UI id: 2</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/page/PageReload.java b/uitest/src/com/vaadin/tests/components/page/PageReload.java new file mode 100644 index 0000000000..c1799b29e3 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/page/PageReload.java @@ -0,0 +1,34 @@ +package com.vaadin.tests.components.page; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; + +public class PageReload extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + Button b = new Button("Press to reload"); + b.addClickListener(new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + getPage().reload(); + } + }); + addComponent(b); + log("UI id: " + getUIId()); + } + + @Override + protected String getTestDescription() { + return "Tests Page.reload(). Click button to refresh the page."; + } + + @Override + protected Integer getTicketNumber() { + return 10250; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/popupview/ClickingWhilePopupOpen.html b/uitest/src/com/vaadin/tests/components/popupview/ClickingWhilePopupOpen.html index 81676f6599..43f1c2e8ed 100644 --- a/uitest/src/com/vaadin/tests/components/popupview/ClickingWhilePopupOpen.html +++ b/uitest/src/com/vaadin/tests/components/popupview/ClickingWhilePopupOpen.html @@ -28,7 +28,7 @@ </tr> <tr> <td>assertTextNotPresent</td> - <td>IllegalStateException: Cannot set a new parent without first clearing the old parent</td> + <td>Uncaught client side exception</td> <td></td> </tr> diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java new file mode 100644 index 0000000000..79797c60a2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java @@ -0,0 +1,55 @@ +package com.vaadin.tests.components.progressindicator; + +import java.util.LinkedHashMap; + +import com.vaadin.tests.components.abstractfield.AbstractFieldTest; +import com.vaadin.ui.ProgressBar; + +public class ProgressBarGenericTest extends AbstractFieldTest<ProgressBar> { + + private Command<ProgressBar, Boolean> indeterminate = new Command<ProgressBar, Boolean>() { + + @Override + public void execute(ProgressBar c, Boolean value, Object data) { + c.setIndeterminate(value); + } + }; + + @Override + protected Class<ProgressBar> getTestClass() { + return ProgressBar.class; + } + + @Override + protected void createActions() { + super.createActions(); + createBooleanAction("Indeterminate", CATEGORY_FEATURES, false, + indeterminate, null); + createValueSelection(CATEGORY_FEATURES); + createPrimaryStyleNameSelect(); + } + + /** + * @since + */ + protected void createPrimaryStyleNameSelect() { + LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + String primaryStyle = getComponent().getPrimaryStyleName(); + options.put(primaryStyle, primaryStyle); + options.put(primaryStyle + "-foo", primaryStyle + "-foo"); + options.put("foo", "foo"); + createSelectAction("Primary style name", CATEGORY_DECORATIONS, options, + primaryStyle, primaryStyleNameCommand); + + } + + private void createValueSelection(String categorySelection) { + LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>(); + options.put("null", null); + for (float f = 0; f <= 1; f += 0.1) { + options.put("" + f, f); + } + createSelectAction("Value", categorySelection, options, null, + setValueCommand); + } +} diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarPrimaryStyleName.html b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarPrimaryStyleName.html new file mode 100644 index 0000000000..92f678947a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarPrimaryStyleName.html @@ -0,0 +1,121 @@ +<?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/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.progressindicator.ProgressBarGenericTest?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent</td> + <td>v-progressbar</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]</td> + <td>v-progressbar-wrapper</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]/domChild[0]</td> + <td>v-progressbar-indicator</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_Smenu#item0</td> + <td>36,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[0]/VMenuBar[0]#item1</td> + <td>45,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[1]/VMenuBar[0]#item6</td> + <td>67,10</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[2]/VMenuBar[0]#item2</td> + <td>37,7</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent</td> + <td>v-progressbar</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent</td> + <td>foo</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]</td> + <td>v-progressbar-wrapper</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]</td> + <td>foo-wrapper</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]/domChild[0]</td> + <td>v-progressbar-indicator</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]/domChild[0]</td> + <td>foo-indicator</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_Smenu#item0</td> + <td>20,13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[0]/VMenuBar[0]#item1</td> + <td>34,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[1]/VMenuBar[0]#item6</td> + <td>51,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[2]/VMenuBar[0]#item0</td> + <td>38,6</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent</td> + <td>v-progressbar</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]</td> + <td>v-progressbar-wrapper</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]/domChild[0]</td> + <td>v-progressbar-indicator</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.html b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.html new file mode 100644 index 0000000000..b7add101f9 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.html @@ -0,0 +1,62 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.progressindicator.ProgressBarTest?restartApplication</td> + <td></td> +</tr> +<!--Add ProgressBar and wait--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>1000</td> + <td></td> +</tr> +<!--Text should not have changed--> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>0</td> +</tr> +<!--Add ProgressIndicator and wait--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>1000</td> + <td></td> +</tr> +<!--Text should have changed--> +<tr> + <td>assertNotText</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>0</td> +</tr> +<!--Stop thread right away if we get this far (would otherwise continue running until the UI is detached)--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java new file mode 100644 index 0000000000..5afa874220 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java @@ -0,0 +1,125 @@ +/* + * Copyright 2000-2013 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.progressindicator; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Label; +import com.vaadin.ui.ProgressBar; +import com.vaadin.ui.ProgressIndicator; + +public class ProgressBarTest extends AbstractTestUI { + + private Label updatedFromBackround; + private Thread updateThread = new Thread() { + @Override + public void run() { + Runnable updateTask = new Runnable() { + @Override + public void run() { + counter++; + updateLabel(); + } + }; + + while (true) { + access(updateTask); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + break; + } + } + } + }; + private ProgressBar progressBar; + private int counter = 0; + + @Override + protected void setup(VaadinRequest request) { + updatedFromBackround = new Label(); + updatedFromBackround.setCaption("Updated from background thread"); + updateLabel(); + addComponent(updatedFromBackround); + + addComponent(new Button("Use ProgressBar", new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + useComponent(new ProgressBar()); + } + })); + + addComponent(new Button("Use ProgressIndicator", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + useComponent(new ProgressIndicator()); + } + })); + + addComponent(new Button("Stop background thread", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + stopUpdateThread(); + } + })); + updateThread.setDaemon(true); + updateThread.start(); + } + + private void useComponent(ProgressBar progressBar) { + if (this.progressBar != null) { + removeComponent(this.progressBar); + } + this.progressBar = progressBar; + addComponent(progressBar); + + counter = 0; + updateLabel(); + } + + @Override + public void detach() { + super.detach(); + stopUpdateThread(); + } + + private void stopUpdateThread() { + if (updateThread != null) { + updateThread.interrupt(); + updateThread = null; + } + } + + private void updateLabel() { + updatedFromBackround.setValue(String.valueOf(counter)); + } + + @Override + protected String getTestDescription() { + return "ProgressBar should work just as ProgressIndicator, just without the polling"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(11925); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaEmptyString.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaEmptyString.java index 5eddf9dc6d..01dc10220f 100644 --- a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaEmptyString.java +++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaEmptyString.java @@ -29,6 +29,7 @@ public class RichTextAreaEmptyString extends TestBase { final Button b = new Button("get area value", new ClickListener() { + @Override public void buttonClick(ClickEvent event) { l.setValue(area.getValue()); } diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java index f4ad149dd1..c3433c3054 100644 --- a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java +++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java @@ -50,6 +50,7 @@ public class RichTextAreaPreventsTextFieldAccess extends TestBase { Button addWindowButton = new Button("Open RichTextArea-Dialog"); addWindowButton.addClickListener(new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { getMainWindow().addWindow(subWindow); @@ -60,6 +61,7 @@ public class RichTextAreaPreventsTextFieldAccess extends TestBase { Button removeWindowButton = new Button("removeWindowButton"); removeWindowButton.addClickListener(new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { getMainWindow().removeWindow(subWindow); @@ -70,6 +72,7 @@ public class RichTextAreaPreventsTextFieldAccess extends TestBase { Button focusButton = new Button("Set focus on TextField"); focusButton.addClickListener(new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { testField.focus(); @@ -80,6 +83,7 @@ public class RichTextAreaPreventsTextFieldAccess extends TestBase { Button removeRTA = new Button("Remove RTA"); removeRTA.addClickListener(new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { wLayout.removeComponent(rText); diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.html b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.html new file mode 100644 index 0000000000..6ddd1b4097 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.html @@ -0,0 +1,42 @@ +<?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:7070/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.richtextarea.RichTextAreaUpdateWhileTyping?restartApplication</td> + <td></td> +</tr> +<tr> + <td>selectFrame</td> + <td>xpath=//div[@id='rta']/iframe</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>//body</td> + <td>This text should be visible, even after an update while I type.</td> +</tr> +<tr> + <td>pause</td> + <td>2000</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//body</td> + <td>This text should be visible, even after an update while I type.</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.java new file mode 100644 index 0000000000..df1d6df463 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.java @@ -0,0 +1,51 @@ +package com.vaadin.tests.components.richtextarea; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.progressindicator.ProgressIndicatorServerRpc; +import com.vaadin.tests.components.AbstractComponentTest; +import com.vaadin.tests.components.AbstractTestCase; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.ProgressIndicator; +import com.vaadin.ui.RichTextArea; + +public class RichTextAreaUpdateWhileTyping extends AbstractTestUI { + + private RichTextArea rta; + + @Override + protected void setup(VaadinRequest request) { + + // Progress indicator for changing the value of the RTA + ProgressIndicator pi = new ProgressIndicator() { + { + registerRpc(new ProgressIndicatorServerRpc() { + + @Override + public void poll() { + rta.markAsDirty(); + } + }); + } + }; + pi.setHeight("0px"); + addComponent(pi); + + rta = new RichTextArea(); + rta.setId("rta"); + rta.setImmediate(true); + addComponent(rta); + } + + @Override + protected String getTestDescription() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Integer getTicketNumber() { + return 11741; + } +} diff --git a/uitest/src/com/vaadin/tests/components/select/OptionGroupBaseSelects.java b/uitest/src/com/vaadin/tests/components/select/OptionGroupBaseSelects.java index f2dee69cbf..0df82688d1 100644 --- a/uitest/src/com/vaadin/tests/components/select/OptionGroupBaseSelects.java +++ b/uitest/src/com/vaadin/tests/components/select/OptionGroupBaseSelects.java @@ -29,6 +29,7 @@ public class OptionGroupBaseSelects extends ComponentTestCase<HorizontalLayout> CheckBox cb = new CheckBox("Switch Selects ReadOnly", false); cb.addListener(new ValueChangeListener() { + @Override public void valueChange(ValueChangeEvent event) { for (Iterator<Component> it = layout.getComponentIterator(); it .hasNext();) { @@ -42,6 +43,7 @@ public class OptionGroupBaseSelects extends ComponentTestCase<HorizontalLayout> CheckBox cb2 = new CheckBox("Switch Selects Enabled", true); cb2.addListener(new ValueChangeListener() { + @Override public void valueChange(ValueChangeEvent event) { for (Iterator<Component> it = layout.getComponentIterator(); it .hasNext();) { diff --git a/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html b/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html index 9e529836b6..4dc63721a1 100644 --- a/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html +++ b/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html @@ -13,12 +13,7 @@ </thead><tbody> <tr> <td>open</td> - <td>/run/com.vaadin.tests.components.table.ColumnCollapsingAndColumnExpansion</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> + <td>/run/com.vaadin.tests.components.table.ColumnCollapsingAndColumnExpansion?restartApplication</td> <td></td> </tr> <!--Initial state, all 3 columns visible--> @@ -32,32 +27,17 @@ <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[0]/domChild[1]</td> <td></td> </tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> <!--Hide 'col2' through table interface--> <tr> - <td>click</td> - <td>//td[@id='gwt-uid-2']/span/div</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> + <td>mouseClick</td> + <td>//tr[2]/td/span/div</td> + <td>23,2</td> </tr> <tr> <td>screenCapture</td> <td></td> <td>col2-hidden</td> </tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> <!--Hide 'Col1' using button--> <tr> <td>enterCharacter</td> @@ -65,62 +45,32 @@ <td>Col1</td> </tr> <tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> <td>click</td> <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> <td></td> </tr> <tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> <td>screenCapture</td> <td></td> <td>col1-col2-hidden</td> </tr> <!--Show 'col2' using action handler--> <tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> <td>contextmenu</td> <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td> <td></td> </tr> <tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> <td>mouseClick</td> <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VContextMenu[0]#option0</td> <td>11,6</td> </tr> <tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> <td>enterCharacter</td> <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td> <td>Col2</td> </tr> <tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> <td>screenCapture</td> <td></td> <td>col1-hidden</td> @@ -132,27 +82,16 @@ <td>Col1</td> </tr> <tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> <td>click</td> <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> <td></td> </tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> <!--We should now be back at the initial state, all 3 columns visible--> <tr> <td>screenCapture</td> <td></td> <td>col1-col2-col3-visible-again</td> </tr> - </tbody></table> </body> </html> diff --git a/uitest/src/com/vaadin/tests/components/table/EmptyRowsWhenScrolling.java b/uitest/src/com/vaadin/tests/components/table/EmptyRowsWhenScrolling.java index c1ae9b4118..3bc0d3dd1f 100644 --- a/uitest/src/com/vaadin/tests/components/table/EmptyRowsWhenScrolling.java +++ b/uitest/src/com/vaadin/tests/components/table/EmptyRowsWhenScrolling.java @@ -93,6 +93,7 @@ public class EmptyRowsWhenScrolling extends UI { table.setVisibleColumns(new String[] { "image", "id", "col1", "col2", "col3", "col4" }); table.addGeneratedColumn("image", new ColumnGenerator() { + @Override public Object generateCell(Table source, Object itemId, Object columnId) { int imgNum = new Random().nextInt(5) + 1; @@ -112,6 +113,7 @@ public class EmptyRowsWhenScrolling extends UI { image.setWidth("50px"); image.setHeight("50px"); image.addClickListener(new com.vaadin.event.MouseEvents.ClickListener() { + @Override public void click( com.vaadin.event.MouseEvents.ClickEvent event) { Notification.show("Image clicked!"); @@ -123,6 +125,7 @@ public class EmptyRowsWhenScrolling extends UI { // Refresh table button getBtnRefreshTable().addClickListener(new ClickListener() { + @Override public void buttonClick(ClickEvent event) { table.refreshRowCache(); } diff --git a/uitest/src/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java b/uitest/src/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java index fb782b8ded..b6ee62ea59 100644 --- a/uitest/src/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java +++ b/uitest/src/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java @@ -105,6 +105,7 @@ public class LargeSelectionCausesNPE extends TestBase { } Table.ValueChangeListener valueChangeListener = new Table.ValueChangeListener() { + @Override public void valueChange(ValueChangeEvent event) { // in multiselect mode, a Set of itemIds is returned, // in singleselect mode the itemId is returned directly @@ -119,6 +120,7 @@ public class LargeSelectionCausesNPE extends TestBase { Button.ClickListener clickListener = new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { Property nameProperty = table.getContainerProperty(0, NAME); if (("0").equals(nameLabel.getValue())) { @@ -148,6 +150,7 @@ public class LargeSelectionCausesNPE extends TestBase { ColumnGenerator columnGenerator = new ColumnGenerator() { + @Override public Object generateCell(Table source, Object itemId, Object columnId) { Label label = new Label(); diff --git a/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndExpandRatios.java b/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndExpandRatios.java index 747c99468f..b1ecb3fc10 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndExpandRatios.java +++ b/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndExpandRatios.java @@ -38,10 +38,11 @@ public class TableColumnWidthsAndExpandRatios extends TestBase { return new NativeButton("Reset " + property + " width", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - table.setColumnWidth(property, -1); - } - }); + @Override + public void buttonClick(ClickEvent event) { + table.setColumnWidth(property, -1); + } + }); } @Override diff --git a/uitest/src/com/vaadin/tests/components/table/TableInSubWindowMemoryLeak.java b/uitest/src/com/vaadin/tests/components/table/TableInSubWindowMemoryLeak.java index dcaabf98d6..c0c8876fca 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableInSubWindowMemoryLeak.java +++ b/uitest/src/com/vaadin/tests/components/table/TableInSubWindowMemoryLeak.java @@ -20,6 +20,7 @@ public class TableInSubWindowMemoryLeak extends TestBase { final Button openButton = new Button("open me"); openButton.addClickListener(new ClickListener() { + @Override public void buttonClick(final ClickEvent event) { final Window window = new Window("Simple Window"); window.setModal(true); @@ -29,6 +30,7 @@ public class TableInSubWindowMemoryLeak extends TestBase { window.setContent(table); UI.getCurrent().addWindow(window); window.addCloseListener(new CloseListener() { + @Override public void windowClose(final CloseEvent e) { window.setContent(new Label()); UI.getCurrent().removeWindow(window); @@ -40,6 +42,7 @@ public class TableInSubWindowMemoryLeak extends TestBase { final Button openButton2 = new Button("open me without Table"); openButton2.addClickListener(new ClickListener() { + @Override public void buttonClick(final ClickEvent event) { final Window window = new Window("Simple Window"); window.setModal(true); @@ -47,6 +50,7 @@ public class TableInSubWindowMemoryLeak extends TestBase { window.setWidth("200px"); UI.getCurrent().addWindow(window); window.addCloseListener(new CloseListener() { + @Override public void windowClose(final CloseEvent e) { UI.getCurrent().removeWindow(window); } diff --git a/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java index 9823fc1859..7d48dfa11e 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java +++ b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java @@ -5,7 +5,6 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Label; import com.vaadin.ui.Table; -import com.vaadin.ui.VerticalLayout; public class TableRowScrolledBottom extends TestBase { diff --git a/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.html b/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.html new file mode 100644 index 0000000000..96df94148c --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.html @@ -0,0 +1,72 @@ +<?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/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.table.TableSqlContainer?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>May 24, 2013 12:00:00 AM</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td> + <td>12,7</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VPopupCalendar[0]#field</td> + <td>5/24/13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VPopupCalendar[0]#popupButton</td> + <td>9,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[5]/span</td> + <td>11,10</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td> + <td>9,12</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>May 15, 2013 12:00:00 AM</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[0]</td> + <td>Apr 26, 2013 12:00:00 AM</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[1]/domChild[0]</td> + <td>May 27, 2013 12:00:00 AM</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[1]/domChild[0]</td> + <td>Apr 28, 2013 12:00:00 AM</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.java b/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.java new file mode 100644 index 0000000000..5191b1b86e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.java @@ -0,0 +1,142 @@ +package com.vaadin.tests.components.table; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Locale; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.data.util.sqlcontainer.SQLContainer; +import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool; +import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool; +import com.vaadin.data.util.sqlcontainer.query.TableQuery; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; +import com.vaadin.ui.VerticalLayout; + +public class TableSqlContainer extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + setLocale(Locale.ENGLISH); + VerticalLayout layout = new VerticalLayout(); + addComponent(layout); + + final Table table = new Table("Table with SQLContainer"); + layout.addComponent(table); + + final Label selectedLabel = new Label("Selected: null"); + layout.addComponent(selectedLabel); + + try { + JDBCConnectionPool connectionPool = new SimpleJDBCConnectionPool( + "org.hsqldb.jdbc.JDBCDriver", + "jdbc:hsqldb:mem:sqlcontainer", "SA", "", 2, 20); + + createTestTable(connectionPool); + insertTestData(connectionPool); + + TableQuery q = new TableQuery("mytable", connectionPool); + q.setVersionColumn("version"); + SQLContainer myContainer = new SQLContainer(q); + + table.setContainerDataSource(myContainer); + + } catch (SQLException e) { + e.printStackTrace(); + } + + table.setImmediate(true); + table.setSizeFull(); + table.setSelectable(true); + table.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + selectedLabel.setValue("Selected: " + + event.getProperty().getValue()); + } + }); + + final CheckBox editMode = new CheckBox("Edit mode"); + editMode.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + table.setEditable(editMode.getValue()); + } + }); + addComponent(editMode); + } + + /** + * (Re)creates the test table + * + * @param connectionPool + */ + private void createTestTable(JDBCConnectionPool connectionPool) { + Connection conn = null; + try { + conn = connectionPool.reserveConnection(); + Statement statement = conn.createStatement(); + try { + statement.executeUpdate("DROP TABLE mytable"); + } catch (SQLException e) { + } + statement.execute("CREATE TABLE mytable " + + "(id INTEGER GENERATED BY DEFAULT AS IDENTITY, D DATE," + + "MYFIELD VARCHAR(45), " + "PRIMARY KEY(ID))"); + statement.close(); + conn.commit(); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + connectionPool.releaseConnection(conn); + } + } + + /** + * Adds test data to the test table + * + * @param connectionPool + * @throws SQLException + */ + private void insertTestData(JDBCConnectionPool connectionPool) + throws SQLException { + Connection conn = null; + try { + conn = connectionPool.reserveConnection(); + Statement statement = conn.createStatement(); + + statement + .executeUpdate("INSERT INTO mytable VALUES(1, '2013-05-24', 'A0')"); + statement + .executeUpdate("INSERT INTO mytable VALUES(2, '2013-04-26', 'A1')"); + statement + .executeUpdate("INSERT INTO mytable VALUES(3, '2013-05-27', 'B0')"); + statement + .executeUpdate("INSERT INTO mytable VALUES(4, '2013-04-28', 'B1')"); + + statement.close(); + conn.commit(); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + connectionPool.releaseConnection(conn); + } + } + + @Override + protected String getTestDescription() { + return "A test with Table connected to a SQLContainer using TableQuery"; + } + + @Override + protected Integer getTicketNumber() { + return 11224; + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java b/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java index 9c5ce9dc0c..efa1b1bdab 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java +++ b/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java @@ -78,6 +78,7 @@ public class TableWithBrokenGeneratorAndContainer extends TestBase { this.brokenInterval = brokenInterval; } + @Override public Object generateCell(Table source, Object itemId, Object columnId) { if (counter++ % brokenInterval == 0 && Boolean.TRUE.equals(brokenGenerator.getValue())) { @@ -97,6 +98,7 @@ public class TableWithBrokenGeneratorAndContainer extends TestBase { clearTableOnError.setImmediate(true); clearTableOnError.addValueChangeListener(new ValueChangeListener() { + @Override public void valueChange(ValueChangeEvent event) { Boolean value = clearTableOnError.getValue(); setErrorHandler(value != null ? value : false); @@ -110,6 +112,7 @@ public class TableWithBrokenGeneratorAndContainer extends TestBase { Button refreshTableCache = new Button("Refresh table cache", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { table.markAsDirty(); table.refreshRowCache(); diff --git a/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java index f378c146ea..b0622e748c 100644 --- a/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java +++ b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java @@ -26,6 +26,7 @@ public class ValueAfterClearingContainer extends TestBase { table.setImmediate(true); table.addValueChangeListener(new ValueChangeListener() { + @Override public void valueChange(ValueChangeEvent event) { log.log("Value changed to " + event.getProperty().getValue()); } @@ -38,6 +39,7 @@ public class ValueAfterClearingContainer extends TestBase { multiselect.setId("multiselect"); multiselect.addValueChangeListener(new ValueChangeListener() { + @Override public void valueChange(ValueChangeEvent event) { Boolean value = multiselect.getValue(); table.setMultiSelect(value == null ? false : value); @@ -46,6 +48,7 @@ public class ValueAfterClearingContainer extends TestBase { addComponent(multiselect); Button addItemsButton = new Button("Add table items", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { if (!table.getItemIds().isEmpty()) { Notification @@ -65,6 +68,7 @@ public class ValueAfterClearingContainer extends TestBase { Button showValueButton = new Button("Show value", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { log.log("Table selection: " + table.getValue()); } @@ -74,6 +78,7 @@ public class ValueAfterClearingContainer extends TestBase { Button removeItemsFromTableButton = new Button( "Remove items from table", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { table.removeAllItems(); } @@ -83,6 +88,7 @@ public class ValueAfterClearingContainer extends TestBase { Button removeItemsFromContainerButton = new Button( "Remove items from container", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { table.getContainerDataSource().removeAllItems(); } @@ -92,6 +98,7 @@ public class ValueAfterClearingContainer extends TestBase { Button removeItemsFromContainerAndSanitizeButton = new Button( "Remove items from container and sanitize", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { table.getContainerDataSource().removeAllItems(); table.sanitizeSelection(); @@ -102,6 +109,7 @@ public class ValueAfterClearingContainer extends TestBase { addComponent(removeItemsFromContainerAndSanitizeButton); Button removeSelectedFromTableButton = new Button( "Remove selected item from table", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { Object selection = table.getValue(); if (selection == null) { @@ -117,6 +125,7 @@ public class ValueAfterClearingContainer extends TestBase { Button removeSelectedFromContainer = new Button( "Remove selected item from container", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { Object selection = table.getValue(); if (selection == null) { diff --git a/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.java b/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.java index 878dd0d3c4..de32ea1fc0 100644 --- a/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.java +++ b/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.java @@ -43,6 +43,7 @@ public class ViewPortCalculation extends TestBase { } table.setCellStyleGenerator(new CellStyleGenerator() { + @Override public String getStyle(Table source, Object itemId, Object propertyId) { if (itemId.equals(lastDoubleClickedItemId)) { @@ -53,6 +54,7 @@ public class ViewPortCalculation extends TestBase { }); table.addItemClickListener(new ItemClickListener() { + @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { lastDoubleClickedItemId = event.getItemId(); diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java b/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java index 2917eccbfb..fffc766e7c 100755 --- a/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java @@ -1,4 +1,5 @@ package com.vaadin.tests.components.tabsheet;
+
import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.HorizontalSplitPanel;
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/HiddenTabSheetBrowserResize.java b/uitest/src/com/vaadin/tests/components/tabsheet/HiddenTabSheetBrowserResize.java index 0fdb579997..eac786d9b3 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/HiddenTabSheetBrowserResize.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/HiddenTabSheetBrowserResize.java @@ -17,6 +17,7 @@ public class HiddenTabSheetBrowserResize extends TestBase { Button toggleButton = new Button("Toggle TabSheet", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { tabSheet.setVisible(!tabSheet.isVisible()); } diff --git a/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.java b/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.java index c95731d94f..154a30a64b 100644 --- a/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.java +++ b/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.java @@ -27,6 +27,7 @@ public class ScrollCursor extends TestBase { Button button = new Button("Scroll"); button.addListener(new ClickListener() { + @Override public void buttonClick(ClickEvent event) { textArea.setCursorPosition(getPosition()); } @@ -34,6 +35,7 @@ public class ScrollCursor extends TestBase { Button wrap = new Button("Set wrap"); wrap.addListener(new ClickListener() { + @Override public void buttonClick(ClickEvent event) { textArea.setWordwrap(false); } @@ -42,6 +44,7 @@ public class ScrollCursor extends TestBase { Button toBegin = new Button("To begin"); toBegin.addListener(new ClickListener() { + @Override public void buttonClick(ClickEvent event) { position = 3; } @@ -50,6 +53,7 @@ public class ScrollCursor extends TestBase { Button toMiddle = new Button("To middle"); toMiddle.addListener(new ClickListener() { + @Override public void buttonClick(ClickEvent event) { position = 130; } @@ -58,6 +62,7 @@ public class ScrollCursor extends TestBase { Button toEnd = new Button("To end"); toEnd.addListener(new ClickListener() { + @Override public void buttonClick(ClickEvent event) { position = textArea.getValue().toString().length(); } diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldMaxLengthRemovedFromDOM.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldMaxLengthRemovedFromDOM.java index 28ff20c174..049b08d4e8 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/TextFieldMaxLengthRemovedFromDOM.java +++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldMaxLengthRemovedFromDOM.java @@ -17,6 +17,7 @@ public class TextFieldMaxLengthRemovedFromDOM extends TestBase { tf.addFocusListener(new FieldEvents.FocusListener() { + @Override public void focus(FocusEvent event) { // Resetting Max length should not remove maxlength attribute tf.setMaxLength(11); diff --git a/uitest/src/com/vaadin/tests/components/tree/SimpleTree.html b/uitest/src/com/vaadin/tests/components/tree/SimpleTree.html new file mode 100644 index 0000000000..a446f67726 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tree/SimpleTree.html @@ -0,0 +1,270 @@ +<?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>SimpleTree</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">SimpleTree</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.tree.SimpleTree?restartApplication</td> + <td></td> +</tr> +<!--Caption--> +<tr> + <td>verifyElementPresent</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTree[0]</td> + <td></td> +</tr> +<tr> + <td>storeAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[0]@id</td> + <td>captionid</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]@aria-labelledby</td> + <td>${captionid}</td> +</tr> +<tr> + <td>storeAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]@id</td> + <td>treeid</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[0]@for</td> + <td>${treeid}</td> +</tr> +<!--Tree--> +<tr> + <td>verifyElementPresent</td> + <td>xpath=/html/body/div/div/div[2]/div/div[2]/div/div/div/div[@aria-multiselectable='false']</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>xpath=/html/body/div/div/div[2]/div/div[2]/div/div/div/div[2]/div[@role='tree']</td> + <td></td> +</tr> +<!--Treeitem--> +<tr> + <td>storeAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]@id</td> + <td>captionid</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@aria-labelledby</td> + <td>${captionid}</td> +</tr> +<tr> + <td>storeAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td> + <td>treeitem10id</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]@for</td> + <td>${treeitem10id}</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>${treeitem10id}@aria-level</td> + <td>1</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]@role</td> + <td>group</td> +</tr> +<tr> + <td>storeAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@id</td> + <td>treeitem11id</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>${treeitem11id}@role</td> + <td>treeitem</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>${treeitem11id}@aria-level</td> + <td>2</td> +</tr> +<!--Open/Close--> +<tr> + <td>assertAttribute</td> + <td>${treeitem10id}@aria-expanded</td> + <td>true</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=//div[@id='${treeitem10id}']</td> + <td>5,5</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>${treeitem10id}@aria-expanded</td> + <td>false</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=//div[@id='${treeitem10id}']</td> + <td>5,5</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>${treeitem10id}@aria-expanded</td> + <td>true</td> +</tr> +<!--Root Selected--> +<tr> + <td>assertAttribute</td> + <td>${treeitem10id}@aria-selected</td> + <td>false</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=//div[@id='${treeitem10id}']/div[1]/div[1]/span[1]</td> + <td></td> +</tr> +<tr> + <td>storeAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td> + <td>treeitem10id</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>${treeitem10id}@aria-selected</td> + <td>true</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@aria-selected</td> + <td>false</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[2]@aria-selected</td> + <td>false</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]@aria-selected</td> + <td>false</td> +</tr> +<!--First child selected--> +<tr> + <td>mouseClick</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]/div[1]/div[1]/span[1]</td> + <td></td> +</tr> +<tr> + <td>storeAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td> + <td>treeitem10id</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>${treeitem10id}@aria-selected</td> + <td>false</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@aria-selected</td> + <td>true</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[2]@aria-selected</td> + <td>false</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]@aria-selected</td> + <td>false</td> +</tr> +<!--Last child selected--> +<tr> + <td>mouseClick</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]/div[1]/div[1]/span[1]</td> + <td></td> +</tr> +<tr> + <td>storeAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td> + <td>treeitem10id</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>${treeitem10id}@aria-selected</td> + <td>false</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@aria-selected</td> + <td>false</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[2]@aria-selected</td> + <td>false</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]@aria-selected</td> + <td>true</td> +</tr> +<!--Another root selected--> +<tr> + <td>assertAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[1]@aria-selected</td> + <td>false</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[1]@aria-selected</td> + <td>true</td> +</tr> +<tr> + <td>storeAttribute</td> + <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td> + <td>treeitem10id</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>${treeitem10id}@aria-selected</td> + <td>false</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@aria-selected</td> + <td>false</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[2]@aria-selected</td> + <td>false</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]@aria-selected</td> + <td>false</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/tree/SimpleTree.java b/uitest/src/com/vaadin/tests/components/tree/SimpleTree.java new file mode 100644 index 0000000000..2fd3f05dbb --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tree/SimpleTree.java @@ -0,0 +1,122 @@ +package com.vaadin.tests.components.tree; + +import java.util.Date; + +import com.vaadin.data.Item; +import com.vaadin.data.util.HierarchicalContainer; +import com.vaadin.event.Action; +import com.vaadin.server.ThemeResource; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.AbstractSelect; +import com.vaadin.ui.Tree; + +public class SimpleTree extends TestBase implements Action.Handler { + private static final String[][] hardware = { // + { "Desktops", "Dell OptiPlex GX240", "Dell OptiPlex GX260", + "Dell OptiPlex GX280" }, + { "Monitors", "Benq T190HD", "Benq T220HD", "Benq T240HD" }, + { "Laptops", "IBM ThinkPad T40", "IBM ThinkPad T43", + "IBM ThinkPad T60" } }; + + ThemeResource notCachedFolderIconLargeOther = new ThemeResource( + "../runo/icons/16/ok.png?" + new Date().getTime()); + ThemeResource notCachedFolderIconLarge = new ThemeResource( + "../runo/icons/16/folder.png?" + new Date().getTime()); + + // Actions for the context menu + private static final Action ACTION_ADD = new Action("Add child item"); + private static final Action ACTION_DELETE = new Action("Delete"); + private static final Action[] ACTIONS = new Action[] { ACTION_ADD, + ACTION_DELETE }; + + private Tree tree; + + @Override + public void setup() { + // Create the Tree,a dd to layout + tree = new Tree("Hardware Inventory"); + addComponent(tree); + + // Contents from a (prefilled example) hierarchical container: + tree.setContainerDataSource(getHardwareContainer()); + + // Add actions (context menu) + tree.addActionHandler(this); + + // Cause valueChange immediately when the user selects + tree.setImmediate(true); + + // Set tree to show the 'name' property as caption for items + tree.setItemCaptionPropertyId("name"); + tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY); + + tree.setItemIcon(9, notCachedFolderIconLargeOther, "First Choice"); + tree.setItemIcon(11, notCachedFolderIconLarge); + + // Expand whole tree + for (Object id : tree.rootItemIds()) { + tree.expandItemsRecursively(id); + } + } + + public static HierarchicalContainer getHardwareContainer() { + Item item = null; + int itemId = 0; // Increasing numbering for itemId:s + + // Create new container + HierarchicalContainer hwContainer = new HierarchicalContainer(); + // Create containerproperty for name + hwContainer.addContainerProperty("name", String.class, null); + // Create containerproperty for icon + hwContainer.addContainerProperty("icon", ThemeResource.class, + new ThemeResource("../runo/icons/16/document.png")); + for (int i = 0; i < hardware.length; i++) { + // Add new item + item = hwContainer.addItem(itemId); + // Add name property for item + item.getItemProperty("name").setValue(hardware[i][0]); + // Allow children + hwContainer.setChildrenAllowed(itemId, true); + itemId++; + for (int j = 1; j < hardware[i].length; j++) { + if (j == 1) { + item.getItemProperty("icon").setValue( + new ThemeResource("../runo/icons/16/folder.png")); + } + + // Add child items + item = hwContainer.addItem(itemId); + item.getItemProperty("name").setValue(hardware[i][j]); + hwContainer.setParent(itemId, itemId - j); + + hwContainer.setChildrenAllowed(itemId, false); + if (j == 2) { + hwContainer.setChildrenAllowed(itemId, true); + } + + itemId++; + } + } + return hwContainer; + } + + @Override + protected String getDescription() { + return "Sample Tree for testing WAI-ARIA functionality"; + } + + @Override + protected Integer getTicketNumber() { + return 0; + } + + @Override + public Action[] getActions(Object target, Object sender) { + return ACTIONS; + } + + @Override + public void handleAction(Action action, Object sender, Object target) { + System.out.println("Action: " + action.getCaption()); + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html b/uitest/src/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html index bf83a1acdb..83508c9478 100644 --- a/uitest/src/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html +++ b/uitest/src/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html @@ -64,7 +64,7 @@ <tr> <td>assertText</td> <td>vaadin=runTrees::PID_SLog_row_1</td> - <td>4. left click on source: [Item 1], client: [*];, relative: [-1,-1], itemId: Item 2, propertyId: null</td> + <td>4. left click on source: com.vaadin.ui.Tree@*, client: [*];, relative: [-1,-1], itemId: Item 2, propertyId: null</td> </tr> <tr> <td>assertText</td> @@ -74,9 +74,8 @@ <tr> <td>assertText</td> <td>vaadin=runTrees::PID_SLog_row_3</td> - <td>2. left click on source: [], client: [*];, relative: [-1,-1], itemId: Item 1, propertyId: null</td> + <td>2. left click on source: com.vaadin.ui.Tree@*, client: [*];, relative: [-1,-1], itemId: Item 1, propertyId: null</td> </tr> - </tbody></table> </body> </html> diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java index f792a32f8f..85a69702a4 100644 --- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java @@ -90,6 +90,7 @@ public class TreeTableCacheOnPartialUpdates extends TestBase { } public class Col4ColumnGenerator implements ColumnGenerator { + @Override public Component generateCell(final com.vaadin.ui.Table source, final Object itemId, Object columnId) { TestBean tb = (TestBean) itemId; @@ -98,6 +99,7 @@ public class TreeTableCacheOnPartialUpdates extends TestBase { btnCol4.setId("cacheTestButtonToggle-" + tb.getCol1() + "-" + tb.getCol2()); btnCol4.addClickListener(new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { treeTable.setCollapsed(itemId, !treeTable.isCollapsed(itemId)); diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.java index 4af0da158d..79c967914f 100644 --- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.java +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.java @@ -49,6 +49,7 @@ public class TreeTableExtraScrollbar extends TestBase { button.setId("button"); button.addClickListener(new ClickListener() { + @Override public void buttonClick(ClickEvent event) { table.addItem(new TestObject("name 6-1", "value 6-1")); table.addItem(new TestObject("name 6-2", "value 6-2")); @@ -68,12 +69,14 @@ public class TreeTableExtraScrollbar extends TestBase { } private class EmptyColumnGenerator implements Table.ColumnGenerator { + @Override public Object generateCell(Table table, Object itemId, Object columnId) { return null; } } private class TypeColumnGenerator implements Table.ColumnGenerator { + @Override public Object generateCell(Table table, Object itemId, Object columnId) { if (itemId instanceof TestObject) { return new Label(((TestObject) itemId).getValue()); diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbarWithChildren.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbarWithChildren.java index cad33e242f..0dc98b2c2e 100644 --- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbarWithChildren.java +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbarWithChildren.java @@ -62,6 +62,7 @@ public class TreeTableExtraScrollbarWithChildren extends TestBase { button.setId("button"); button.addClickListener(new ClickListener() { + @Override public void buttonClick(ClickEvent event) { table.setCollapsed(parent, !table.isCollapsed(parent)); Notification.show("collapsed: " + table.isCollapsed(parent)); @@ -73,6 +74,7 @@ public class TreeTableExtraScrollbarWithChildren extends TestBase { } private class HierarchyColumnGenerator implements Table.ColumnGenerator { + @Override public Object generateCell(Table table, Object itemId, Object columnId) { Label label = new Label("this should be mostly hidden"); label.setSizeUndefined(); @@ -81,6 +83,7 @@ public class TreeTableExtraScrollbarWithChildren extends TestBase { } private class TypeColumnGenerator implements Table.ColumnGenerator { + @Override public Object generateCell(Table table, Object itemId, Object columnId) { if (itemId instanceof TestObject) { return new Label(((TestObject) itemId).getValue()); diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableInternalError.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableInternalError.java index f6d7f11eb7..1b510f1ac5 100644 --- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableInternalError.java +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableInternalError.java @@ -30,6 +30,7 @@ public class TreeTableInternalError extends TestBase { Button button = new Button("Resize") { { addClickListener(new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { t.setHeight("300px"); } @@ -64,12 +65,14 @@ public class TreeTableInternalError extends TestBase { } public class ButtonColumnGenerator implements ColumnGenerator { + @Override public Component generateCell(final com.vaadin.ui.Table source, final Object itemId, Object columnId) { String identifier = "Expand/Collapse"; Button btnCol = new NativeButton(identifier); btnCol.setId("cacheTestButtonToggle-" + itemId); btnCol.addClickListener(new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { t.setCollapsed(itemId, !t.isCollapsed(itemId)); } diff --git a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java new file mode 100644 index 0000000000..3c857a8753 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java @@ -0,0 +1,96 @@ +package com.vaadin.tests.components.ui; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.NativeButton; +import com.vaadin.ui.TextField; + +public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog { + + private TextField firstDelay; + private TextField secondDelay; + private TextField thirdDelay; + + @Override + protected void setup(VaadinRequest request) { + final TextField delayField = new TextField("Delay (ms)"); + delayField.setConverter(Integer.class); + delayField.setConvertedValue(1000); + + NativeButton delayButton = new NativeButton("Wait"); + delayButton.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + try { + Thread.sleep((Integer) delayField.getConvertedValue()); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }); + + firstDelay = createIntegerTextField("First delay (ms)", + getState().loadingIndicatorConfiguration.firstDelay); + firstDelay.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getLoadingIndicatorConfiguration().setFirstDelay( + (Integer) firstDelay.getConvertedValue()); + } + }); + secondDelay = createIntegerTextField("Second delay (ms)", + getState().loadingIndicatorConfiguration.secondDelay); + secondDelay.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getLoadingIndicatorConfiguration().setSecondDelay( + (Integer) secondDelay.getConvertedValue()); + } + }); + thirdDelay = createIntegerTextField("Third delay (ms)", + getState().loadingIndicatorConfiguration.thirdDelay); + thirdDelay.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getLoadingIndicatorConfiguration().setThirdDelay( + (Integer) thirdDelay.getConvertedValue()); + } + }); + + getLayout().addComponents(firstDelay, secondDelay, thirdDelay); + + HorizontalLayout hl = new HorizontalLayout(); + hl.setMargin(true); + hl.setDefaultComponentAlignment(Alignment.BOTTOM_RIGHT); + hl.addComponents(delayField, delayButton); + addComponent(hl); + + } + + private TextField createIntegerTextField(String caption, int initialValue) { + TextField tf = new TextField(caption); + tf.setId(caption); + tf.setConverter(Integer.class); + tf.setImmediate(true); + tf.setConvertedValue(initialValue); + return tf; + } + + @Override + protected String getTestDescription() { + return "Tests that loading indicator delay can be configured"; + } + + @Override + protected Integer getTicketNumber() { + return 7448; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html new file mode 100644 index 0000000000..e41cf5e176 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html @@ -0,0 +1,145 @@ +<?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/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.ui.TooltipConfiguration?restartApplication</td> + <td></td> +</tr> +<!--Short close delay--> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td> + <td>0</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SshortTooltip</td> + <td>0,0</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>This is a short tooltip</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td></td> +</tr> +<!--Long close delay--> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td> + <td>3000</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td> + <td>0,0</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SshortTooltip</td> + <td>0,0</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>This is a short tooltip</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td> + <td>60,9</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td> + <td>0</td> +</tr> +<!--Max width 500--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SlongTooltip</td> + <td>0,0</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td></td> +</tr> +<tr> + <td>assertElementWidth</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>500</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td> + <td></td> +</tr> +<!--Max width 100--> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SMax width</td> + <td>100</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td> + <td>0,0</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SlongTooltip</td> + <td>0,0</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td></td> +</tr> +<tr> + <td>assertElementWidth</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>100</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java new file mode 100644 index 0000000000..4d201d2a1a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java @@ -0,0 +1,107 @@ +package com.vaadin.tests.components.ui; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.tests.util.LoremIpsum; +import com.vaadin.ui.NativeButton; +import com.vaadin.ui.TextField; + +public class TooltipConfiguration extends AbstractTestUIWithLog { + + private TextField closeTimeout; + private TextField quickOpenTimeout; + private TextField maxWidth; + private TextField openDelay; + private TextField quickOpenDelay; + + @Override + protected void setup(VaadinRequest request) { + NativeButton componentWithShortTooltip = new NativeButton( + "Short tooltip"); + componentWithShortTooltip.setDescription("This is a short tooltip"); + componentWithShortTooltip.setId("shortTooltip"); + + NativeButton componentWithLongTooltip = new NativeButton("Long tooltip"); + componentWithLongTooltip.setId("longTooltip"); + componentWithLongTooltip.setDescription(LoremIpsum.get(5000)); + + closeTimeout = createIntegerTextField("Close timeout", + getState().tooltipConfiguration.closeTimeout); + closeTimeout.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltipConfiguration().setCloseTimeout( + (Integer) closeTimeout.getConvertedValue()); + } + }); + maxWidth = createIntegerTextField("Max width", + getState().tooltipConfiguration.maxWidth); + maxWidth.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltipConfiguration().setMaxWidth( + (Integer) maxWidth.getConvertedValue()); + } + }); + openDelay = createIntegerTextField("Open delay", + getState().tooltipConfiguration.openDelay); + openDelay.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltipConfiguration().setOpenDelay( + (Integer) openDelay.getConvertedValue()); + } + }); + + quickOpenDelay = createIntegerTextField("Quick open delay", + getState().tooltipConfiguration.quickOpenDelay); + quickOpenDelay + .addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltipConfiguration().setQuickOpenDelay( + (Integer) quickOpenDelay.getConvertedValue()); + } + }); + + quickOpenTimeout = createIntegerTextField("Quick open timeout", + getState().tooltipConfiguration.quickOpenTimeout); + quickOpenTimeout + .addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltipConfiguration().setQuickOpenTimeout( + (Integer) quickOpenTimeout.getConvertedValue()); + } + }); + + getLayout().addComponents(closeTimeout, openDelay, quickOpenDelay, + quickOpenTimeout, maxWidth); + + getLayout().addComponents(componentWithShortTooltip, + componentWithLongTooltip); + + } + + private TextField createIntegerTextField(String caption, int initialValue) { + TextField tf = new TextField(caption); + tf.setId(caption); + tf.setConverter(Integer.class); + tf.setImmediate(true); + tf.setConvertedValue(initialValue); + return tf; + } + + @Override + protected String getTestDescription() { + return "Tests that tooltip delays can be configured"; + } + + @Override + protected Integer getTicketNumber() { + return 8065; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitException.html b/uitest/src/com/vaadin/tests/components/ui/UIInitException.html index c2b1b33059..68b11e7942 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIInitException.html +++ b/uitest/src/com/vaadin/tests/components/ui/UIInitException.html @@ -17,9 +17,9 @@ <td></td> </tr> <tr> - <td>assertText</td> - <td>//html/body/div/pre</td> + <td>assertTextPresent</td> <td>Catch me if you can</td> + <td></td> </tr> </tbody></table> </body> diff --git a/uitest/src/com/vaadin/tests/components/ui/UIPolling.html b/uitest/src/com/vaadin/tests/components/ui/UIPolling.html new file mode 100644 index 0000000000..f770bae009 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UIPolling.html @@ -0,0 +1,53 @@ +<?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/UIPolling?restartApplication</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runUIPolling::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VTextField[0]</td> + <td>500</td> +</tr> +<tr> + <td>pause</td> + <td>2000</td> + <td></td> +</tr> +<!--Ensure polling has taken place--> +<tr> + <td>assertTextPresent</td> + <td>2. 1000ms has passed</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runUIPolling::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VTextField[0]</td> + <td>-1</td> +</tr> +<tr> + <td>pause</td> + <td>2000</td> + <td></td> +</tr> +<!--Ensure polling has stopped--> +<tr> + <td>assertTextNotPresent</td> + <td>8. 4000ms has passed</td> + <td></td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/ui/UIPolling.java b/uitest/src/com/vaadin/tests/components/ui/UIPolling.java new file mode 100644 index 0000000000..48671191ca --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UIPolling.java @@ -0,0 +1,90 @@ +/* + * Copyright 2000-2013 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.ui; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.data.util.MethodProperty; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.tests.util.Log; +import com.vaadin.ui.TextField; + +public class UIPolling extends AbstractTestUIWithLog { + + protected static final long SLEEP_TIME = 500; + + private class BackgroundLogger extends Thread { + + @Override + public void run() { + int i = 0; + while (true) { + i++; + try { + Thread.sleep(SLEEP_TIME); + } catch (InterruptedException e) { + } + final int iteration = i; + access(new Runnable() { + @Override + public void run() { + log.log((iteration * SLEEP_TIME) + "ms has passed"); + } + }); + } + } + } + + private BackgroundLogger logger = null; + + @Override + protected void setup(VaadinRequest request) { + log = new Log(20); + log.setNumberLogRows(true); + TextField pollingInterval = new TextField("Poll interval", + new MethodProperty<Integer>(this, "pollInterval")); + pollingInterval.setImmediate(true); + pollingInterval.setValue("-1"); + pollingInterval.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + if (logger != null) { + logger.stop(); + logger = null; + } + if (getPollInterval() >= 0) { + logger = new BackgroundLogger(); + logger.start(); + } + } + }); + addComponent(pollingInterval); + + } + + @Override + protected String getTestDescription() { + return "Tests the polling feature of UI. Set the polling interval using the text field. Enabling polling will at the same time start a background thread which logs every 500ms"; + } + + @Override + protected Integer getTicketNumber() { + return 11495; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UISerialization.java b/uitest/src/com/vaadin/tests/components/ui/UISerialization.java index 5f3d8d97de..90021a0bf4 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UISerialization.java +++ b/uitest/src/com/vaadin/tests/components/ui/UISerialization.java @@ -20,15 +20,19 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.io.PrintWriter; import java.io.Serializable; +import java.io.StringWriter; import java.util.Date; import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Label; public class UISerialization extends AbstractTestUI { @@ -42,21 +46,29 @@ public class UISerialization extends AbstractTestUI { @Override public void buttonClick(ClickEvent event) { Date d = new Date(); - byte[] result = serialize(UISerialization.this); - long elapsed = new Date().getTime() - d.getTime(); - log.log("Serialized UI in " + elapsed + "ms into " - + result.length + " bytes"); - Object diffStateBefore = getConnectorTracker().getDiffState( - UISerialization.this); - UISerialization app = (UISerialization) deserialize(result); - log.log("Deserialized UI in " + elapsed + "ms"); - Object diffStateAfter = getConnectorTracker().getDiffState( - UISerialization.this); - if (diffStateBefore.equals(diffStateAfter)) { - log.log("Diff states match, size: " - + diffStateBefore.toString().length()); - } else { - log.log("Diff states do not match"); + try { + byte[] result = serialize(UISerialization.this); + long elapsed = new Date().getTime() - d.getTime(); + log.log("Serialized UI in " + elapsed + "ms into " + + result.length + " bytes"); + Object diffStateBefore = getConnectorTracker() + .getDiffState(UISerialization.this); + UISerialization app = (UISerialization) deserialize(result); + log.log("Deserialized UI in " + elapsed + "ms"); + Object diffStateAfter = getConnectorTracker().getDiffState( + UISerialization.this); + if (diffStateBefore.equals(diffStateAfter)) { + log.log("Diff states match, size: " + + diffStateBefore.toString().length()); + } else { + log.log("Diff states do not match"); + } + } catch (Exception e) { + log.log("Exception caught: " + e.getMessage()); + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + addComponent(new Label(sw.toString(), + ContentMode.PREFORMATTED)); } } @@ -64,20 +76,16 @@ public class UISerialization extends AbstractTestUI { } protected void serializeInstance(Class<?> cls) - throws InstantiationException, IllegalAccessException { + throws InstantiationException, IllegalAccessException, IOException { serialize((Serializable) cls.newInstance()); } - protected byte[] serialize(Serializable serializable) { + protected byte[] serialize(Serializable serializable) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); ObjectOutputStream oos; - try { - oos = new ObjectOutputStream(os); - oos.writeObject(serializable); - return os.toByteArray(); - } catch (IOException e) { - throw new RuntimeException("Serialization failed", e); - } + oos = new ObjectOutputStream(os); + oos.writeObject(serializable); + return os.toByteArray(); } protected Object deserialize(byte[] result) { diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccess.html b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html new file mode 100644 index 0000000000..613691623c --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html @@ -0,0 +1,166 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.ui.UiAccess?restartApplication</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td> + <td>exact:0. Access from UI thread future is done? false</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> + <td>1. Access from UI thread is run</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> + <td>exact:2. beforeClientResponse future is done? true</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> + <td>0. Initial background message</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> + <td>exact:1. Thread has current response? false</td> +</tr> +<tr> + <td>waitForText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td> + <td>0. Initial background message</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> + <td>exact:2. Thread got lock, inital future done? true</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td> + <td>0. Throwing exception in access</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> + <td>exact:1. firstFuture is done? true</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> + <td>2. Got exception from firstFuture: java.lang.RuntimeException: Catch me if you can</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> + <td>0. future was cancled, should not start</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td> + <td>0. Waiting for thread to start</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> + <td>1. Thread started, waiting for interruption</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> + <td>2. I was interrupted</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_3</td> + <td>0. accessSynchronously has request? true</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td> + <td>1. Test value in accessSynchronously: Set before accessSynchronosly</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> + <td>2. has request after accessSynchronously? true</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> + <td>3. Test value after accessSynchornously: Set in accessSynchronosly</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_3</td> + <td>0. access has request? false</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td> + <td>1. Test value in access: Set before access</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> + <td>2. has request after access? true</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> + <td>3. Test value after access: Set before run pending</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccess.java b/uitest/src/com/vaadin/tests/components/ui/UiAccess.java new file mode 100644 index 0000000000..297a985778 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UiAccess.java @@ -0,0 +1,306 @@ +/* + * Copyright 2000-2013 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.ui; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.locks.ReentrantLock; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.server.VaadinService; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.util.CurrentInstance; + +public class UiAccess extends AbstractTestUIWithLog { + + private Future<Void> checkFromBeforeClientResponse; + + private class CurrentInstanceTestType { + private String value; + + public CurrentInstanceTestType(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + + @Override + protected void setup(VaadinRequest request) { + addComponent(new Button("Access from UI thread", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + log.clear(); + // Ensure beforeClientResponse is invoked + markAsDirty(); + checkFromBeforeClientResponse = access(new Runnable() { + @Override + public void run() { + log("Access from UI thread is run"); + } + }); + log("Access from UI thread future is done? " + + checkFromBeforeClientResponse.isDone()); + } + })); + addComponent(new Button("Access from background thread", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + log.clear(); + final CountDownLatch latch = new CountDownLatch(1); + + new Thread() { + @Override + public void run() { + final boolean threadHasCurrentResponse = VaadinService + .getCurrentResponse() != null; + // session is locked by request thread at this + // point + final Future<Void> initialFuture = access(new Runnable() { + @Override + public void run() { + log("Initial background message"); + log("Thread has current response? " + + threadHasCurrentResponse); + } + }); + + // Let request thread continue + latch.countDown(); + + // Wait until thread can be locked + while (!getSession().getLockInstance() + .tryLock()) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + try { + log("Thread got lock, inital future done? " + + initialFuture.isDone()); + setPollInterval(-1); + } finally { + getSession().unlock(); + } + } + }.start(); + + // Wait for thread to do initialize before continuing + try { + latch.await(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + setPollInterval(3000); + } + })); + addComponent(new Button("Access throwing exception", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + log.clear(); + final Future<Void> firstFuture = access(new Runnable() { + @Override + public void run() { + log("Throwing exception in access"); + throw new RuntimeException( + "Catch me if you can"); + } + }); + access(new Runnable() { + @Override + public void run() { + log("firstFuture is done? " + + firstFuture.isDone()); + try { + firstFuture.get(); + log("Should not get here"); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } catch (ExecutionException e) { + log("Got exception from firstFuture: " + + e.getMessage()); + } + } + }); + } + })); + addComponent(new Button("Cancel future before started", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + log.clear(); + Future<Void> future = access(new Runnable() { + @Override + public void run() { + log("Should not get here"); + } + }); + future.cancel(false); + log("future was cancled, should not start"); + } + })); + addComponent(new Button("Cancel running future", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + log.clear(); + final ReentrantLock interruptLock = new ReentrantLock(); + + final Future<Void> future = access(new Runnable() { + @Override + public void run() { + log("Waiting for thread to start"); + while (!interruptLock.isLocked()) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + log("Premature interruption"); + throw new RuntimeException(e); + } + } + + log("Thread started, waiting for interruption"); + try { + interruptLock.lockInterruptibly(); + } catch (InterruptedException e) { + log("I was interrupted"); + } + } + }); + + new Thread() { + @Override + public void run() { + interruptLock.lock(); + // Wait until UI thread has started waiting for + // the lock + while (!interruptLock.hasQueuedThreads()) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + + future.cancel(true); + } + }.start(); + } + })); + addComponent(new Button("CurrentInstance accessSynchronously values", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + log.clear(); + // accessSynchronously should maintain values + CurrentInstance.set(CurrentInstanceTestType.class, + new CurrentInstanceTestType( + "Set before accessSynchronosly")); + accessSynchronously(new Runnable() { + @Override + public void run() { + log.log("accessSynchronously has request? " + + (VaadinService.getCurrentRequest() != null)); + log.log("Test value in accessSynchronously: " + + CurrentInstance + .get(CurrentInstanceTestType.class)); + CurrentInstance.set( + CurrentInstanceTestType.class, + new CurrentInstanceTestType( + "Set in accessSynchronosly")); + } + }); + log.log("has request after accessSynchronously? " + + (VaadinService.getCurrentRequest() != null)); + log("Test value after accessSynchornously: " + + CurrentInstance + .get(CurrentInstanceTestType.class)); + } + })); + addComponent(new Button("CurrentInstance access values", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + log.clear(); + // accessSynchronously should maintain values + CurrentInstance + .setInheritable(CurrentInstanceTestType.class, + new CurrentInstanceTestType( + "Set before access")); + access(new Runnable() { + @Override + public void run() { + log.log("access has request? " + + (VaadinService.getCurrentRequest() != null)); + log.log("Test value in access: " + + CurrentInstance + .get(CurrentInstanceTestType.class)); + CurrentInstance.setInheritable( + CurrentInstanceTestType.class, + new CurrentInstanceTestType( + "Set in access")); + } + }); + CurrentInstance.setInheritable( + CurrentInstanceTestType.class, + new CurrentInstanceTestType( + "Set before run pending")); + + getSession().runPendingAccessTasks(); + + log.log("has request after access? " + + (VaadinService.getCurrentRequest() != null)); + log("Test value after access: " + + CurrentInstance + .get(CurrentInstanceTestType.class)); + } + })); + } + + @Override + public void beforeClientResponse(boolean initial) { + if (checkFromBeforeClientResponse != null) { + log("beforeClientResponse future is done? " + + checkFromBeforeClientResponse.isDone()); + checkFromBeforeClientResponse = null; + } + } + + @Override + protected String getTestDescription() { + return "Test for various ways of using UI.access"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(11897); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/uitest/BackButtonTest.java b/uitest/src/com/vaadin/tests/components/uitest/BackButtonTest.java index d5bac0d509..7e7a084eed 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/BackButtonTest.java +++ b/uitest/src/com/vaadin/tests/components/uitest/BackButtonTest.java @@ -57,6 +57,7 @@ public class BackButtonTest extends AbstractTestUI { addComponent(l); Button b = new Button("Go to Page 2", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { l.setCaption("Data from Page 1 : " + value); getPage().setUriFragment("page2"); @@ -85,6 +86,7 @@ public class BackButtonTest extends AbstractTestUI { addComponent(f); f.addValueChangeListener(new ValueChangeListener() { + @Override public void valueChange(ValueChangeEvent event) { value = f.getValue(); p1.l.setCaption("Data from Page 2 : " + value); @@ -92,6 +94,7 @@ public class BackButtonTest extends AbstractTestUI { }); Button b = new Button("Go Back", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { getPage().setUriFragment("page1"); } diff --git a/uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html index 0308a09a16..614ae7bcda 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html +++ b/uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html @@ -289,7 +289,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>9,8</td> </tr> <tr> @@ -304,7 +304,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>11,6</td> </tr> <tr> @@ -319,7 +319,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>8,5</td> </tr> <tr> @@ -334,7 +334,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>9,6</td> </tr> <tr> @@ -349,7 +349,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>10,7</td> </tr> <tr> diff --git a/uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html index fb00029d8f..7d9ffc65b8 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html +++ b/uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html @@ -289,7 +289,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>9,8</td> </tr> <tr> @@ -304,7 +304,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>11,6</td> </tr> <tr> @@ -319,7 +319,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>8,5</td> </tr> <tr> @@ -334,7 +334,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>9,6</td> </tr> <tr> @@ -349,7 +349,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>10,7</td> </tr> <tr> diff --git a/uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html index 193c648916..d0ee96c7ef 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html +++ b/uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html @@ -289,7 +289,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>9,8</td> </tr> <tr> @@ -304,7 +304,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>11,6</td> </tr> <tr> @@ -319,7 +319,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>8,5</td> </tr> <tr> @@ -334,7 +334,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>9,6</td> </tr> <tr> @@ -349,7 +349,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>10,7</td> </tr> <tr> diff --git a/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html index b1340831bc..a330f5bf61 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html +++ b/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html @@ -289,7 +289,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>9,8</td> </tr> <tr> @@ -304,7 +304,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>11,6</td> </tr> <tr> @@ -319,7 +319,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>8,5</td> </tr> <tr> @@ -334,7 +334,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>9,6</td> </tr> <tr> @@ -349,7 +349,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>10,7</td> </tr> <tr> diff --git a/uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html index fadc503abd..61ba58a0e6 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html +++ b/uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html @@ -289,7 +289,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>9,8</td> </tr> <tr> @@ -304,7 +304,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>11,6</td> </tr> <tr> @@ -319,7 +319,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>8,5</td> </tr> <tr> @@ -334,7 +334,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>9,6</td> </tr> <tr> @@ -349,7 +349,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>10,7</td> </tr> <tr> diff --git a/uitest/src/com/vaadin/tests/components/upload/TestFileUploadSize.java b/uitest/src/com/vaadin/tests/components/upload/TestFileUploadSize.java index 32f5c93bfd..178f8f9393 100644 --- a/uitest/src/com/vaadin/tests/components/upload/TestFileUploadSize.java +++ b/uitest/src/com/vaadin/tests/components/upload/TestFileUploadSize.java @@ -28,6 +28,7 @@ public class TestFileUploadSize extends TestBase implements Receiver { Upload u = new Upload("Upload", new Upload.Receiver() { + @Override public OutputStream receiveUpload(String filename, String mimeType) { return baos; } @@ -35,12 +36,14 @@ public class TestFileUploadSize extends TestBase implements Receiver { u.setId("UPL"); u.addStartedListener(new Upload.StartedListener() { + @Override public void uploadStarted(StartedEvent event) { expectedSize.setValue(String.valueOf(event.getContentLength())); } }); u.addFinishedListener(new Upload.FinishedListener() { + @Override public void uploadFinished(FinishedEvent event) { label.setValue("Upload finished. Name: " + event.getFilename()); receivedSize.setValue(String.valueOf(baos.size())); @@ -62,6 +65,7 @@ public class TestFileUploadSize extends TestBase implements Receiver { addComponent(u); } + @Override public OutputStream receiveUpload(String filename, String MIMEType) { Notification.show("Receiving upload"); return new ByteArrayOutputStream(); diff --git a/uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java b/uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java index efe7eb20bf..42fab79376 100644 --- a/uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java +++ b/uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java @@ -9,7 +9,7 @@ public class CenteredWindowWithUndefinedSize extends TestBase { @Override protected String getDescription() { - return "The centered sub-window with undefined height and a 100% high layout should be rendered in the center of the screen and not in the top-left corner."; + return "The centered sub-window with undefined height and a undefined high layout should be rendered in the center of the screen and not in the top-left corner."; } @Override @@ -23,7 +23,7 @@ public class CenteredWindowWithUndefinedSize extends TestBase { layout.setMargin(true); Window centered = new Window("A window", layout); centered.setSizeUndefined(); - layout.setSizeFull(); + layout.setSizeUndefined(); centered.center(); Label l = new Label("This window should be centered"); diff --git a/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.html b/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.html index 6e3eb906b7..ac81dfdefb 100644 --- a/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.html +++ b/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.html @@ -17,11 +17,6 @@ <td></td> </tr> <tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> <td>click</td> <td>vaadin=runcomvaadintestscomponentswindowCloseSubWindow::PID_Sopensub/domChild[0]/domChild[0]</td> <td></td> @@ -45,7 +40,7 @@ <!--Click close in title bar--> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowCloseSubWindow::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentswindowCloseSubWindow::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td></td> </tr> <tr> diff --git a/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java b/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java index e2a59b6005..6aad3e9170 100644 --- a/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java +++ b/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java @@ -33,7 +33,7 @@ public class CloseSubWindow extends TestBase { private Window createClosableSubWindow(final String title) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); - layout.setSizeFull(); + layout.setSizeUndefined(); final Window window = new Window(title, layout); window.setSizeUndefined(); window.setClosable(true); diff --git a/uitest/src/com/vaadin/tests/components/window/LegacyWindowOpenTest.java b/uitest/src/com/vaadin/tests/components/window/LegacyWindowOpenTest.java index 175c3f6d8a..ad36e04d88 100644 --- a/uitest/src/com/vaadin/tests/components/window/LegacyWindowOpenTest.java +++ b/uitest/src/com/vaadin/tests/components/window/LegacyWindowOpenTest.java @@ -19,6 +19,7 @@ public class LegacyWindowOpenTest extends TestBase { addComponent(new Button("Window.open _blank always as popup", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { win.open(r, "_blank", true); } @@ -26,6 +27,7 @@ public class LegacyWindowOpenTest extends TestBase { addComponent(new Button("Window.open _blank NOT always as popup", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { win.open(r, "_blank", false); } @@ -33,6 +35,7 @@ public class LegacyWindowOpenTest extends TestBase { addComponent(new Button("Window.open _new always as popup", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { win.open(r, "_new", true); } @@ -40,6 +43,7 @@ public class LegacyWindowOpenTest extends TestBase { addComponent(new Button("Window.open _new NOT always as popup", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { win.open(r, "_new", false); } @@ -47,6 +51,7 @@ public class LegacyWindowOpenTest extends TestBase { addComponent(new Button( "Window execute Javascript window.open(www.google.com, _blank)", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { win.executeJavaScript("window.open(\"http://www.google.com\", \"_blank\");"); } @@ -54,6 +59,7 @@ public class LegacyWindowOpenTest extends TestBase { addComponent(new Button( "Window execute Javascript window.open(www.google.com, _blank, resizable=yes,menubar=yes,toolbar=yes,directories=yes,location=yes,scrollbars=yes,status=yes)", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { win.executeJavaScript("window.open(\"http://www.google.com\", \"_blank\", \"resizable=yes,menubar=yes,toolbar=yes,directories=yes,location=yes,scrollbars=yes,status=yes\");"); } diff --git a/uitest/src/com/vaadin/tests/components/window/PageOpenTest.java b/uitest/src/com/vaadin/tests/components/window/PageOpenTest.java index 2dbc24cb66..a566b09cdc 100644 --- a/uitest/src/com/vaadin/tests/components/window/PageOpenTest.java +++ b/uitest/src/com/vaadin/tests/components/window/PageOpenTest.java @@ -20,6 +20,7 @@ public class PageOpenTest extends AbstractTestUI { addComponent(new Button("Page.open _blank always as popup", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { page.open(url, "_blank", true); } @@ -27,6 +28,7 @@ public class PageOpenTest extends AbstractTestUI { addComponent(new Button("Page.open _blank NOT always as popup", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { page.open(url, "_blank", false); } @@ -34,6 +36,7 @@ public class PageOpenTest extends AbstractTestUI { addComponent(new Button("Page.open _new always as popup", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { page.open(url, "_new", true); } @@ -41,6 +44,7 @@ public class PageOpenTest extends AbstractTestUI { addComponent(new Button("Page.open _new NOT always as popup", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { page.open(url, "_new", false); } @@ -48,6 +52,7 @@ public class PageOpenTest extends AbstractTestUI { addComponent(new Button( "Execute Javascript window.open(www.google.com, _blank)", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { JavaScript .getCurrent() @@ -58,6 +63,7 @@ public class PageOpenTest extends AbstractTestUI { addComponent(new Button( "Execute Javascript window.open(www.google.com, _blank, resizable=yes,menubar=yes,toolbar=yes,directories=yes,location=yes,scrollbars=yes,status=yes)", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { JavaScript .getCurrent() diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindowOrder.html b/uitest/src/com/vaadin/tests/components/window/SubWindowOrder.html index 0476de6c35..8374a90b52 100644 --- a/uitest/src/com/vaadin/tests/components/window/SubWindowOrder.html +++ b/uitest/src/com/vaadin/tests/components/window/SubWindowOrder.html @@ -90,7 +90,7 @@ <!--Close window 4, which is the topmost window--> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[3]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[3]/domChild[0]/domChild[0]/domChild[2]</td> <td>11,15</td> </tr> <tr> @@ -101,7 +101,7 @@ <!--Close Dialog 3 (topmost)--> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[2]</td> <td>6,8</td> </tr> <!--Make Dialog 5 (topmost) non-modal--> @@ -139,7 +139,7 @@ <!--Close dialog 5--> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[2]</td> <td>10,5</td> </tr> <tr> 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..dcdfa05687 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html @@ -0,0 +1,259 @@ +<?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></td> + <td>window-2-original-pos-window-1-centered</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></td> + <td>window-1-maximized-on-top-of-window-2</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></td> + <td>window-2-original-pos-window-1-centered-again</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></td> + <td>window-2-maximized-on-top-of-window-1</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></td> + <td>window-2-closed-window-1-centered</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></td> + <td>window-2-added-maximized-on-top-of-window-1</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></td> + <td>window-1-maximized-with-doubleclick</td> +</tr> +<!--Test that size and position is preserved when maximizing and restoring--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>8,4</td> +</tr> +<tr> + <td>dragAndDrop</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>-200,-200</td> +</tr> +<tr> + <td>dragAndDrop</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[4]/domChild[0]</td> + <td>+100,+100</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>6,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>5,8</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>window-1-moved-maximized-restored</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..a8102a7d1a --- /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.WindowMode; +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.WindowModeChangeEvent; +import com.vaadin.ui.Window.WindowModeChangeListener; + +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.getWindowMode() == WindowMode.MAXIMIZED) { + w.setWindowMode(WindowMode.NORMAL); + maximize.setCaption("Maximize"); + } else { + w.setWindowMode(WindowMode.MAXIMIZED); + maximize.setCaption("Restore"); + } + } + + }; + maximize.addClickListener(listener); + ((ComponentContainer) w.getContent()).addComponent(maximize); + + w.addWindowModeChangeListener(new WindowModeChangeListener() { + + @Override + public void windowModeChanged(WindowModeChangeEvent event) { + WindowMode state = (event.getWindow().getWindowMode()); + if (state == WindowMode.NORMAL) { + w.setCaption("Window " + w.getData() + " Normal"); + maximize.setCaption("Maximize"); + } else if (state == WindowMode.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."; + } +} diff --git a/uitest/src/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html b/uitest/src/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html index 923276b613..fa63e5e1e6 100644 --- a/uitest/src/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html +++ b/uitest/src/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html @@ -18,7 +18,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowWithInvalidCloseListener::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowWithInvalidCloseListener::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> <td>6,7</td> </tr> <tr> diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.java index fa84c7cbb8..da3476610b 100644 --- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.java +++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.java @@ -53,6 +53,7 @@ public class TableQueryWithNonUniqueFirstPrimaryKey extends LegacyApplication { myCombo.setWidth("100.0%"); myCombo.setHeight("-1px"); myCombo.addValueChangeListener(new Property.ValueChangeListener() { + @Override public void valueChange(ValueChangeEvent event) { if (myCombo.getValue() != null) { Item item = myCombo.getItem(event.getProperty() diff --git a/uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html b/uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html index 11640ef6c3..ff5c731e5c 100644 --- a/uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html +++ b/uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html @@ -18,7 +18,7 @@ </tr> <tr> <td>assertElementPresent</td> - <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td> + <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td> <td></td> </tr> <tr> @@ -28,7 +28,7 @@ </tr> <tr> <td>assertElementPresent</td> - <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td> + <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td> <td></td> </tr> <tr> @@ -38,7 +38,7 @@ </tr> <tr> <td>assertElementNotPresent</td> - <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td> + <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td> <td></td> </tr> <tr> @@ -48,7 +48,7 @@ </tr> <tr> <td>assertElementNotPresent</td> - <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td> + <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td> <td></td> </tr> <tr> @@ -58,7 +58,7 @@ </tr> <tr> <td>assertElementNotPresent</td> - <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td> + <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td> <td></td> </tr> <tr> @@ -68,7 +68,7 @@ </tr> <tr> <td>assertElementNotPresent</td> - <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td> + <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td> <td></td> </tr> <tr> @@ -78,7 +78,7 @@ </tr> <tr> <td>assertElementNotPresent</td> - <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td> + <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td> <td></td> </tr> <tr> @@ -88,7 +88,7 @@ </tr> <tr> <td>assertElementNotPresent</td> - <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td> + <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td> <td></td> </tr> <tr> @@ -98,7 +98,7 @@ </tr> <tr> <td>assertElementNotPresent</td> - <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td> + <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td> <td></td> </tr> </tbody></table> diff --git a/uitest/src/com/vaadin/tests/debug/HierarchyAfterAnalyzeLayouts.html b/uitest/src/com/vaadin/tests/debug/HierarchyAfterAnalyzeLayouts.html index 03d8f34651..a0ebb3bf27 100644 --- a/uitest/src/com/vaadin/tests/debug/HierarchyAfterAnalyzeLayouts.html +++ b/uitest/src/com/vaadin/tests/debug/HierarchyAfterAnalyzeLayouts.html @@ -17,14 +17,19 @@ <td></td> </tr> <tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestsdebugHierarchyAfterAnalyzeLayouts::Root/VDebugConsole[0]/FlowPanel[0]/HorizontalPanel[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]</td> + <td>click</td> + <td>vaadin=runcomvaadintestsdebugHierarchyAfterAnalyzeLayouts::Root/VDebugWindow[0]/FlowPanel[0]/FlowPanel[0]/FlowPanel[0]/domChild[1]</td> <td>18,9</td> </tr> <tr> - <td>assertTextPresent</td> - <td>Layouts analyzed on server, total top level problems: 0</td> - <td></td> + <td>click</td> + <td>vaadin=runcomvaadintestsdebugHierarchyAfterAnalyzeLayouts::Root/VDebugWindow[0]/FlowPanel[0]/FlowPanel[0]/FlowPanel[2]/FlowPanel[0]/domChild[2]</td> + <td>18,9</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestsdebugHierarchyAfterAnalyzeLayouts::Root/VDebugWindow[0]/FlowPanel[0]/SimplePanel[0]/FlowPanel[0]/domChild[0]</td> + <td>Layouts analyzed, no top level problems</td> </tr> <tr> <td>assertElementPresent</td> diff --git a/uitest/src/com/vaadin/tests/fieldgroup/DateForm.html b/uitest/src/com/vaadin/tests/fieldgroup/DateForm.html new file mode 100644 index 0000000000..f141091805 --- /dev/null +++ b/uitest/src/com/vaadin/tests/fieldgroup/DateForm.html @@ -0,0 +1,42 @@ +<?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/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.fieldgroup.DateForm?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestsfieldgroupDateForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td> + <td>1/20/84</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestsfieldgroupDateForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td> + <td>1/20/84</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestsfieldgroupDateForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VDateFieldCalendar[0]/VCalendarPanel[0]#day20</td> + <td>v-inline-datefield-calendarpanel-day-selected</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestsfieldgroupDateForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VTextField[0]</td> + <td>Jan 20, 1984 4:34:49 PM</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java b/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java new file mode 100644 index 0000000000..3064856db9 --- /dev/null +++ b/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java @@ -0,0 +1,152 @@ +package com.vaadin.tests.fieldgroup; + +import java.util.Date; +import java.util.Locale; + +import com.vaadin.data.fieldgroup.BeanFieldGroup; +import com.vaadin.data.fieldgroup.FieldGroup; +import com.vaadin.data.fieldgroup.FieldGroup.CommitException; +import com.vaadin.data.fieldgroup.PropertyId; +import com.vaadin.data.util.BeanItem; +import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.data.bean.Person; +import com.vaadin.tests.util.Log; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.DateField; +import com.vaadin.ui.InlineDateField; +import com.vaadin.ui.Notification; +import com.vaadin.ui.PopupDateField; +import com.vaadin.ui.TextField; + +public class DateForm extends TestBase { + + private Log log = new Log(5); + @PropertyId("date1") + private DateField dateField; + @PropertyId("date2") + private PopupDateField popupDateField; + @PropertyId("date3") + private InlineDateField inlineDateField; + @PropertyId("date4") + private TextField textField; + + public static class DateObject { + private Date date1, date2, date3, date4; + + public DateObject(Date date1, Date date2, Date date3, Date date4) { + super(); + this.date1 = date1; + this.date2 = date2; + this.date3 = date3; + this.date4 = date4; + } + + public Date getDate1() { + return date1; + } + + public void setDate1(Date date1) { + this.date1 = date1; + } + + public Date getDate2() { + return date2; + } + + public void setDate2(Date date2) { + this.date2 = date2; + } + + public Date getDate3() { + return date3; + } + + public void setDate3(Date date3) { + this.date3 = date3; + } + + public Date getDate4() { + return date4; + } + + public void setDate4(Date date4) { + this.date4 = date4; + } + + } + + @Override + protected void setup() { + getMainWindow().setLocale(Locale.US); + addComponent(log); + final FieldGroup fieldGroup = new BeanFieldGroup<DateObject>( + DateObject.class); + fieldGroup.setBuffered(true); + + fieldGroup.buildAndBindMemberFields(this); + textField.setWidth("20em"); + addComponent(dateField); + addComponent(popupDateField); + addComponent(inlineDateField); + addComponent(textField); + + Button commitButton = new Button("Commit", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + String msg = "Commit succesful"; + try { + fieldGroup.commit(); + } catch (CommitException e) { + msg = "Commit failed: " + e.getMessage(); + } + Notification.show(msg); + log.log(msg); + + } + }); + Button discardButton = new Button("Discard", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + fieldGroup.discard(); + log.log("Discarded changes"); + + } + }); + Button showBean = new Button("Show bean values", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + log.log(getPerson(fieldGroup).toString()); + + } + }); + addComponent(commitButton); + addComponent(discardButton); + addComponent(showBean); + + DateObject d = new DateObject(new Date(443457289789L), new Date( + 443457289789L), new Date(443457289789L), + new Date(443457289789L)); + fieldGroup.setItemDataSource(new BeanItem<DateObject>(d)); + } + + public static Person getPerson(FieldGroup binder) { + return ((BeanItem<Person>) binder.getItemDataSource()).getBean(); + } + + @Override + protected String getDescription() { + return "Ensure FieldGroupFieldFactory supports Dates"; + } + + @Override + protected Integer getTicketNumber() { + return 8539; + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java b/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java new file mode 100644 index 0000000000..ec323f2db2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java @@ -0,0 +1,375 @@ +package com.vaadin.tests.layouts; + +import java.util.ArrayList; +import java.util.List; + +import com.vaadin.data.Item; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.ThemeResource; +import com.vaadin.server.UserError; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.AbstractField; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.Component; +import com.vaadin.ui.CssLayout; +import com.vaadin.ui.DateField; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Layout; +import com.vaadin.ui.NativeSelect; +import com.vaadin.ui.OptionGroup; +import com.vaadin.ui.PasswordField; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; +import com.vaadin.ui.VerticalLayout; + +public class CaptionsInLayoutsWaiAria extends TestBase { + + private static final Object CAPTION = "CAPTION"; + private static final Object CLASS = "C"; + private static final Object WIDTH = "W"; + + private NativeSelect layoutSelect; + private Layout layout; + private VerticalLayout verticalLayout; + private HorizontalLayout horizontalLayout; + private GridLayout gridLayout; + private FormLayout formLayout; + private List<AbstractField<?>> components = new ArrayList<AbstractField<?>>(); + private CssLayout cssLayout; + private HorizontalLayout layoutParent = new HorizontalLayout(); + + @Override + protected void setup() { + // setTheme("tests-tickets"); + addComponent(createLayoutSelect()); + addComponent(toggleRequired()); + // addComponent(toggleCaptions()); + // addComponent(toggleError()); + addComponent(toggleIcon()); + addComponent(toggleReadOnly()); + addComponent(toggleInvalid()); + addComponent(toggleEnabled()); + addComponent(addCaptionText()); + // layoutParent.addComponent(new + // NativeButton("Button right of layout")); + addComponent(layoutParent); + // addComponent(new NativeButton("Button below layout")); + createComponents(); + layoutSelect.setValue(layoutSelect.getItemIds().iterator().next()); + } + + private Component addCaptionText() { + Button b = new Button("Add caption text"); + b.addListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + prependCaptions("a"); + } + }); + return b; + } + + protected void prependCaptions(String prepend) { + for (AbstractField<?> c : components) { + c.setCaption(prepend + c.getCaption()); + } + + } + + private Component toggleRequired() { + CheckBox requiredToggle = new CheckBox(); + requiredToggle.setImmediate(true); + requiredToggle.setCaption("Required"); + requiredToggle.addListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + setRequired((Boolean) event.getProperty().getValue()); + } + }); + return requiredToggle; + } + + private Component toggleIcon() { + CheckBox iconToggle = new CheckBox(); + iconToggle.setImmediate(true); + iconToggle.setCaption("Icons"); + iconToggle.addListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + setIcon((Boolean) event.getProperty().getValue()); + } + }); + return iconToggle; + } + + private Component toggleReadOnly() { + CheckBox readOnlyToggle = new CheckBox(); + readOnlyToggle.setImmediate(true); + readOnlyToggle.setCaption("Read only"); + readOnlyToggle.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + setReadOnly((Boolean) event.getProperty().getValue()); + } + }); + + return readOnlyToggle; + } + + private Component toggleEnabled() { + CheckBox enabledToggle = new CheckBox(); + enabledToggle.setImmediate(true); + enabledToggle.setValue(true); + enabledToggle.setCaption("Enabled"); + enabledToggle.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + setEnabled((Boolean) event.getProperty().getValue()); + } + }); + + return enabledToggle; + } + + private Component toggleInvalid() { + CheckBox invalid = new CheckBox("Invalid"); + invalid.setImmediate(true); + invalid.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + setInvalid((Boolean) event.getProperty().getValue()); + } + }); + + return invalid; + } + + protected void setInvalid(boolean value) { + UserError userError = null; + if (value) { + userError = new UserError( + "Der eingegebene Wert ist nicht zulässig!"); + } + + for (AbstractField<?> c : components) { + c.setComponentError(userError); + } + } + + protected void setRequired(boolean value) { + for (AbstractField<?> c : components) { + c.setRequired(value); + } + + } + + protected void setIcon(boolean value) { + for (AbstractField<?> c : components) { + if (!value) { + c.setIcon(null); + } else { + c.setIcon(new ThemeResource("../runo/icons/16/ok.png")); + } + } + + } + + protected void setReadOnly(boolean value) { + for (AbstractField<?> c : components) { + c.setReadOnly(value); + } + } + + protected void setEnabled(boolean value) { + for (AbstractField<?> c : components) { + c.setEnabled(value); + } + } + + private Component toggleError() { + CheckBox errorToggle = new CheckBox(); + errorToggle.setImmediate(true); + errorToggle.setCaption("Error"); + errorToggle.addListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + setError((Boolean) event.getProperty().getValue()); + } + }); + return errorToggle; + } + + protected void setError(boolean value) { + for (AbstractField<?> c : components) { + if (value) { + c.setComponentError(new UserError("error")); + } else { + c.setComponentError(null); + + } + } + + } + + private void createComponents() { + components.add(new TextField("Default TextBox")); + components.add(new TextArea("Default TextArea.")); + // components.add(new RichTextArea("Default RichtTextArea")); + components.add(new PasswordField("Default Password")); + components.add(new DateField("Default DateField")); + + // PopupDateField popupDateField = new + // PopupDateField("Default DateField"); + // popupDateField.setTextFieldEnabled(false); + // components.add(popupDateField); + + components.add(new CheckBox("Default CheckBox")); + + ComboBox comboBox = new ComboBox("Default ComboBox"); + comboBox.addItem("Item1"); + components.add(comboBox); + + OptionGroup radioGroup = new OptionGroup("Single Items"); + radioGroup.addItem("Single Item 1"); + radioGroup.addItem("Single Item 2"); + radioGroup.setMultiSelect(false); + components.add(radioGroup); + + OptionGroup checkGroup = new OptionGroup("Multi Items"); + checkGroup.addItem("Multi Item 1"); + checkGroup.addItem("Multi Item 2"); + checkGroup.setMultiSelect(true); + components.add(checkGroup); + + // Tree tree = new Tree(); + // tree.setCaption("tree"); + // tree.addItem("single item"); + // components.add(tree); + } + + private void setLayout(Layout newLayout) { + if (layout == null) { + layoutParent.addComponent(newLayout, 0); + } else { + layoutParent.replaceComponent(layout, newLayout); + } + layout = newLayout; + + for (Component c : components) { + if (c.getParent() != layout) { + layout.addComponent(c); + } + } + + } + + private Layout getLayout(String caption, + Class<? extends Layout> layoutClass, String width) { + Layout l; + if (layoutClass == VerticalLayout.class) { + if (verticalLayout == null) { + verticalLayout = new VerticalLayout(); + verticalLayout.setStyleName("borders"); + } + l = verticalLayout; + } else if (layoutClass == HorizontalLayout.class) { + if (horizontalLayout == null) { + horizontalLayout = new HorizontalLayout(); + horizontalLayout.setStyleName("borders"); + } + l = horizontalLayout; + } else if (layoutClass == GridLayout.class) { + if (gridLayout == null) { + gridLayout = new GridLayout(); + gridLayout.setStyleName("borders"); + } + l = gridLayout; + } else if (layoutClass == CssLayout.class) { + if (cssLayout == null) { + cssLayout = new CssLayout(); + cssLayout.setStyleName("borders"); + } + l = cssLayout; + } else if (layoutClass == FormLayout.class) { + if (formLayout == null) { + formLayout = new FormLayout(); + formLayout.setStyleName("borders"); + } + l = formLayout; + } else { + return null; + } + + l.setCaption(caption); + if (width.equals("auto")) { + width = null; + } + + l.setWidth(width); + + // addComponent(l); + + return l; + } + + private Component createLayoutSelect() { + layoutSelect = new NativeSelect("Layout"); + layoutSelect.addContainerProperty(CAPTION, String.class, ""); + layoutSelect.addContainerProperty(CLASS, Class.class, ""); + layoutSelect.addContainerProperty(WIDTH, String.class, ""); + layoutSelect.setItemCaptionPropertyId(CAPTION); + layoutSelect.setNullSelectionAllowed(false); + + for (Class<?> cls : new Class[] { HorizontalLayout.class, + VerticalLayout.class, GridLayout.class, CssLayout.class, + FormLayout.class }) { + for (String width : new String[] { "auto" }) { + Object id = layoutSelect.addItem(); + Item i = layoutSelect.getItem(id); + i.getItemProperty(CAPTION).setValue( + cls.getSimpleName() + ", " + width); + i.getItemProperty(CLASS).setValue(cls); + i.getItemProperty(WIDTH).setValue(width); + } + + } + layoutSelect.setImmediate(true); + layoutSelect.addListener(new ValueChangeListener() { + + @Override + @SuppressWarnings("unchecked") + public void valueChange(ValueChangeEvent event) { + Item i = layoutSelect.getItem(event.getProperty().getValue()); + + setLayout(getLayout((String) i.getItemProperty(CAPTION) + .getValue(), (Class<? extends Layout>) i + .getItemProperty(CLASS).getValue(), (String) i + .getItemProperty(WIDTH).getValue())); + } + }); + + return layoutSelect; + } + + @Override + protected String getDescription() { + return "Tests what happens when the caption changes in various layouts. Behavior should be consistent."; + } + + @Override + protected Integer getTicketNumber() { + return 5424; + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java index bba8ccf120..fe2dd6cea8 100644 --- a/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java +++ b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java @@ -1,6 +1,5 @@ package com.vaadin.tests.layouts; -import com.vaadin.annotations.Theme; import com.vaadin.server.VaadinRequest; import com.vaadin.ui.Alignment; import com.vaadin.ui.HorizontalLayout; diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java index 2294b1909b..72863895a1 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java @@ -19,9 +19,14 @@ import com.vaadin.ui.themes.Reindeer; public class LayoutTesterApplication extends AbstractTestCase { Button nextButton = new Button("Next"); private int layoutIndex = -1; - private int layoutCount = 1; - private Method[] layoutGetters; + private static final String[] layoutGetters = new String[] { + "getCaptionsTests", "getIconsTests", + "getRequiredErrorIndicatorsTests", "getAlignmentTests", + "getExpandRatiosTests", "getMarginSpacingTests", + "getComponentAddReplaceMoveTests", "getComponentSizingTests", + "getLayoutSizingTests" }; + private LegacyWindow mainWindow; private NativeSelect layoutSelector; @@ -29,33 +34,32 @@ public class LayoutTesterApplication extends AbstractTestCase { public void init() { mainWindow = new LegacyWindow("LayoutTesterApplication"); setMainWindow(mainWindow); - loadLayoutGetters(); - nextLaytout(); + nextLayout(); nextButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -1577298910202253538L; @Override public void buttonClick(ClickEvent event) { - nextLaytout(); + nextLayout(); } }); } - private void nextLaytout() { + private void nextLayout() { try { mainWindow.removeAllComponents(); HorizontalLayout vlo = new HorizontalLayout(); vlo.setSpacing(true); ++layoutIndex; - if (layoutIndex >= layoutCount) { + if (layoutIndex >= layoutGetters.length) { layoutIndex = 0; } mainWindow.addComponent(vlo); vlo.addComponent(nextButton); vlo.addComponent(getLayoutTypeSelect()); - vlo.addComponent(new UndefWideLabel(layoutGetters[layoutIndex] - .getName())); + vlo.addComponent(new UndefWideLabel(getLayoutGetterMethod( + layoutGetters[layoutIndex]).getName())); Layout lo = null; if (layoutSelector.getValue() == VerticalLayout.class) { @@ -75,24 +79,34 @@ public class LayoutTesterApplication extends AbstractTestCase { } } - public void loadLayoutGetters() { - layoutGetters = AbstractLayoutTests.class.getDeclaredMethods(); - layoutCount = layoutGetters.length; + private Method getLayoutGetterMethod(String method) { + try { + return AbstractLayoutTests.class.getDeclaredMethod(method); + } catch (SecurityException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } } public Layout getVerticalTestLayout(int index) throws Exception { VerticalLayoutTests vlotest = new VerticalLayoutTests(this); - return (Layout) layoutGetters[index].invoke(vlotest, (Object[]) null); + return (Layout) getLayoutGetterMethod(layoutGetters[index]).invoke( + vlotest, (Object[]) null); } public Layout getHorizontalTestLayout(int index) throws Exception { HorizontalLayoutTests hlotest = new HorizontalLayoutTests(this); - return (Layout) layoutGetters[index].invoke(hlotest, (Object[]) null); + return (Layout) getLayoutGetterMethod(layoutGetters[index]).invoke( + hlotest, (Object[]) null); } public Layout getGridTestLayout(int index) throws Exception { GridLayoutTests hlotest = new GridLayoutTests(this); - return (Layout) layoutGetters[index].invoke(hlotest, (Object[]) null); + return (Layout) getLayoutGetterMethod(layoutGetters[index]).invoke( + hlotest, (Object[]) null); } private NativeSelect getLayoutTypeSelect() { @@ -110,7 +124,7 @@ public class LayoutTesterApplication extends AbstractTestCase { @Override public void valueChange(ValueChangeEvent event) { layoutIndex = -1; - nextLaytout(); + nextLayout(); } }); } diff --git a/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java new file mode 100644 index 0000000000..57ad0d97ba --- /dev/null +++ b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java @@ -0,0 +1,63 @@ +/* + * Copyright 2000-2013 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.minitutorials.broadcastingmessages; + +import java.util.ArrayList; +import java.util.List; + +public class Broadcaster { + + private static List<BroadcastListener> listeners = new ArrayList<BroadcastListener>(); + + public synchronized static void register(BroadcastListener listener) { + listeners.add(listener); + } + + public synchronized static void unregister(BroadcastListener listener) { + listeners.remove(listener); + } + + private synchronized static List<BroadcastListener> getListeners() { + List<BroadcastListener> listenerCopy = new ArrayList<BroadcastListener>(); + listenerCopy.addAll(listeners); + return listenerCopy; + } + + public static void broadcast(final String message) { + // Make a copy of the listener list while synchronized, can't be + // synchronized while firing the event or we would have to fire each + // event in a separate thread. + final List<BroadcastListener> listenerCopy = getListeners(); + + // We spawn another thread to avoid potential deadlocks with + // multiple UIs locked simultaneously + Thread eventThread = new Thread() { + @Override + public void run() { + for (BroadcastListener listener : listenerCopy) { + listener.receiveBroadcast(message); + } + } + }; + eventThread.start(); + } + + public interface BroadcastListener { + public void receiveBroadcast(String message); + } + +} diff --git a/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java new file mode 100644 index 0000000000..06ead20db3 --- /dev/null +++ b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java @@ -0,0 +1,57 @@ +package com.vaadin.tests.minitutorials.broadcastingmessages; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.minitutorials.broadcastingmessages.Broadcaster.BroadcastListener; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Notification; +import com.vaadin.ui.Notification.Type; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; + +public class BroadcasterUI extends UI implements BroadcastListener { + + @Override + protected void init(VaadinRequest request) { + final VerticalLayout layout = new VerticalLayout(); + layout.setMargin(true); + setContent(layout); + + final TextArea message = new TextArea("", + "The system is going down for maintenance in 10 minutes"); + layout.addComponent(message); + + final Button button = new Button("Broadcast"); + layout.addComponent(button); + button.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + Broadcaster.broadcast(message.getValue()); + } + }); + + // Register broadcast listener + Broadcaster.register(this); + } + + @Override + public void detach() { + Broadcaster.unregister(this); + super.detach(); + } + + @Override + public void receiveBroadcast(final String message) { + access(new Runnable() { + @Override + public void run() { + Notification n = new Notification("Message received", message, + Type.TRAY_NOTIFICATION); + n.show(getPage()); + } + }); + + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginMainView.java b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginMainView.java new file mode 100644 index 0000000000..cb59aa1608 --- /dev/null +++ b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginMainView.java @@ -0,0 +1,42 @@ +package com.vaadin.tests.minitutorials.v70; + +import com.vaadin.navigator.View; +import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.CssLayout; +import com.vaadin.ui.CustomComponent; +import com.vaadin.ui.Label; + +public class SimpleLoginMainView extends CustomComponent implements View { + + public static final String NAME = ""; + + Label text = new Label(); + + Button logout = new Button("Logout", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + + // "Logout" the user + getSession().setAttribute("user", null); + + // Refresh this view, should redirect to login view + getUI().getNavigator().navigateTo(NAME); + } + }); + + public SimpleLoginMainView() { + setCompositionRoot(new CssLayout(text, logout)); + } + + @Override + public void enter(ViewChangeEvent event) { + // Get the user name from the session + String username = String.valueOf(getSession().getAttribute("user")); + + // And show the username + text.setValue("Hello " + username); + } +} diff --git a/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginUI.java b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginUI.java new file mode 100644 index 0000000000..1f94d43abe --- /dev/null +++ b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginUI.java @@ -0,0 +1,64 @@ +package com.vaadin.tests.minitutorials.v70; + +import com.vaadin.navigator.Navigator; +import com.vaadin.navigator.ViewChangeListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.UI; + +public class SimpleLoginUI extends UI { + + @Override + protected void init(VaadinRequest request) { + + /* + * Create a new instance of the navigator. The navigator will attach + * itself automatically to this view. + */ + new Navigator(this, this); + + /* + * The initial log view where the user can login to the application + */ + getNavigator().addView(SimpleLoginView.NAME, SimpleLoginView.class); + + /* + * Add the main view of the application + */ + getNavigator().addView(SimpleLoginMainView.NAME, + SimpleLoginMainView.class); + + /* + * We use a view change handler to ensure the user is always redirected + * to the login view if the user is not logged in. + */ + getNavigator().addViewChangeListener(new ViewChangeListener() { + + @Override + public boolean beforeViewChange(ViewChangeEvent event) { + + // Check if a user has logged in + boolean isLoggedIn = getSession().getAttribute("user") != null; + boolean isLoginView = event.getNewView() instanceof SimpleLoginView; + + if (!isLoggedIn && !isLoginView) { + // Redirect to login view always if a user has not yet + // logged in + getNavigator().navigateTo(SimpleLoginView.NAME); + return false; + + } else if (isLoggedIn && isLoginView) { + // If someone tries to access to login view while logged in, + // then cancel + return false; + } + + return true; + } + + @Override + public void afterViewChange(ViewChangeEvent event) { + + } + }); + } +} diff --git a/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginView.java b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginView.java new file mode 100644 index 0000000000..3ff1c2df40 --- /dev/null +++ b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginView.java @@ -0,0 +1,137 @@ +package com.vaadin.tests.minitutorials.v70; + +import com.vaadin.data.validator.AbstractValidator; +import com.vaadin.data.validator.EmailValidator; +import com.vaadin.navigator.View; +import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; +import com.vaadin.shared.ui.MarginInfo; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.CustomComponent; +import com.vaadin.ui.PasswordField; +import com.vaadin.ui.TextField; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.Reindeer; + +public class SimpleLoginView extends CustomComponent implements View, + Button.ClickListener { + + public static final String NAME = "login"; + + private final TextField user; + + private final PasswordField password; + + private final Button loginButton; + + public SimpleLoginView() { + setSizeFull(); + + // Create the user input field + user = new TextField("User:"); + user.setWidth("300px"); + user.setRequired(true); + user.setInputPrompt("Your username (eg. joe@email.com)"); + user.addValidator(new EmailValidator( + "Username must be an email address")); + user.setInvalidAllowed(false); + + // Create the password input field + password = new PasswordField("Password:"); + password.setWidth("300px"); + password.addValidator(new PasswordValidator()); + password.setRequired(true); + password.setValue(""); + password.setNullRepresentation(""); + + // Create login button + loginButton = new Button("Login", this); + + // Add both to a panel + VerticalLayout fields = new VerticalLayout(user, password, loginButton); + fields.setCaption("Please login to access the application. (test@test.com/passw0rd)"); + fields.setSpacing(true); + fields.setMargin(new MarginInfo(true, true, true, false)); + fields.setSizeUndefined(); + + // The view root layout + VerticalLayout viewLayout = new VerticalLayout(fields); + viewLayout.setSizeFull(); + viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER); + viewLayout.setStyleName(Reindeer.LAYOUT_BLUE); + setCompositionRoot(viewLayout); + } + + @Override + public void enter(ViewChangeEvent event) { + // focus the username field when user arrives to the login view + user.focus(); + } + + /* + * Validator for validating the passwords + */ + private static final class PasswordValidator extends + AbstractValidator<String> { + + public PasswordValidator() { + super("The password provided is not valid"); + } + + @Override + protected boolean isValidValue(String value) { + /* + * Password must be at least 8 characters long and contain at least + * one number + */ + if (value != null + && (value.length() < 8 || !value.matches(".*\\d.*"))) { + return false; + } + return true; + } + + @Override + public Class<String> getType() { + return String.class; + } + } + + @Override + public void buttonClick(ClickEvent event) { + + /* + * Validate the fields using the navigator. By using validors for the + * fields we reduce the amount of queries we have to use to the database + * for wrongly entered passwords + */ + if (!user.isValid() || !password.isValid()) { + return; + } + + String username = user.getValue(); + String password = this.password.getValue(); + + /* + * Validate username and password with database here. For examples sake + * I use a dummy username and password. + */ + boolean isValid = username.equals("test@test.com") + && password.equals("passw0rd"); + + if (isValid) { + // Store the current user in the service session + getSession().setAttribute("user", username); + + // Navigate to main view + getUI().getNavigator().navigateTo(SimpleLoginMainView.NAME); + + } else { + + // Wrong password clear the password field and refocuses it + this.password.setValue(null); + this.password.focus(); + } + } +} diff --git a/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java b/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java new file mode 100644 index 0000000000..63e43b29f1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java @@ -0,0 +1,234 @@ +package com.vaadin.tests.minitutorials.v71beta; + +import java.util.Arrays; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.Page; +import com.vaadin.server.Page.Styles; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.MarginInfo; +import com.vaadin.shared.ui.colorpicker.Color; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.ColorPicker; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.Component; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.Panel; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.components.colorpicker.ColorChangeEvent; +import com.vaadin.ui.components.colorpicker.ColorChangeListener; + +public class CSSInjectWithColorpicker extends UI { + + @Override + protected void init(VaadinRequest request) { + + // Create a text editor + Component editor = createEditor("Lorem ipsum dolor sit amet, lacus pharetra sed, sit a " + + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi " + + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. " + + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis " + + "quam, ac urna eros est cras id cras, eleifend eu mattis nec." + + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a " + + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi " + + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. " + + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis " + + "quam, ac urna eros est cras id cras, eleifend eu mattis nec." + + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a " + + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi " + + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. " + + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis " + + "quam, ac urna eros est cras id cras, eleifend eu mattis nec." + + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a " + + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi " + + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. " + + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis " + + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."); + + VerticalLayout content = new VerticalLayout(editor); + content.setMargin(true); + setContent(content); + } + + /** + * Creates a text editor for visually editing text + * + * @param text + * The text editor + * @return + */ + private Component createEditor(String text) { + + Panel editor = new Panel("Text Editor"); + editor.setWidth("580px"); + + VerticalLayout panelContent = new VerticalLayout(); + panelContent.setSpacing(true); + panelContent.setMargin(new MarginInfo(true, false, false, false)); + editor.setContent(panelContent); + + // Create the toolbar + HorizontalLayout toolbar = new HorizontalLayout(); + toolbar.setSpacing(true); + toolbar.setMargin(new MarginInfo(false, false, false, true)); + + // Create the font family selector + toolbar.addComponent(createFontSelect()); + + // Create the font size selector + toolbar.addComponent(createFontSizeSelect()); + + // Create the text color selector + toolbar.addComponent(createTextColorSelect()); + + // Create the background color selector + toolbar.addComponent(createBackgroundColorSelect()); + + panelContent.addComponent(toolbar); + panelContent.setComponentAlignment(toolbar, Alignment.MIDDLE_LEFT); + + // Spacer between toolbar and text + panelContent.addComponent(new Label("<hr/>", ContentMode.HTML)); + + // The text to edit + TextArea textLabel = new TextArea(null, text); + textLabel.setWidth("100%"); + textLabel.setHeight("200px"); + + // IMPORTANT: We are here setting the style name of the label, we are + // going to use this in our injected styles to target the label + textLabel.setStyleName("text-label"); + + panelContent.addComponent(textLabel); + + return editor; + } + + /** + * Creates a background color select dialog + */ + private Component createBackgroundColorSelect() { + ColorPicker bgColor = new ColorPicker("Background", Color.WHITE); + bgColor.setWidth("110px"); + bgColor.setCaption("Background"); + bgColor.addColorChangeListener(new ColorChangeListener() { + + @Override + public void colorChanged(ColorChangeEvent event) { + + // Get the new background color + Color color = event.getColor(); + + // Get the stylesheet of the page + Styles styles = Page.getCurrent().getStyles(); + + // inject the new background color + styles.add(".v-app .v-textarea.text-label { background-color:" + + color.getCSS() + "; }"); + } + }); + return bgColor; + } + + /** + * Create a text color selction dialog + */ + private Component createTextColorSelect() { + + // Colorpicker for changing text color + ColorPicker textColor = new ColorPicker("Color", Color.BLACK); + textColor.setWidth("110px"); + textColor.setCaption("Color"); + textColor.addColorChangeListener(new ColorChangeListener() { + + @Override + public void colorChanged(ColorChangeEvent event) { + + // Get the new text color + Color color = event.getColor(); + + // Get the stylesheet of the page + Styles styles = Page.getCurrent().getStyles(); + + // inject the new color as a style + styles.add(".v-app .v-textarea.text-label { color:" + + color.getCSS() + "; }"); + } + }); + + return textColor; + } + + /** + * Creates a font family selection dialog + */ + private Component createFontSelect() { + final ComboBox select = new ComboBox(null, Arrays.asList("Arial", + "Helvetica", "Verdana", "Courier", "Times", "sans-serif")); + select.setValue("Arial"); + select.setWidth("200px"); + select.setInputPrompt("Font"); + select.setDescription("Font"); + select.setImmediate(true); + select.setNullSelectionAllowed(false); + select.setNewItemsAllowed(false); + + select.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + // Get the new font family + String fontFamily = select.getValue().toString(); + + // Get the stylesheet of the page + Styles styles = Page.getCurrent().getStyles(); + + // inject the new font size as a style. We need .v-app to + // override Vaadin's default styles here + styles.add(".v-app .v-textarea.text-label { font-family:" + + fontFamily + "; }"); + } + }); + + return select; + } + + /** + * Creates a font size selection control + */ + private Component createFontSizeSelect() { + + final ComboBox select = new ComboBox(null, Arrays.asList(8, 9, 10, 12, + 14, 16, 20, 25, 30, 40, 50)); + select.setWidth("100px"); + select.setValue(12); + select.setInputPrompt("Font size"); + select.setDescription("Font size"); + select.setImmediate(true); + select.setNullSelectionAllowed(false); + select.setNewItemsAllowed(false); + select.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + // Get the new font size + Integer fontSize = (Integer) select.getValue(); + + // Get the stylesheet of the page + Styles styles = Page.getCurrent().getStyles(); + + // inject the new font size as a style. We need .v-app to + // override Vaadin's default styles here + styles.add(".v-app .v-textarea.text-label { font-size:" + + String.valueOf(fontSize) + "px; }"); + } + }); + + return select; + } +} diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/AutoGeneratingForm.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/AutoGeneratingForm.java index 5547c1077e..a2723beab3 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/AutoGeneratingForm.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/AutoGeneratingForm.java @@ -46,7 +46,7 @@ public class AutoGeneratingForm extends UI { fieldGroup.setItemDataSource(new BeanItem<Person>(new Person("John", "Doe", 34))); - // Loop through the properties, build fields for them and add the fields + // Loop through the properties, build fields for them and add the fields // to this root for (Object propertyId : fieldGroup.getUnboundPropertyIds()) { layout.addComponent(fieldGroup.buildAndBind(propertyId)); diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b6/OpeningUIInPopup.java b/uitest/src/com/vaadin/tests/minitutorials/v7b6/OpeningUIInPopup.java index 2152e05f14..da9c73dd94 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7b6/OpeningUIInPopup.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7b6/OpeningUIInPopup.java @@ -27,16 +27,17 @@ public class OpeningUIInPopup extends UI { protected void init(VaadinRequest request) { Button popupButton = new Button("Open popup with MyPopupUI"); - BrowserWindowOpener popupOpener = new BrowserWindowOpener(MyPopupUI.class); + BrowserWindowOpener popupOpener = new BrowserWindowOpener( + MyPopupUI.class); popupOpener.setFeatures("height=300,width=300"); popupOpener.extend(popupButton); - + // Add a parameter popupOpener.setParameter("foo", "bar"); // Set a fragment popupOpener.setUriFragment("myfragment"); - + setContent(popupButton); } diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java index 7aaf810355..59708f2bc7 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java @@ -14,6 +14,7 @@ public class CountView extends Panel implements View { setContent(new Label("Created: " + count++)); } + @Override public void enter(ViewChangeEvent event) { } diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java index 3aa3e42a58..28f8443440 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java @@ -28,6 +28,7 @@ public class LoginView extends Panel implements View { layout.addComponent(password); final Button login = new Button("Login", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { Notification.show("Ok, let's pretend you're " + email); diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java index 3a1a685bbe..d37a39345f 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java @@ -42,6 +42,7 @@ public class MainView extends Panel implements View { layout.addComponent(lnk); logOut = new Button("Logout", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { ((NavigationtestUI) UI.getCurrent()).setLoggedInUser(null); diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java index 0eac6a042e..861fd9f8a4 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java @@ -41,6 +41,7 @@ public class MainViewEarlierExample extends Panel implements View { // login/logout toggle so we can test this Button logInOut = new Button("Toggle login", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { Object user = ((NavigationtestUI) UI.getCurrent()) .getLoggedInUser(); diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java index 61492adc39..74c4e68b93 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java @@ -43,6 +43,7 @@ public class SettingsView extends Panel implements View { date.setBuffered(true); // show buttons when date is changed date.addValueChangeListener(new ValueChangeListener() { + @Override public void valueChange(ValueChangeEvent event) { hideOrShowButtons(); pendingViewAndParameters = null; @@ -51,6 +52,7 @@ public class SettingsView extends Panel implements View { // commit the TextField changes when "Save" is clicked apply = new Button("Apply", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { date.commit(); hideOrShowButtons(); @@ -61,6 +63,7 @@ public class SettingsView extends Panel implements View { // Discard the TextField changes when "Cancel" is clicked cancel = new Button("Cancel", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { date.discard(); hideOrShowButtons(); @@ -72,6 +75,7 @@ public class SettingsView extends Panel implements View { // attach a listener so that we'll get asked isViewChangeAllowed? navigator.addViewChangeListener(new ViewChangeListener() { + @Override public boolean beforeViewChange(ViewChangeEvent event) { if (event.getOldView() == SettingsView.this && date.isModified()) { @@ -93,6 +97,7 @@ public class SettingsView extends Panel implements View { } } + @Override public void afterViewChange(ViewChangeEvent event) { pendingViewAndParameters = null; } diff --git a/uitest/src/com/vaadin/tests/push/BasicPush.html b/uitest/src/com/vaadin/tests/push/BasicPush.html new file mode 100644 index 0000000000..173ec90674 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/BasicPush.html @@ -0,0 +1,88 @@ +<?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/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run-push/com.vaadin.tests.push.BasicPush?restartApplication&debug</td> + <td></td> +</tr> +<!--Test client initiated push --> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td> + <td>0</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td> + <td>1</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td> + <td>4</td> +</tr> +<!--Test server initiated push--> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]</td> + <td>0</td> +</tr> +<tr> + <td>pause</td> + <td>3000</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]</td> + <td>1</td> +</tr> +<tr> + <td>pause</td> + <td>3000</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]</td> + <td>2</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/push/BasicPush.java b/uitest/src/com/vaadin/tests/push/BasicPush.java new file mode 100644 index 0000000000..b80d287a1d --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/BasicPush.java @@ -0,0 +1,105 @@ +package com.vaadin.tests.push; + +import java.util.Date; +import java.util.Timer; +import java.util.TimerTask; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.data.util.ObjectProperty; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.widgetset.TestingWidgetSet; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Label; + +@Widgetset(TestingWidgetSet.NAME) +public class BasicPush extends AbstractTestUI { + + private ObjectProperty<Integer> counter = new ObjectProperty<Integer>(0); + + private ObjectProperty<Integer> counter2 = new ObjectProperty<Integer>(0); + + private final Timer timer = new Timer(true); + + private final TimerTask task = new TimerTask() { + + @Override + public void run() { + access(new Runnable() { + @Override + public void run() { + counter2.setValue(counter2.getValue() + 1); + } + }); + } + }; + + @Override + protected void setup(VaadinRequest request) { + + spacer(); + + /* + * Client initiated push. + */ + Label lbl = new Label(counter); + lbl.setCaption("Client counter (click 'increment' to update):"); + addComponent(lbl); + + addComponent(new Button("Increment", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + counter.setValue(counter.getValue() + 1); + } + })); + + spacer(); + + /* + * Server initiated push. + */ + lbl = new Label(counter2); + lbl.setCaption("Server counter (updates each 3s by server thread) :"); + addComponent(lbl); + + addComponent(new Button("Reset", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + counter2.setValue(0); + } + })); + } + + @Override + protected String getTestDescription() { + return "This test tests the very basic operations of push. " + + "It tests that client initiated changes are " + + "recieved back to the client as well as server " + + "initiated changes are correctly updated to the client."; + } + + @Override + protected Integer getTicketNumber() { + return 11494; + } + + private void spacer() { + addComponent(new Label("<hr/>", ContentMode.HTML)); + } + + @Override + public void attach() { + super.attach(); + timer.scheduleAtFixedRate(task, new Date(), 3000); + } + + @Override + public void detach() { + super.detach(); + timer.cancel(); + } +} diff --git a/uitest/src/com/vaadin/tests/push/PushFromInit.html b/uitest/src/com/vaadin/tests/push/PushFromInit.html new file mode 100644 index 0000000000..d009eb3baf --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/PushFromInit.html @@ -0,0 +1,32 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run-push/com.vaadin.tests.push.PushFromInit?debug&restartApplication</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>vaadin=runpushcomvaadintestspushPushFromInit::PID_SLog_row_1</td> + <td>1. Logged in init</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushPushFromInit::PID_SLog_row_0</td> + <td>2. Logged from background thread started in init</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/push/PushFromInit.java b/uitest/src/com/vaadin/tests/push/PushFromInit.java new file mode 100644 index 0000000000..4b442de499 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/PushFromInit.java @@ -0,0 +1,36 @@ +package com.vaadin.tests.push; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Button; + +public class PushFromInit extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + new Thread() { + @Override + public void run() { + access(new Runnable() { + @Override + public void run() { + log("Logged from background thread started in init"); + } + }); + } + }.start(); + log("Logged in init"); + addComponent(new Button("Sync")); + } + + @Override + protected String getTestDescription() { + return "Pusing something to a newly created UI should not cause race conditions"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(11529); + } + +} diff --git a/uitest/src/com/vaadin/tests/push/PushReattachedComponent.html b/uitest/src/com/vaadin/tests/push/PushReattachedComponent.html new file mode 100644 index 0000000000..e1f6a5f048 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/PushReattachedComponent.html @@ -0,0 +1,47 @@ +<?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://192.168.2.162:8888/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run-push/com.vaadin.tests.components.panel.PanelChangeContents?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/Slot[1]/VPanel[0]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>stats</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/Slot[1]/VPanel[0]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>companies</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/Slot[1]/VPanel[0]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>stats</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/push/RoundTripTest.java b/uitest/src/com/vaadin/tests/push/RoundTripTest.java new file mode 100644 index 0000000000..ee0bf6dcb1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/RoundTripTest.java @@ -0,0 +1,77 @@ +/* + * Copyright 2000-2013 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.push; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.widgetset.TestingWidgetSet; +import com.vaadin.tests.widgetset.server.RoundTripTester; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.TextField; + +@Widgetset(TestingWidgetSet.NAME) +public class RoundTripTest extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final RoundTripTester roundTripTester = new RoundTripTester(); + final TextField payloadSize = new TextField("Payload size (bytes)"); + payloadSize.setConverter(Integer.class); + payloadSize.setConvertedValue(10000); + if (request.getParameter("payload") != null) { + payloadSize.setValue(request.getParameter("payload")); + } + addComponent(payloadSize); + final TextField testDuration = new TextField("Test duration (ms)"); + testDuration.setConverter(Integer.class); + testDuration.setConvertedValue(10000); + addComponent(testDuration); + if (request.getParameter("duration") != null) { + testDuration.setValue(request.getParameter("duration")); + } + + Button start = new Button("Start test"); + start.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + roundTripTester.start( + (Integer) testDuration.getConvertedValue(), + (Integer) payloadSize.getConvertedValue()); + } + }); + addComponent(roundTripTester); + addComponent(start); + + if (request.getParameter("go") != null) { + start.click(); + } + } + + @Override + protected String getTestDescription() { + return "Tests how many roundtrips per second you can get using the given package size"; + } + + @Override + protected Integer getTicketNumber() { + return 11370; + } + +} diff --git a/uitest/src/com/vaadin/tests/push/StreamingPush.html b/uitest/src/com/vaadin/tests/push/StreamingPush.html new file mode 100644 index 0000000000..cf94a09c63 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/StreamingPush.html @@ -0,0 +1,88 @@ +<?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/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run-push/com.vaadin.tests.push.BasicPush?restartApplication&debug&transport=streaming</td> + <td></td> +</tr> +<!--Test client initiated push --> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td> + <td>0</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td> + <td>1</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td> + <td>4</td> +</tr> +<!--Test server initiated push--> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]</td> + <td>0</td> +</tr> +<tr> + <td>pause</td> + <td>3000</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]</td> + <td>1</td> +</tr> +<tr> + <td>pause</td> + <td>3000</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]</td> + <td>2</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/push/TogglePush.html b/uitest/src/com/vaadin/tests/push/TogglePush.html new file mode 100644 index 0000000000..b752d2120c --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/TogglePush.html @@ -0,0 +1,91 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run-push/com.vaadin.tests.push.TogglePush?restartApplication</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>2000</td> + <td></td> +</tr> +<!--Push is enabled, so text gets updated--> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>Counter has been updated 1 times</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td> + <td>61,6</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>2000</td> + <td></td> +</tr> +<!--Push is disabled, so text is not updated--> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>Counter has been updated 1 times</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Direct update is visible, and includes previous update--> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>Counter has been updated 3 times</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td> + <td>61,3</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>2000</td> + <td></td> +</tr> +<!--Push is enabled again, so text gets updated--> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>Counter has been updated 4 times</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/push/TogglePush.java b/uitest/src/com/vaadin/tests/push/TogglePush.java new file mode 100644 index 0000000000..37687260dd --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/TogglePush.java @@ -0,0 +1,85 @@ +package com.vaadin.tests.push; + +import java.util.Timer; +import java.util.TimerTask; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.communication.PushMode; +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.Label; + +public class TogglePush extends AbstractTestUI { + private final Label counterLabel = new Label(); + private int counter = 0; + + @Override + protected void setup(VaadinRequest request) { + updateCounter(); + addComponent(counterLabel); + + setPushMode("disabled".equals(request.getParameter("push")) ? PushMode.DISABLED + : PushMode.AUTOMATIC); + + CheckBox pushSetting = new CheckBox("Push enabled"); + pushSetting.setValue(Boolean.valueOf(getPushMode().isEnabled())); + pushSetting.setImmediate(true); + pushSetting.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + if (event.getProperty().getValue() == Boolean.TRUE) { + setPushMode(PushMode.AUTOMATIC); + } else { + setPushMode(PushMode.DISABLED); + } + } + }); + addComponent(pushSetting); + + addComponent(new Button("Update counter now", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + updateCounter(); + } + })); + + addComponent(new Button("Update counter in 1 sec", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + new Timer().schedule(new TimerTask() { + @Override + public void run() { + access(new Runnable() { + @Override + public void run() { + updateCounter(); + } + }); + } + }, 1000); + } + })); + } + + public void updateCounter() { + counterLabel.setValue("Counter has been updated " + counter++ + + " times"); + } + + @Override + protected String getTestDescription() { + return "Basic test for enabling and disabling push on the fly."; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(11506); + } + +} diff --git a/uitest/src/com/vaadin/tests/push/TogglePushInInit.html b/uitest/src/com/vaadin/tests/push/TogglePushInInit.html new file mode 100644 index 0000000000..c735f225e1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/TogglePushInInit.html @@ -0,0 +1,69 @@ +<?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:8071/" /> +<title>TogglePushInInit</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">TogglePushInInit</td></tr> +</thead><tbody> +<!--Open with push disabled--> +<tr> + <td>open</td> + <td>/run-push/com.vaadin.tests.push.TogglePush?restartApplication&push=disabled</td> + <td></td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td> + <td>off</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>2000</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>Counter has been updated 0 times</td> +</tr> +<!--Open with push enabled--> +<tr> + <td>open</td> + <td>/run-push/com.vaadin.tests.push.TogglePush?restartApplication&push=enabled</td> + <td></td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td> + <td>on</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>2000</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>Counter has been updated 1 times</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.html b/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.html index 16f3db6a1a..543faa30dd 100644 --- a/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.html +++ b/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.html @@ -53,7 +53,12 @@ </tr> <tr> <td>assertTextPresent</td> - <td>/APP can not be found</td> + <td>HTTP ERROR 404</td> + <td></td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>Problem accessing /run/APP/</td> <td></td> </tr> <tr> diff --git a/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.java b/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.java index dfd664c9cf..a6a5a5a084 100644 --- a/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.java +++ b/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.java @@ -23,8 +23,8 @@ public class AppResource404 extends TestBase { addComponent(new Link("Existing resource", resource)); addComponent(new Link("Non-existing resource", new ExternalResource( baseUrl + "/APP/connector/0/4/asdfasdf"))); - addComponent(new Link("/APP url that should give 404", - new ExternalResource(baseUrl + "/APP"))); + addComponent(new Link("/APP/ url that should give 404", + new ExternalResource(baseUrl + "/APP/"))); addComponent(new Link("/APPLE url that should go to UI providers", new ExternalResource(baseUrl + "/APPLE"))); } diff --git a/uitest/src/com/vaadin/tests/themes/CSSInjectTest.html b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.html new file mode 100644 index 0000000000..0c70d6f711 --- /dev/null +++ b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.html @@ -0,0 +1,66 @@ +<?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/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.themes.CSSInjectTest?restartApplication</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>hello-world-gray</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadinteststhemesCSSInjectTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VTextArea[0]</td> + <td>.hello{color:blue;}</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadinteststhemesCSSInjectTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>hello-blue</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadinteststhemesCSSInjectTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VTextArea[0]</td> + <td>.world{color:red;}</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadinteststhemesCSSInjectTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>world-red</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadinteststhemesCSSInjectTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>world-still-red</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java new file mode 100644 index 0000000000..738d8fc681 --- /dev/null +++ b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java @@ -0,0 +1,97 @@ +package com.vaadin.tests.themes; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.UUID; + +import com.vaadin.server.Page; +import com.vaadin.server.Page.Styles; +import com.vaadin.server.StreamResource; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Label; +import com.vaadin.ui.TextArea; + +public class CSSInjectTest extends TestBase { + + @Override + protected void setup() { + + final Styles stylesheet = Page.getCurrent().getStyles(); + + // Inject some resources initially + final StreamResource initialResource = new StreamResource( + new StreamResource.StreamSource() { + + @Override + public InputStream getStream() { + return new ByteArrayInputStream( + ".hello, .world { color:silver; }".getBytes()); + } + }, "mystyles-" + System.currentTimeMillis() + ".css"); + stylesheet.add(initialResource); + + Label hello = new Label( + "<span class='hello'>Hello</span> <span class='world'>world</span>", + ContentMode.HTML); + addComponent(hello); + + final TextArea cssToInject = new TextArea(); + cssToInject.setImmediate(true); + addComponent(cssToInject); + + Button inject = new Button("Inject!", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + stylesheet.add(cssToInject.getValue()); + cssToInject.setValue(""); + } + }); + addComponent(inject); + + Button injectRandom = new Button("Inject as resource!", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + + final String css = cssToInject.getValue(); + + stylesheet.add(new StreamResource( + new StreamResource.StreamSource() { + + @Override + public InputStream getStream() { + return new ByteArrayInputStream(css + .getBytes()); + } + }, UUID.randomUUID().toString() + ".css")); + + cssToInject.setValue(""); + } + }); + addComponent(injectRandom); + + addComponent(new Button("Inject initial again!", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + stylesheet.add(initialResource); + } + })); + } + + @Override + protected String getDescription() { + return "Demonstrates how CSS injections can be used to theme the \"Hello world\" label below"; + } + + @Override + protected Integer getTicketNumber() { + return 5500; + } + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml index 919a4a5d69..fd52e5cd0e 100644 --- a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml +++ b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml @@ -1,11 +1,16 @@ <module> - <!-- WS Compiler: manually edited --> + <!-- WS Compiler: manually edited --> + + <!-- Inherit the DefaultWidgetSet --> + <inherits name="com.vaadin.DefaultWidgetSet" /> - <!-- Inherit the DefaultWidgetSet --> - <inherits name="com.vaadin.DefaultWidgetSet" /> - <replace-with class="com.vaadin.tests.widgetset.client.CustomUIConnector"> <when-type-is class="com.vaadin.client.ui.ui.UIConnector" /> </replace-with> - + + <replace-with + class="com.vaadin.tests.widgetset.client.TestingPushConnection"> + <when-type-is class="com.vaadin.client.communication.PushConnection" /> + </replace-with> + </module> diff --git a/uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterConnector.java new file mode 100644 index 0000000000..94972d92f4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterConnector.java @@ -0,0 +1,106 @@ +/* + * Copyright 2000-2013 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.widgetset.client; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gwt.core.client.Duration; +import com.google.gwt.user.client.ui.HTML; +import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.widgetset.server.RoundTripTester; + +@Connect(RoundTripTester.class) +public class RoundTripTesterConnector extends AbstractComponentConnector { + + private double lastPrintedTime = -1; + private int receivedPings = 0; + private List<Double> throughputData = new ArrayList<Double>(); + private int payloadSize = 0; + + @Override + protected void init() { + super.init(); + registerRpc(RoundTripTesterRpc.class, new RoundTripTesterRpc() { + + @Override + public void ping(int nr, String payload) { + getRpcProxy(RoundTripTesterRpc.class).ping(nr + 1, payload); + payloadSize = payload.length(); + + double now = Duration.currentTimeMillis(); + if (lastPrintedTime == -1) { + lastPrintedTime = now; + return; + } + receivedPings++; + + if (now - lastPrintedTime > 1000) { + double roundtripsPerSecond = receivedPings + / (now - lastPrintedTime) * 1000; + throughputData.add(roundtripsPerSecond); + getWidget().setText( + roundtripsPerSecond + " roundtrips/second"); + + lastPrintedTime = now; + receivedPings = 0; + } + + } + + @Override + public void done() { + String result = "Test results for payload of size " + + payloadSize + ":"; + double max = -1; + double min = 1239482038939.0; + double avg = 0; + + for (Double throughput : throughputData) { + if (throughput > max) { + max = throughput; + } + if (throughput < min) { + min = throughput; + } + + avg += throughput; + } + avg /= throughputData.size(); + + for (Double throughput : throughputData) { + result += "<br/>" + formatThroughput(throughput); + } + result += "<br/>Max: " + formatThroughput(max); + result += "<br/>Min: " + formatThroughput(min); + result += "<br/>Average: " + formatThroughput(avg); + getWidget().setHTML(result); + getRpcProxy(RoundTripTesterRpc.class).done(); + } + + private String formatThroughput(double throughput) { + return throughput + " roundtrips / second"; + } + }); + } + + @Override + public HTML getWidget() { + return (HTML) super.getWidget(); + } + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterRpc.java b/uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterRpc.java new file mode 100644 index 0000000000..24c981e0c2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterRpc.java @@ -0,0 +1,25 @@ +/* + * Copyright 2000-2013 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.widgetset.client; + +import com.vaadin.shared.communication.ClientRpc; +import com.vaadin.shared.communication.ServerRpc; + +public interface RoundTripTesterRpc extends ServerRpc, ClientRpc { + public void ping(int nr, String payload); + + public void done(); +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java b/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java new file mode 100644 index 0000000000..e255a5f95a --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java @@ -0,0 +1,32 @@ +package com.vaadin.tests.widgetset.client; + +import com.google.gwt.user.client.Window; +import com.vaadin.client.ApplicationConnection; +import com.vaadin.client.ApplicationConnection.CommunicationErrorHandler; +import com.vaadin.client.communication.AtmospherePushConnection; + +public class TestingPushConnection extends AtmospherePushConnection { + + private String transport; + + @Override + public void init(ApplicationConnection connection, + CommunicationErrorHandler errorHandler) { + super.init(connection, errorHandler); + transport = Window.Location.getParameter("transport"); + } + + /* + * Force transport + */ + @Override + protected AtmosphereConfiguration createConfig() { + AtmosphereConfiguration conf = super.createConfig(); + if (transport != null) { + conf.setTransport(transport); + conf.setFallbackTransport(transport); + } + return conf; + } + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/server/RoundTripTester.java b/uitest/src/com/vaadin/tests/widgetset/server/RoundTripTester.java new file mode 100644 index 0000000000..c8e561e665 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/server/RoundTripTester.java @@ -0,0 +1,60 @@ +/* + * Copyright 2000-2013 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.widgetset.server; + +import com.vaadin.tests.util.LoremIpsum; +import com.vaadin.tests.widgetset.client.RoundTripTesterRpc; +import com.vaadin.ui.AbstractComponent; + +public class RoundTripTester extends AbstractComponent { + private long testStart = 0; + private long testEnd = 0; + + public RoundTripTester() { + registerRpc(new RoundTripTesterRpc() { + @Override + public void ping(int nr, String payload) { + if (System.currentTimeMillis() < testEnd) { + getRpcProxy(RoundTripTesterRpc.class).ping(nr + 1, payload); + } else { + getRpcProxy(RoundTripTesterRpc.class).done(); + } + } + + @Override + public void done() { + } + }); + } + + public void start(long testDuration, int payloadSize) { + testStart = System.currentTimeMillis(); + testEnd = testStart + testDuration; + getRpcProxy(RoundTripTesterRpc.class).ping(1, + generatePayload(payloadSize)); + } + + private String generatePayload(int payloadSize) { + StringBuilder sb = new StringBuilder(); + while (payloadSize > 10000) { + payloadSize -= 10000; + sb.append(LoremIpsum.get(10000)); + } + sb.append(LoremIpsum.get(payloadSize)); + return sb.toString(); + } + +} |