diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-07-15 09:15:13 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2013-07-15 09:15:13 +0300 |
commit | f0d8ccd131a5a63a2f5624dd8ef1643d4268f62d (patch) | |
tree | cb80d9096aeb554d545f932d0e51b013c4d0e830 /uitest/src | |
parent | c44ca1270523c544b9aedabe7f9780a5e6862859 (diff) | |
parent | a93426164d5766fd7e0a687c1a7c98ce53aaa1c7 (diff) | |
download | vaadin-framework-f0d8ccd131a5a63a2f5624dd8ef1643d4268f62d.tar.gz vaadin-framework-f0d8ccd131a5a63a2f5624dd8ef1643d4268f62d.zip |
Merge changes from origin/7.1
419c6c7 Implemented Focusable in MenuBar (#7674)
a4f1277 Fixed NPE in ApplicationRunnerServlet (#12145)
08d365a Fixed slider value initialization on HSV and RGB tabs of ColorPicker. (#7863)
da480bd Fix VaadinService.findUI to throw Error if UIConstants.UI_ID_PARAMETER is not set (#11943)
6291a50 Ensure that Slider diffstate always contains "value" (#12133)
7e7e698 32x32 favicons added, replacing the old favicons (#12143)
1702059 Replace printStackTrace with getLogger().log() (#12147)
b421d6e Updated Javadoc for Table.getColumnAlignment fixing #6810
414e3bf Fixed an error in CustomComponent JavaDoc (#10038), and some improvements.
4583d07 Fix NPE in Like.java (#10167)
6c4da29 Ensure table's cells aren't refreshed if table is detached. (#9138)
e37464c #11638: Ending an imported SCSS file with a comment causes an error in the Sass
478eeb5 Test using Jetty 9 (#12124)
f7cc72d Close only combobox on escape, not the window (#12163)
9a9b0a5 Automatic test for escape closing window from combobox (#12163)
ae565a2 Fix bug in PopupDateField where locale was retained incorrectly if changed while popup was open (#12153)
d7a64fd Enable native scrolling in home screen apps on iOS 6+ (#12149)
4a04f00 Add test case for testing ClickEvent after dragging button (#7690)
775c969 Make UploadInterruptedException visible (#12070)
6a4bbe5 Set heartbeat response Content-Type to text/plain (#12182)
e4011c6 When InputStream cannot be opened while writing static resource response, display 404 instead of 500 (#10920)
20162db Set current instances when calling UI.push from VaadinSession.unlock (#12168)
94c0f86 Ensure VaadinSession.service is set up by storeInSession (#12204)
23ed487 Attempt to get GAE lock for UIDL requests (#12211)
7f52b2e Improved AbstractClientConnector performance (#12219)
a934261 Improving performance of ConnectorTracker (#12218)
Change-Id: I810124d60c22d4d0ab837a19eb9c2689951864b5
Diffstat (limited to 'uitest/src')
16 files changed, 841 insertions, 1 deletions
diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java index 8c7edcac2e..a2f3c59f07 100644 --- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -18,6 +18,8 @@ package com.vaadin.launcher; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.util.Collections; import java.util.LinkedHashSet; @@ -64,7 +66,13 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { String str = TestBase.class.getName().replace('.', '/') + ".class"; URL url = getService().getClassLoader().getResource(str); if ("file".equals(url.getProtocol())) { - File comVaadinTests = new File(url.getPath()).getParentFile() + String path = url.getPath(); + try { + path = new URI(path).getPath(); + } catch (URISyntaxException e) { + getLogger().log(Level.FINE, "Failed to decode url", e); + } + File comVaadinTests = new File(path).getParentFile() .getParentFile(); addDirectories(comVaadinTests, defaultPackages, "com.vaadin.tests"); diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonIOSDragTest.java b/uitest/src/com/vaadin/tests/components/button/ButtonIOSDragTest.java new file mode 100644 index 0000000000..3d3d90728a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/button/ButtonIOSDragTest.java @@ -0,0 +1,57 @@ +/* + * 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.button; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.DragAndDropWrapper; +import com.vaadin.ui.DragAndDropWrapper.DragStartMode; +import com.vaadin.ui.Notification; +import com.vaadin.ui.VerticalLayout; + +public class ButtonIOSDragTest extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final VerticalLayout layout = new VerticalLayout(); + + Button offset = new Button("Drag me"); + offset.addListener(new ClickListener() { + @Override + public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { + Notification.show("Button clicked!"); + } + }); + DragAndDropWrapper dragMe = new DragAndDropWrapper(offset); + dragMe.setDragStartMode(DragStartMode.WRAPPER); + layout.addComponent(dragMe); + addComponent(layout); + } + + @Override + protected String getTestDescription() { + return "Test dragging of Button in iOS - dragging from the inside of the button to the outside and releasing should not cause a ClickEvent to be fired."; + } + + @Override + protected Integer getTicketNumber() { + return 7690; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerHsvTest.html b/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerHsvTest.html new file mode 100644 index 0000000000..1c53673b41 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerHsvTest.html @@ -0,0 +1,37 @@ +<?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>ColorPickerTest</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">ColorPickerTest</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.colorpicker.ColorPickerHsvTest?restartApplication</td> + <td></td> +</tr> +<!-- verify HSV sliders when initially opening the tab, ticket #7863 --> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerHsvTest::PID_Scolorpicker/domChild[1]</td> + <td>20,16</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerHsvTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> + <td>16,5</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>hsv-initial-sliders</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerHsvTest.java b/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerHsvTest.java new file mode 100644 index 0000000000..ab77fbf2ba --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerHsvTest.java @@ -0,0 +1,41 @@ +package com.vaadin.tests.components.colorpicker; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.colorpicker.Color; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.ColorPickerArea; +import com.vaadin.ui.Label; +import com.vaadin.ui.VerticalLayout; + +/** + * Tests the HSV tab slider values when initially opening the tab. + */ +public class ColorPickerHsvTest extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + VerticalLayout layout = new VerticalLayout(); + layout.setMargin(true); + setContent(layout); + + layout.addComponent(new Label( + "HSV initial values when opening the tab for the first time")); + ColorPickerArea colorpicker = new ColorPickerArea(); + colorpicker.setColor(new Color(Integer.parseInt("00b4f0", 16))); + colorpicker.setDefaultCaptionEnabled(false); + colorpicker.setId("colorpicker"); + layout.addComponent(colorpicker); + + } + + @Override + protected String getTestDescription() { + return "Tests the slider values when initially opening the HSV tab."; + } + + @Override + protected Integer getTicketNumber() { + return 7863; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/combobox/EscapeClosesComboboxNotWindow.html b/uitest/src/com/vaadin/tests/components/combobox/EscapeClosesComboboxNotWindow.html new file mode 100644 index 0000000000..312fffcb97 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/EscapeClosesComboboxNotWindow.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="" /> +<title>EscapeClosesComboboxNotWindow</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">EscapeClosesComboboxNotWindow</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/EscapeClosesComboboxNotWindow?restartApplication</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runEscapeClosesComboboxNotWindow::/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runEscapeClosesComboboxNotWindow::/VWindow[0]/FocusableScrollPanel[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[1]</td> + <td>10,16</td> +</tr> +<tr> + <td>keyDown</td> + <td>vaadin=runEscapeClosesComboboxNotWindow::/VWindow[0]/FocusableScrollPanel[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td> + <td>\27</td> +</tr> +<tr> + <td>verifyTextPresent</td> + <td>Window</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/combobox/EscapeClosesComboboxNotWindow.java b/uitest/src/com/vaadin/tests/components/combobox/EscapeClosesComboboxNotWindow.java new file mode 100644 index 0000000000..dcd19f6b2a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/EscapeClosesComboboxNotWindow.java @@ -0,0 +1,43 @@ +package com.vaadin.tests.components.combobox; + +import com.vaadin.event.ShortcutAction.KeyCode; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +/** + * Ticket #12163: when a combo box popup is open in a subwindow, escape should + * only close it and not the window, also on Safari 6. + */ +public class EscapeClosesComboboxNotWindow extends UI { + final Window window = new Window("Window"); + + @Override + protected void init(VaadinRequest request) { + final VerticalLayout layout = new VerticalLayout(); + layout.setMargin(true); + setContent(layout); + + Button button = new Button("Click Me"); + button.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + final FormLayout content = new FormLayout(); + ComboBox cb = new ComboBox(); + cb.addItem("foo"); + cb.addItem("bar"); + content.addComponent(cb); + window.setContent(content); + window.setCloseShortcut(KeyCode.ESCAPE); + UI.getCurrent().addWindow(window); + } + }); + layout.addComponent(button); + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.html b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.html new file mode 100644 index 0000000000..932ad0646e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.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="" /> +<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.PopupDateFieldLocaleTest?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldLocaleTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPopupCalendar[0]/domChild[1]</td> + <td>15,18</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>19,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldLocaleTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPopupCalendar[0]/domChild[1]</td> + <td>4,14</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td></td> + <td>janvier 2000</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.java new file mode 100644 index 0000000000..f12a3dda58 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.java @@ -0,0 +1,53 @@ +package com.vaadin.tests.components.datefield; + +import java.util.Calendar; +import java.util.Locale; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.DateField; +import com.vaadin.ui.PopupDateField; + +public class PopupDateFieldLocaleTest extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + // Set a specific time for the PopupDateField + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.YEAR, 2000); + cal.set(Calendar.DAY_OF_YEAR, 1); + cal.set(Calendar.HOUR_OF_DAY, 1); + cal.set(Calendar.MINUTE, 1); + cal.set(Calendar.SECOND, 1); + cal.set(Calendar.MILLISECOND, 1); + + final PopupDateField pdf = new PopupDateField(); + pdf.setLocale(Locale.ENGLISH); + pdf.setValue(cal.getTime()); + pdf.setImmediate(true); + pdf.setResolution(DateField.RESOLUTION_SEC); + addComponent(pdf); + + pdf.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + pdf.setLocale(Locale.FRENCH); + } + }); + } + + @Override + protected String getTestDescription() { + return "Changing the locale while the popupdatefield is visible can " + + "result in the locale remaining at the previous value; the locale " + + "is only changed once the current month is changed."; + } + + @Override + protected Integer getTicketNumber() { + return 12135; + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/menubar/MenuBarFocus.html b/uitest/src/com/vaadin/tests/components/menubar/MenuBarFocus.html new file mode 100644 index 0000000000..cd8de3757a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/menubar/MenuBarFocus.html @@ -0,0 +1,71 @@ +<?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/MenuBarFocus?restartApplication</td> + <td></td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runMenuBarFocus::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VMenuBar[0]</td> + <td>down</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runMenuBarFocus::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VMenuBar[0]</td> + <td>down</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runMenuBarFocus::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VMenuBar[0]</td> + <td>enter</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runMenuBarFocus::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VLabel[0]</td> + <td>Foo clicked</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runMenuBarFocus::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runMenuBarFocus::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VMenuBar[0]</td> + <td>down</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runMenuBarFocus::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VMenuBar[0]</td> + <td>down</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runMenuBarFocus::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VMenuBar[0]</td> + <td>down</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runMenuBarFocus::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VMenuBar[0]</td> + <td>enter</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runMenuBarFocus::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VLabel[0]</td> + <td>Bar clicked</td> +</tr> +</tbody></table> +</body> +</html>
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/menubar/MenuBarFocus.java b/uitest/src/com/vaadin/tests/components/menubar/MenuBarFocus.java new file mode 100644 index 0000000000..2ea7a23333 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/menubar/MenuBarFocus.java @@ -0,0 +1,102 @@ +/* + * 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.menubar; + +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.Button.ClickListener; +import com.vaadin.ui.Label; +import com.vaadin.ui.MenuBar; +import com.vaadin.ui.MenuBar.Command; +import com.vaadin.ui.MenuBar.MenuItem; + +public class MenuBarFocus extends AbstractTestUI { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + final MenuBar bar = buildMenu(); + Button focusButton = buildButton(bar); + + addComponent(bar); + addComponent(focusButton); + getLayout().setSpacing(true); + } + + private MenuBar buildMenu() { + final MenuBar bar = new MenuBar(); + bar.setDescription("Root Menu"); + + Command command = new Command() { + + @Override + public void menuSelected(MenuItem selectedItem) { + addComponent(new Label(selectedItem.getText() + " clicked")); + + } + }; + + // File + final MenuItem file = bar.addItem("File", null); + file.addItem("Foo", command); + file.addItem("Bar", command); + + // Edit + MenuItem edit = bar.addItem("Edit", null); + edit.addItem("Baz", command); + edit.addItem("Bay", command); + + bar.setTabIndex(2); + return bar; + } + + private Button buildButton(final MenuBar bar) { + ClickListener buttonClickListener = new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + bar.focus(); + } + }; + + Button focusButton = new Button("Click me to focus the menubar", + buttonClickListener); + focusButton.setTabIndex(1); + return focusButton; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "This test checks if you can focus a menu bar on the client from the server side"; + } + + @Override + protected Integer getTicketNumber() { + return 7674; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.html b/uitest/src/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.html new file mode 100644 index 0000000000..81c5938eb2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.html @@ -0,0 +1,37 @@ +<?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>SliderUpdateFromValueChange</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">SliderUpdateFromValueChange</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.slider.SliderUpdateFromValueChange?restartApplication</td> + <td></td> +</tr> +<tr> + <td>dragAndDrop</td> + <td>vaadin=runcomvaadintestscomponentssliderSliderUpdateFromValueChange::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VSlider[0]/domChild[2]/domChild[0]</td> + <td>67,0</td> +</tr> +<tr> + <td>dragAndDrop</td> + <td>vaadin=runcomvaadintestscomponentssliderSliderUpdateFromValueChange::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VSlider[0]/domChild[2]/domChild[0]</td> + <td>-188,0</td> +</tr> +<tr> + <td>assertNotAttribute</td> + <td>vaadin=runcomvaadintestscomponentssliderSliderUpdateFromValueChange::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VSlider[0]/domChild[2]/domChild[0]@style</td> + <td>regex:.*(margin-left|MARGIN-LEFT): 0px.*</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.java b/uitest/src/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.java new file mode 100644 index 0000000000..21b56b7972 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.java @@ -0,0 +1,65 @@ +/* + * 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.slider; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Slider; + +/** + * Testcase for #12133 + * + * @author Vaadin Ltd + */ +public class SliderUpdateFromValueChange extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final Slider slider = new Slider(0, 100, 1); + slider.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + Double value = (Double) event.getProperty().getValue(); + if (value < 100.0) { + slider.setValue(100.0); + } + slider.markAsDirty(); + } + + }); + slider.setImmediate(true); + slider.setWidth(200, Unit.PIXELS); + + addComponent(slider); + } + + @Override + protected String getTestDescription() { + return "Slider.setValue() does not update graphical representation of Slider component"; + } + + @Override + protected Integer getTicketNumber() { + return 12133; + } +} diff --git a/uitest/src/com/vaadin/tests/components/table/RefreshRenderedCellsOnlyIfAttached.html b/uitest/src/com/vaadin/tests/components/table/RefreshRenderedCellsOnlyIfAttached.html new file mode 100644 index 0000000000..e6d4d69f81 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/RefreshRenderedCellsOnlyIfAttached.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>RefreshRenderedCellsOnlyIfAttachedTest</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">RefreshRenderedCellsOnlyIfAttachedTest</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/RefreshRenderedCellsOnlyIfAttached?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runRefreshRenderedCellsOnlyIfAttached::PID_Slabel</td> + <td>default</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runRefreshRenderedCellsOnlyIfAttached::PID_Sbutton/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertNotText</td> + <td>vaadin=runRefreshRenderedCellsOnlyIfAttached::PID_Slabel</td> + <td>default</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runRefreshRenderedCellsOnlyIfAttached::PID_Slabel</td> + <td>original: false, now: false</td> +</tr> +</tbody></table> +</body> +</html>
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/table/RefreshRenderedCellsOnlyIfAttached.java b/uitest/src/com/vaadin/tests/components/table/RefreshRenderedCellsOnlyIfAttached.java new file mode 100644 index 0000000000..3e233c69c2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/RefreshRenderedCellsOnlyIfAttached.java @@ -0,0 +1,121 @@ +/* + * 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.table; + +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.Table; +import com.vaadin.ui.VerticalLayout; + +/** + * There shouldn't be any attempts to refresh table's cells if the table isn't + * attached. + * + * @since + * @author Vaadin Ltd + */ +public class RefreshRenderedCellsOnlyIfAttached extends AbstractTestUI { + + VerticalLayout layout; + boolean check; + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + getLayout().setMargin(true); + check = false; + layout = new VerticalLayout(); + final Label l1 = new Label("default"); + l1.setId("label"); + final Label l2 = new Label("should be: default"); + final Table t = new Table() { + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.Table#refreshRenderedCells() + */ + @Override + protected void refreshRenderedCells() { + boolean original = isRowCacheInvalidated(); + super.refreshRenderedCells(); + if (check) { + l1.setValue("original: " + original + ", now: " + + isRowCacheInvalidated()); + l2.setValue("should be: false & false"); + } + } + }; + t.addContainerProperty("text", String.class, ""); + t.addItem(new Object[] { "Foo" }, "foo"); + t.setId("table"); + layout.addComponent(t); + addComponent(l1); + addComponent(l2); + addComponent(layout); + + Button b = new Button("Detach table", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + check = true; + removeTableParent(); + // call refreshRenderedCells + t.setColumnCollapsingAllowed(true); + } + }); + b.setId("button"); + addComponent(b); + } + + /** + * Remove Table's parent component. + * + * @since + */ + protected void removeTableParent() { + removeComponent(layout); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "There shouldn't be any attempts to refresh table's cells if the table isn't attached."; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 9138; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccess.html b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html index 613691623c..734b95952a 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UiAccess.html +++ b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html @@ -161,6 +161,32 @@ <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> <td>3. Test value after access: Set before run pending</td> </tr> +<!-- Run last part with push enabled --> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.ui.UiAccess?restartApplication&transport=websocket</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[7]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>waitForNotText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> + <td>exact:1. Current session matches in beforeResponse? true</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> + <td>exact:0. Current UI matches in beforeResponse? true</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 index 2bc91fa7b4..09f2fd8816 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UiAccess.java +++ b/uitest/src/com/vaadin/tests/components/ui/UiAccess.java @@ -23,13 +23,18 @@ import java.util.concurrent.locks.ReentrantLock; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinService; +import com.vaadin.server.VaadinSession; +import com.vaadin.shared.communication.PushMode; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.UI; import com.vaadin.util.CurrentInstance; public class UiAccess extends AbstractTestUIWithLog { + private volatile boolean checkCurrentInstancesBeforeResponse = false; + private Future<Void> checkFromBeforeClientResponse; private class CurrentInstanceTestType { @@ -283,6 +288,46 @@ public class UiAccess extends AbstractTestUIWithLog { .get(CurrentInstanceTestType.class)); } })); + + addComponent(new Button("CurrentInstance when pushing", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + log.clear(); + if (getPushConfiguration().getPushMode() != PushMode.AUTOMATIC) { + log("Can only test with automatic push enabled"); + return; + } + + final VaadinSession session = getSession(); + new Thread() { + @Override + public void run() { + // Pretend this isn't a Vaadin thread + CurrentInstance.clearAll(); + + /* + * Get explicit lock to ensure the (implicit) + * push does not happen during normal request + * handling. + */ + session.lock(); + try { + access(new Runnable() { + @Override + public void run() { + checkCurrentInstancesBeforeResponse = true; + // Trigger beforeClientResponse + markAsDirty(); + } + }); + } finally { + session.unlock(); + } + } + }.start(); + } + })); } @Override @@ -292,6 +337,15 @@ public class UiAccess extends AbstractTestUIWithLog { + checkFromBeforeClientResponse.isDone()); checkFromBeforeClientResponse = null; } + if (checkCurrentInstancesBeforeResponse) { + UI currentUI = UI.getCurrent(); + VaadinSession currentSession = VaadinSession.getCurrent(); + + log("Current UI matches in beforeResponse? " + (currentUI == this)); + log("Current session matches in beforeResponse? " + + (currentSession == getSession())); + checkCurrentInstancesBeforeResponse = false; + } } @Override |