From 54e577da4503d417f3607f71820b545098c917ec Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Fri, 12 Dec 2014 11:14:23 +0200 Subject: Fix maximized window ordering. (#15360) Change-Id: Ic994d4e5d74ddc2a554311110640b84bc2e9c802 --- .../vaadin/client/ui/window/WindowConnector.java | 5 +- .../components/window/MaximizedWindowOrder.java | 49 +++++++++++++++ .../window/MaximizedWindowOrderTest.java | 70 ++++++++++++++++++++++ .../tests/tb3/newelements/WindowElement.java | 53 ++++++++++++++++ 4 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrder.java create mode 100644 uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrderTest.java create mode 100644 uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java diff --git a/client/src/com/vaadin/client/ui/window/WindowConnector.java b/client/src/com/vaadin/client/ui/window/WindowConnector.java index b3e3c9f70f..703bcbbb5e 100644 --- a/client/src/com/vaadin/client/ui/window/WindowConnector.java +++ b/client/src/com/vaadin/client/ui/window/WindowConnector.java @@ -440,7 +440,6 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector } } else if (state.windowMode == WindowMode.MAXIMIZED) { window.setPopupPositionNoUpdate(0, 0); - window.bringToFront(); } } @@ -469,6 +468,10 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector state.windowMode = WindowMode.MAXIMIZED; } updateWindowMode(); + + VWindow window = getWidget(); + window.bringToFront(); + getRpcProxy(WindowServerRpc.class).windowModeChanged( state.windowMode); } diff --git a/uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrder.java b/uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrder.java new file mode 100644 index 0000000000..8fe6c0ce5a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrder.java @@ -0,0 +1,49 @@ +package com.vaadin.tests.components.window; + +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.Button.ClickListener; +import com.vaadin.ui.Label; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +public class MaximizedWindowOrder extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + addButton("Open Maximized Window", new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + openWindow(true); + } + }); + } + + private void openWindow(boolean maximized) { + Window window = new Window(); + VerticalLayout layout = new VerticalLayout(); + + Label label = new Label(maximized ? "Maximized" : "Normal"); + + layout.addComponent(label); + Button button = new Button("Open Normal Window"); + button.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + openWindow(false); + } + + }); + + layout.addComponent(button); + + window.setContent(layout); + window.setWindowMode(maximized ? WindowMode.MAXIMIZED : WindowMode.NORMAL); + + addWindow(window); + } +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrderTest.java b/uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrderTest.java new file mode 100644 index 0000000000..5063c84658 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrderTest.java @@ -0,0 +1,70 @@ +package com.vaadin.tests.components.window; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.AbstractTB3Test; +import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.tb3.newelements.WindowElement; +import org.junit.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.greaterThan; +import static org.junit.Assert.assertThat; + +public class MaximizedWindowOrderTest extends MultiBrowserTest { + + private WindowElement openAnotherWindow() { + WindowElement maximizedWindow = getMaximizedWindow(); + maximizedWindow.$(ButtonElement.class).first().click(); + + return getAnotherWindow(); + } + + private WindowElement getMaximizedWindow() { + return $(WindowElement.class).first(); + } + + private WindowElement getAnotherWindow() { + return $(WindowElement.class).get(1); + } + + private WindowElement openMaximizedWindow() { + $(ButtonElement.class).first().click(); + + return getMaximizedWindow(); + } + + @Override + public void setup() throws Exception { + super.setup(); + openTestURL(); + } + + @Test + public void newWindowOpensOnTopOfMaximizedWindow() { + WindowElement maximizedWindow = openMaximizedWindow(); + WindowElement anotherWindow = openAnotherWindow(); + + assertThat(anotherWindow.getCssValue("z-index"), + is(greaterThan(maximizedWindow.getCssValue("z-index")))); + + assertThat(getMaximizedWindow().getCssValue("z-index"), is("10000")); + assertThat(getAnotherWindow().getCssValue("z-index"), is("10001")); + } + + @Test + public void backgroundWindowIsBroughtOnTopWhenMaximized() { + WindowElement maximizedWindow = openMaximizedWindow(); + + maximizedWindow.restore(); + + // the new window is opened on top of the original. + WindowElement anotherWindow = openAnotherWindow(); + + // move the window to make the maximize button visible. + anotherWindow.move(10, 20); + maximizedWindow.maximize(); + + assertThat(maximizedWindow.getCssValue("z-index"), + is(greaterThan(anotherWindow.getCssValue("z-index")))); + } +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java b/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java new file mode 100644 index 0000000000..dd7cb55d01 --- /dev/null +++ b/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java @@ -0,0 +1,53 @@ +package com.vaadin.tests.tb3.newelements; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.ServerClass; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +/* + Suggestions for new elemental api for Window + */ +@ServerClass("com.vaadin.ui.Window") +public class WindowElement extends com.vaadin.testbench.elements.WindowElement { + + private final String restoreBoxClass = "v-window-restorebox"; + private final String maximizeBoxClass = "v-window-maximizebox"; + + public void restore() { + if(isMaximized()) { + getRestoreButton().click(); + } else { + throw new AssertionError("Window is not maximized, cannot be restored."); + } + } + + private boolean isMaximized() { + return isElementPresent(By.className(restoreBoxClass)); + } + + private WebElement getRestoreButton() { + return this.findElement(By.className("v-window-restorebox")); + } + + public void maximize() { + if(!isMaximized()) { + getMaximizeButton().click(); + } else { + throw new AssertionError("Window is already maximized, cannot maximize."); + } + } + + private WebElement getMaximizeButton() { + return this.findElement(By.className(maximizeBoxClass)); + } + + public void move(int xOffset, int yOffset) { + Actions action = new Actions(getDriver()); + action.moveToElement(this.findElement(org.openqa.selenium.By.className("v-window-wrap")), 5, 5); + action.clickAndHold(); + action.moveByOffset(xOffset, yOffset); + action.release(); + action.build().perform(); + } +} -- cgit v1.2.3 From c8d4c9e8cf1fa869c89751dc9a9b55f9be64773f Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Fri, 16 Jan 2015 23:19:06 +0200 Subject: Update text value also with timer triggered text change events. (#16270) Change-Id: I0e074c1ac47cb469a34a5c90533ca0dcfaf2e7e1 --- client/src/com/vaadin/client/ui/VTextField.java | 3 +- server/src/com/vaadin/ui/AbstractTextField.java | 6 ++-- .../TextFieldWithPropertyFormatterTest.java | 25 ++++++++------ .../components/TextFieldValueChangeTest.java | 14 ++++---- .../textfield/TimerTriggeredTextChangeEvent.java | 40 ++++++++++++++++++++++ .../TimerTriggeredTextChangeEventTest.java | 27 +++++++++++++++ 6 files changed, 95 insertions(+), 20 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEvent.java create mode 100644 uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEventTest.java diff --git a/client/src/com/vaadin/client/ui/VTextField.java b/client/src/com/vaadin/client/ui/VTextField.java index b402ced218..792ea23a8a 100644 --- a/client/src/com/vaadin/client/ui/VTextField.java +++ b/client/src/com/vaadin/client/ui/VTextField.java @@ -392,7 +392,8 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler, String newText = prompting ? "" : getText(); if (newText != null && !newText.equals(valueBeforeEdit)) { sendValueChange = immediate; - client.updateVariable(paintableId, "text", newText, false); + client.updateVariable(paintableId, + TextFieldConstants.VAR_CUR_TEXT, newText, false); valueBeforeEdit = newText; valueBeforeEditIsSynced = true; } diff --git a/server/src/com/vaadin/ui/AbstractTextField.java b/server/src/com/vaadin/ui/AbstractTextField.java index 93025ac0fd..5f1bec2488 100644 --- a/server/src/com/vaadin/ui/AbstractTextField.java +++ b/server/src/com/vaadin/ui/AbstractTextField.java @@ -182,11 +182,13 @@ public abstract class AbstractTextField extends AbstractField implements } // Sets the text - if (variables.containsKey("text") && !isReadOnly()) { + if (variables.containsKey(TextFieldConstants.VAR_CUR_TEXT) && + !isReadOnly()) { // Only do the setting if the string representation of the value // has been updated - String newValue = (String) variables.get("text"); + String newValue = (String) + variables.get(TextFieldConstants.VAR_CUR_TEXT); // server side check for max length if (getMaxLength() != -1 && newValue.length() > getMaxLength()) { diff --git a/server/tests/src/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatterTest.java b/server/tests/src/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatterTest.java index 8f2bec455b..624a8eaf20 100644 --- a/server/tests/src/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatterTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatterTest.java @@ -1,17 +1,21 @@ package com.vaadin.tests.server.component.textfield; -import java.util.Collections; - -import junit.framework.TestCase; - import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.ObjectProperty; import com.vaadin.data.util.PropertyFormatter; +import com.vaadin.shared.ui.textfield.TextFieldConstants; import com.vaadin.ui.TextField; +import org.junit.Before; +import org.junit.Test; -public class TextFieldWithPropertyFormatterTest extends TestCase { +import java.util.Collections; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class TextFieldWithPropertyFormatterTest { private static final String INPUT_VALUE = "foo"; private static final String PARSED_VALUE = "BAR"; @@ -24,10 +28,8 @@ public class TextFieldWithPropertyFormatterTest extends TestCase { private int listenerCalled; private int repainted; - @Override - protected void setUp() throws Exception { - super.setUp(); - + @Before + public void setUp() throws Exception { field = new TextField() { @Override public void markAsDirty() { @@ -70,6 +72,7 @@ public class TextFieldWithPropertyFormatterTest extends TestCase { repainted = 0; } + @Test public void testWithServerApi() { checkInitialState(); @@ -93,11 +96,13 @@ public class TextFieldWithPropertyFormatterTest extends TestCase { assertEquals(FORMATTED_VALUE, field.getValue()); } + @Test public void testWithSimulatedClientSideChange() { checkInitialState(); field.changeVariables(null, - Collections.singletonMap("text", (Object) INPUT_VALUE)); + Collections.singletonMap(TextFieldConstants.VAR_CUR_TEXT, + (Object) INPUT_VALUE)); checkEndState(); diff --git a/server/tests/src/com/vaadin/tests/server/components/TextFieldValueChangeTest.java b/server/tests/src/com/vaadin/tests/server/components/TextFieldValueChangeTest.java index cfceb6f7d7..f25664c3cc 100644 --- a/server/tests/src/com/vaadin/tests/server/components/TextFieldValueChangeTest.java +++ b/server/tests/src/com/vaadin/tests/server/components/TextFieldValueChangeTest.java @@ -1,15 +1,15 @@ package com.vaadin.tests.server.components; -import java.util.HashMap; -import java.util.Map; - -import org.easymock.EasyMock; -import org.junit.Assert; - import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.util.ObjectProperty; +import com.vaadin.shared.ui.textfield.TextFieldConstants; import com.vaadin.ui.AbstractField; import com.vaadin.ui.TextField; +import org.easymock.EasyMock; +import org.junit.Assert; + +import java.util.HashMap; +import java.util.Map; /** * Check that the value change listener for a text field is triggered exactly @@ -38,7 +38,7 @@ public class TextFieldValueChangeTest extends @Override protected void setValue(AbstractField field) { Map variables = new HashMap(); - variables.put("text", "newValue"); + variables.put(TextFieldConstants.VAR_CUR_TEXT, "newValue"); ((TextField) field).changeVariables(field, variables); } diff --git a/uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEvent.java b/uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEvent.java new file mode 100644 index 0000000000..89f8215547 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEvent.java @@ -0,0 +1,40 @@ +package com.vaadin.tests.components.textfield; + +import com.vaadin.event.FieldEvents; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.AbstractTextField; +import com.vaadin.ui.Label; +import com.vaadin.ui.TextField; + +public class TimerTriggeredTextChangeEvent extends AbstractTestUI { + @Override + protected void setup(VaadinRequest request) { + final TextField textfield = new TextField(); + final Label serverValue = new Label(); + serverValue.setCaption("Server:"); + + textfield.addTextChangeListener(new FieldEvents.TextChangeListener() { + @Override + public void textChange(FieldEvents.TextChangeEvent event) { + serverValue.setValue(textfield.getValue()); + } + }); + + textfield.setTextChangeEventMode( + AbstractTextField.TextChangeEventMode.EAGER); + + addComponent(textfield); + addComponent(serverValue); + } + + @Override + protected Integer getTicketNumber() { + return 16270; + } + + @Override + protected String getTestDescription() { + return "Text value in server should always be updated."; + } +} diff --git a/uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEventTest.java b/uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEventTest.java new file mode 100644 index 0000000000..c0fed66851 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEventTest.java @@ -0,0 +1,27 @@ +package com.vaadin.tests.components.textfield; + +import com.vaadin.testbench.elements.LabelElement; +import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.tests.tb3.MultiBrowserTest; +import org.junit.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +public class TimerTriggeredTextChangeEventTest extends MultiBrowserTest { + + @Test + public void serverValueIsUpdated() { + openTestURL(); + + TextFieldElement textfield = $(TextFieldElement.class).first(); + LabelElement serverValue = $(LabelElement.class).caption("Server:") + .first(); + + textfield.sendKeys("f"); + + assertThat(textfield.getValue(), is("f")); + assertThat(serverValue.getText(), is("f")); + } + +} \ No newline at end of file -- cgit v1.2.3 From 9f3eaad073c3b83ac386c2ed2300681d1a56b4ac Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Sat, 17 Jan 2015 21:34:21 +0200 Subject: Hide input field from clicking for immediate upload in Valo. (#15404) Change-Id: I69bcd7b1d610d0e9adb6ce43e06591a769bef957 --- .../VAADIN/themes/valo/components/_upload.scss | 2 +- .../tests/themes/valo/ImmediateUploadTest.java | 72 +++++++++++++++------- 2 files changed, 50 insertions(+), 24 deletions(-) diff --git a/WebContent/VAADIN/themes/valo/components/_upload.scss b/WebContent/VAADIN/themes/valo/components/_upload.scss index 07a51f03ef..1616e80563 100644 --- a/WebContent/VAADIN/themes/valo/components/_upload.scss +++ b/WebContent/VAADIN/themes/valo/components/_upload.scss @@ -16,7 +16,7 @@ .#{$primary-stylename}-immediate input[type="file"] { @include opacity(0); - z-index: 2; + z-index: -1; position: absolute; right: 0; height: $v-unit-size; diff --git a/uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java b/uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java index 044f76e335..87827b1358 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.themes.valo; -import static org.hamcrest.Matchers.equalToIgnoringCase; +import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; +import java.io.IOException; import java.util.List; import org.junit.Test; @@ -40,34 +41,59 @@ public class ImmediateUploadTest extends MultiBrowserTest { return getAllBrowsers(); } - @Test - public void fileInputShouldNotBeVisibleInImmediate() - throws InterruptedException { + @Override + public void setup() throws Exception { + super.setup(); openTestURL(); + } + + private WebElement getUploadButton(String id) { + UploadElement normalUpload = $(UploadElement.class).id(id); + + return normalUpload.findElement(By.tagName("div")); + } + + private WebElement getUploadFileInput(String id) { + UploadElement normalUpload = $(UploadElement.class).id(id); + + return normalUpload.findElement(By.cssSelector("input[type='file']")); + } + + @Test + public void normalUploadButtonIsVisible() { + WebElement button = getUploadButton("upload"); - UploadElement normalUpload = $(UploadElement.class).id("upload"); - UploadElement immediateUpload = $(UploadElement.class).id( - "immediateupload"); + assertThat(button.getCssValue("display"), is("block")); + } + + @Test + public void fileInputIsVisibleForNormalUpload() { + WebElement input = getUploadFileInput("upload"); - WebElement normalUploadInput = normalUpload.findElement(By - .cssSelector("input[type='file']")); - WebElement immediateUploadInput = immediateUpload.findElement(By - .cssSelector("input[type='file']")); + assertThat(input.getCssValue("position"), is("static")); + } - WebElement normalUploadButton = normalUpload.findElement(By - .tagName("div")); - WebElement immediateUploadButton = immediateUpload.findElement(By - .tagName("div")); + @Test + public void immediateUploadButtonIsVisible() { + WebElement button = getUploadButton("immediateupload"); - assertThat(normalUploadButton.getCssValue("display"), - equalToIgnoringCase("block")); - assertThat(immediateUploadButton.getCssValue("display"), - equalToIgnoringCase("block")); + assertThat(button.getCssValue("display"), is("block")); + } - assertThat(normalUploadInput.getCssValue("position"), - equalToIgnoringCase("static")); - assertThat(immediateUploadInput.getCssValue("position"), - equalToIgnoringCase("absolute")); + @Test + public void fileInputIsNotVisibleForImmediateUpload() { + WebElement input = getUploadFileInput("immediateupload"); + + assertThat(input.getCssValue("position"), is("absolute")); + } + + @Test + public void fileInputIsNotClickableForImmediateUpload() throws IOException { + WebElement input = getUploadFileInput("immediateupload"); + // input.click() and then verifying if the upload window is opened + // would be better but couldn't figure a way to do that. screenshots + // don't show the upload window, not at least in firefox. + assertThat(input.getCssValue("z-index"), is("-1")); } } -- cgit v1.2.3 From cae18c357d0351c0a3f0923f1b457b9764285313 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 19 Jan 2015 21:09:34 +0200 Subject: Fix CloseSubWindowTest. (#15408) Change-Id: Ia4f699dfdfd6928f9a0e0211192df8a5d17d80c2 --- uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html b/uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html index ae77628bff..de5a793909 100644 --- a/uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html +++ b/uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html @@ -40,7 +40,7 @@ click - vaadin=runcomvaadintestscomponentswindowCloseSubWindow::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runcomvaadintestscomponentswindowCloseSubWindow::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] -- cgit v1.2.3 From cd5f548fb58d8e6aa6fbdb80c9e8c8c36e8edae1 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 19 Jan 2015 21:22:57 +0200 Subject: Fix WindowMaximizeRestoreTest. (#15408) Change-Id: I74d5255ee5efddfa1329483f9fc01115280eda8f --- .../window/WindowMaximizeRestoreTest.html | 54 +++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/uitest/tb2/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html b/uitest/tb2/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html index a27963a066..059e031035 100644 --- a/uitest/tb2/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html +++ b/uitest/tb2/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html @@ -18,59 +18,59 @@ assertCSSClass - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] v-window-maximizebox assertText - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2] Window 1 mouseClick - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] 7,8 assertCSSClass - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] v-window-restorebox mouseClick - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] 9,7 assertCSSClass - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] v-window-maximizebox doubleClickAt - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2] assertCSSClass - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] v-window-restorebox doubleClickAt - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2] assertCSSClass - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] v-window-maximizebox assertVisible - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] @@ -80,7 +80,7 @@ assertNotVisible - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] @@ -91,7 +91,7 @@ assertCSSClass - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] v-window-restorebox @@ -101,28 +101,28 @@ assertCSSClass - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] v-window-maximizebox doubleClickAt - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2] assertCSSClass - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] v-window-maximizebox doubleClickAt - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2] assertCSSClass - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] v-window-maximizebox @@ -174,7 +174,7 @@ mouseClick - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[1]/domChild[0] 6,11 @@ -184,7 +184,7 @@ mouseClick - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[3] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 7,5 @@ -209,12 +209,12 @@ mouseClick - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[1]/domChild[0] 6,11 doubleClickAt - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2] 113,10 @@ -225,27 +225,27 @@ mouseClick - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] 8,4 dragAndDrop - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2] -200,-200 dragAndDrop - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[5]/domChild[0] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0] +100,+100 mouseClick - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] 6,5 mouseClick - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] 5,8 -- cgit v1.2.3 From 301aababf346829774ca29011285f02cd34e8f82 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 19 Jan 2015 21:31:20 +0200 Subject: Fix WindowWithInvalidCloseListenerTest. (#15408) Change-Id: Iddf8843134b7753b22a2a4cdbcc481b7b7b7134f --- .../vaadin/tests/components/window/WindowWithInvalidCloseListener.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uitest/tb2/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html b/uitest/tb2/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html index 3ea1f8f732..ea4d2c3666 100644 --- a/uitest/tb2/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html +++ b/uitest/tb2/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html @@ -18,7 +18,7 @@ mouseClick - vaadin=runcomvaadintestscomponentswindowWindowWithInvalidCloseListener::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runcomvaadintestscomponentswindowWindowWithInvalidCloseListener::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 6,7 -- cgit v1.2.3 From a8b429861077bac0eb7de3c2c98fa6d54a31ed82 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 19 Jan 2015 21:45:47 +0200 Subject: Fix SubWindowOrderTest. (#15408) Change-Id: Idd2e5b2a910488d157e113fd58492bae6c8f3b2d --- uitest/tb2/com/vaadin/tests/components/window/SubWindowOrder.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/uitest/tb2/com/vaadin/tests/components/window/SubWindowOrder.html b/uitest/tb2/com/vaadin/tests/components/window/SubWindowOrder.html index 6fd99caa19..f0ccddcce4 100644 --- a/uitest/tb2/com/vaadin/tests/components/window/SubWindowOrder.html +++ b/uitest/tb2/com/vaadin/tests/components/window/SubWindowOrder.html @@ -90,7 +90,7 @@ mouseClick - vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[3]/domChild[0]/domChild[0]/domChild[3] + vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[3]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 11,15 @@ -101,7 +101,7 @@ mouseClick - vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[3] + vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 6,8 @@ -139,7 +139,7 @@ mouseClick - vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[3] + vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 10,5 -- cgit v1.2.3 From 06d4271bd7473de85f020f92f1d3e0c9021a938b Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 19 Jan 2015 22:10:09 +0200 Subject: Fix base_theme_test. (#15408) Change-Id: Ib7b0572f0131f97f849d6d47acf3ffdf1edd1cc7 --- .../com/vaadin/tests/components/uitest/base_theme_test.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/uitest/tb2/com/vaadin/tests/components/uitest/base_theme_test.html b/uitest/tb2/com/vaadin/tests/components/uitest/base_theme_test.html index cdbcf8bacc..a87cba69ab 100644 --- a/uitest/tb2/com/vaadin/tests/components/uitest/base_theme_test.html +++ b/uitest/tb2/com/vaadin/tests/components/uitest/base_theme_test.html @@ -289,7 +289,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 9,8 @@ -304,7 +304,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 11,6 @@ -319,7 +319,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 8,5 @@ -334,7 +334,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 9,6 @@ -349,7 +349,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 10,7 -- cgit v1.2.3 From 78f79e5dfe763e65d4afe967e6a74536f99b73fb Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 19 Jan 2015 22:14:20 +0200 Subject: Fix chameleon_theme_test. (#15408) Change-Id: I30338df3601968cb04dcd717489a74b5abc80bec --- .../vaadin/tests/components/uitest/chameleon_theme_test.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/uitest/tb2/com/vaadin/tests/components/uitest/chameleon_theme_test.html b/uitest/tb2/com/vaadin/tests/components/uitest/chameleon_theme_test.html index d5d70a62d2..3c3c229e97 100644 --- a/uitest/tb2/com/vaadin/tests/components/uitest/chameleon_theme_test.html +++ b/uitest/tb2/com/vaadin/tests/components/uitest/chameleon_theme_test.html @@ -289,7 +289,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 9,8 @@ -304,7 +304,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 11,6 @@ -319,7 +319,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 8,5 @@ -334,7 +334,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 9,6 @@ -349,7 +349,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 10,7 -- cgit v1.2.3 From f423b406981d8fe61464a07fcd9e12db223b98e7 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 19 Jan 2015 22:16:45 +0200 Subject: Fix liferay_theme_test. (#15408) Change-Id: I460f287cbafe530e1d21cb2da24ed3d64b12f2d9 --- .../com/vaadin/tests/components/uitest/liferay_theme_test.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/uitest/tb2/com/vaadin/tests/components/uitest/liferay_theme_test.html b/uitest/tb2/com/vaadin/tests/components/uitest/liferay_theme_test.html index 783784e993..3ed5836c86 100644 --- a/uitest/tb2/com/vaadin/tests/components/uitest/liferay_theme_test.html +++ b/uitest/tb2/com/vaadin/tests/components/uitest/liferay_theme_test.html @@ -289,7 +289,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 9,8 @@ -304,7 +304,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 11,6 @@ -319,7 +319,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 8,5 @@ -334,7 +334,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 9,6 @@ -349,7 +349,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 10,7 -- cgit v1.2.3 From 0dc689e7d6988cbd6fcf71853403b82fe520b4e7 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 19 Jan 2015 22:19:07 +0200 Subject: Fix reindeer_theme_test. (#15408) Change-Id: I6cdcdfbb01b41fbc9399c644fedebe758ac3a7f4 --- .../vaadin/tests/components/uitest/reindeer_theme_test.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/uitest/tb2/com/vaadin/tests/components/uitest/reindeer_theme_test.html b/uitest/tb2/com/vaadin/tests/components/uitest/reindeer_theme_test.html index 175def94d3..6d19f5c7a1 100644 --- a/uitest/tb2/com/vaadin/tests/components/uitest/reindeer_theme_test.html +++ b/uitest/tb2/com/vaadin/tests/components/uitest/reindeer_theme_test.html @@ -289,7 +289,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 9,8 @@ -304,7 +304,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 11,6 @@ -319,7 +319,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 8,5 @@ -334,7 +334,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 9,6 @@ -349,7 +349,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 10,7 -- cgit v1.2.3 From e4dbfacb952c384c47a1b8eded11bed50cc13c92 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 19 Jan 2015 22:21:32 +0200 Subject: Fix runo_theme_test. (#15408) Change-Id: I9db380090d5b4500c1574b6d98d0d278a0e53816 --- .../com/vaadin/tests/components/uitest/runo_theme_test.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/uitest/tb2/com/vaadin/tests/components/uitest/runo_theme_test.html b/uitest/tb2/com/vaadin/tests/components/uitest/runo_theme_test.html index 0db6614a9c..183854102d 100644 --- a/uitest/tb2/com/vaadin/tests/components/uitest/runo_theme_test.html +++ b/uitest/tb2/com/vaadin/tests/components/uitest/runo_theme_test.html @@ -289,7 +289,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 9,8 @@ -304,7 +304,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 11,6 @@ -319,7 +319,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 8,5 @@ -334,7 +334,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 9,6 @@ -349,7 +349,7 @@ mouseClick - vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 10,7 -- cgit v1.2.3 From b3691eae81e3b3c4d2425286ba777fac71d0d8d2 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 19 Jan 2015 22:24:30 +0200 Subject: Fix CalendarWeeklyViewNewEventsTest. (#15408) Change-Id: I9b957f5f164fde388abce50be3285159fb50e66e --- .../tests/components/calendar/CalendarWeeklyViewNewEvents.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/uitest/tb2/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html b/uitest/tb2/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html index 6add1deba5..f2702420f1 100644 --- a/uitest/tb2/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html +++ b/uitest/tb2/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html @@ -313,7 +313,7 @@ mouseClick - vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 8,9 @@ -438,7 +438,7 @@ mouseClick - vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 11,8 @@ -558,7 +558,7 @@ mouseClick - vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 7,8 @@ -583,7 +583,7 @@ mouseClick - vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[3] + vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1] 12,10 -- cgit v1.2.3 From 9e4130cd53c64a3bd9a8d7f49f1d6d35799f3179 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 19 Jan 2015 18:31:00 +0200 Subject: Fix NotificationDelayTest for IE8 and Chrome. (#14689) Change-Id: I3f92722ce9832ec2b748f2bf20477244597a8912 --- .../notification/NotificationDelayTest.java | 27 ++++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/uitest/src/com/vaadin/tests/components/notification/NotificationDelayTest.java b/uitest/src/com/vaadin/tests/components/notification/NotificationDelayTest.java index 219d44710c..903c3440cc 100644 --- a/uitest/src/com/vaadin/tests/components/notification/NotificationDelayTest.java +++ b/uitest/src/com/vaadin/tests/components/notification/NotificationDelayTest.java @@ -15,12 +15,13 @@ */ package com.vaadin.tests.components.notification; +import com.vaadin.tests.tb3.MultiBrowserTest; import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; import org.openqa.selenium.interactions.Actions; - -import com.vaadin.tests.tb3.MultiBrowserTest; +import org.openqa.selenium.support.ui.ExpectedCondition; /** * Test to check notification delay. @@ -34,20 +35,16 @@ public class NotificationDelayTest extends MultiBrowserTest { openTestURL(); Assert.assertTrue("No notification found", hasNotification()); - Actions actions = new Actions(getDriver()); - actions.moveByOffset(10, 10).build().perform(); - long start = System.currentTimeMillis(); - boolean hidden = false; - while (System.currentTimeMillis() <= start + 5000) { - Thread.sleep(500); - hidden = !hasNotification(); - if (hidden) { - break; - } - } - Assert.assertTrue("Notification is still visible after 5 seconds", - hidden); + waitUntil(new ExpectedCondition() { + + @Override + public Boolean apply(WebDriver input) { + new Actions(getDriver()).moveByOffset(10, 10).perform(); + + return !hasNotification(); + } + }); } private boolean hasNotification() { -- cgit v1.2.3 From 498d183b01f66ab5b34c6ca56d8b0d5001a45b84 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Sat, 10 Jan 2015 15:38:24 +0200 Subject: Don't rely on broken JsonValue.jsEquals semantics (#15508) This implementation also happens to be slightly faster becasue because the object and array comparisons does not dump the values into native representations before comparing. The difference is about 2 ms per action when setting 40 panels in BasicPerformanceTest. This represents about 5% improvement in a quite synthetic case. Change-Id: I6319e268b7155e1123457437d81021296728a386 --- server/src/com/vaadin/server/JsonCodec.java | 88 ++++++- .../src/com/vaadin/server/JsonEqualsTest.java | 276 +++++++++++++++++++++ 2 files changed, 358 insertions(+), 6 deletions(-) create mode 100644 server/tests/src/com/vaadin/server/JsonEqualsTest.java diff --git a/server/src/com/vaadin/server/JsonCodec.java b/server/src/com/vaadin/server/JsonCodec.java index 1f7b4ead43..6833cef1f7 100644 --- a/server/src/com/vaadin/server/JsonCodec.java +++ b/server/src/com/vaadin/server/JsonCodec.java @@ -750,7 +750,7 @@ public class JsonCodec implements Serializable { fieldType, connectorTracker); encoded.put(fieldName, encodeResult.getEncodedValue()); - if (!jsonEquals(encodeResult.getEncodedValue(), fieldReference)) { + if (valueChanged(encodeResult.getEncodedValue(), fieldReference)) { diff.put(fieldName, encodeResult.getDiffOrValue()); } } @@ -762,25 +762,101 @@ public class JsonCodec implements Serializable { } /** - * Compares the value with the reference. If they match, returns true. + * Compares the value with the reference. If they match, returns false. * * @param fieldValue * @param referenceValue * @return */ - private static boolean jsonEquals(JsonValue fieldValue, + private static boolean valueChanged(JsonValue fieldValue, JsonValue referenceValue) { if (fieldValue instanceof JsonNull) { fieldValue = null; } if (fieldValue == referenceValue) { - return true; - } else if (fieldValue == null || referenceValue == null) { return false; + } else if (fieldValue == null || referenceValue == null) { + return true; } else { - return fieldValue.jsEquals(referenceValue); + return !jsonEquals(fieldValue, referenceValue); + } + } + + /** + * Compares two json values for deep equality. + * + * This is a helper for overcoming the fact that + * {@link JsonValue#equals(Object)} only does an identity check and + * {@link JsonValue#jsEquals(JsonValue)} is defined to use JavaScript + * semantics where arrays and objects are equals only based on identity. + * + * @since + * @param a + * the first json value to check, may not be null + * @param b + * the second json value to check, may not be null + * @return true if both json values are the same; + * false otherwise + */ + public static boolean jsonEquals(JsonValue a, JsonValue b) { + assert a != null; + assert b != null; + + if (a == b) { + return true; + } + + JsonType type = a.getType(); + if (type != b.getType()) { + return false; + } + + switch (type) { + case NULL: + return true; + case BOOLEAN: + return a.asBoolean() == b.asBoolean(); + case NUMBER: + return a.asNumber() == b.asNumber(); + case STRING: + return a.asString().equals(b.asString()); + case OBJECT: + return jsonObjectEquals((JsonObject) a, (JsonObject) b); + case ARRAY: + return jsonArrayEquals((JsonArray) a, (JsonArray) b); + default: + throw new RuntimeException("Unsupported JsonType: " + type); + } + } + + private static boolean jsonObjectEquals(JsonObject a, JsonObject b) { + String[] keys = a.keys(); + + if (keys.length != b.keys().length) { + return false; + } + + for (String key : keys) { + JsonValue value = b.get(key); + if (value == null || !jsonEquals(a.get(key), value)) { + return false; + } + } + + return true; + } + + private static boolean jsonArrayEquals(JsonArray a, JsonArray b) { + if (a.length() != b.length()) { + return false; + } + for (int i = 0; i < a.length(); i++) { + if (!jsonEquals(a.get(i), b.get(i))) { + return false; + } } + return true; } private static JsonArray encodeArrayContents(Type componentType, diff --git a/server/tests/src/com/vaadin/server/JsonEqualsTest.java b/server/tests/src/com/vaadin/server/JsonEqualsTest.java new file mode 100644 index 0000000000..ca3bfced79 --- /dev/null +++ b/server/tests/src/com/vaadin/server/JsonEqualsTest.java @@ -0,0 +1,276 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.server; + +import org.junit.Assert; +import org.junit.Test; + +import elemental.json.Json; +import elemental.json.JsonArray; +import elemental.json.JsonObject; +import elemental.json.JsonValue; + +public class JsonEqualsTest { + + @Test + public void differentTypes_notEqual() { + boolean equals = JsonCodec.jsonEquals(Json.create(5), Json.create("5")); + + Assert.assertFalse("Different types should not be equal", equals); + } + + @Test + public void nulls_equal() { + boolean equals = JsonCodec.jsonEquals(Json.createNull(), + Json.createNull()); + + Assert.assertTrue("Null and null should be equal", equals); + } + + @Test + public void differentBooleans_notEqual() { + boolean equals = JsonCodec.jsonEquals(Json.create(true), + Json.create(false)); + + Assert.assertFalse("Different booleans should not be equal", equals); + } + + @Test + public void sameBooleans_equal() { + boolean equals = JsonCodec.jsonEquals(Json.create(false), + Json.create(false)); + + Assert.assertTrue("Same booleans should be equal", equals); + } + + @Test + public void differentNumbers_notEqual() { + boolean equals = JsonCodec.jsonEquals(Json.create(2), Json.create(5.6)); + + Assert.assertFalse("Different numbers should not be equal", equals); + } + + @Test + public void sameNumbers_equal() { + boolean equals = JsonCodec.jsonEquals(Json.create(3.14), + Json.create(3.14)); + + Assert.assertTrue("Same numbers should be equal", equals); + } + + @Test + public void differentStrings_notEqual() { + boolean equals = JsonCodec.jsonEquals(Json.create("abc"), + Json.create("def")); + + Assert.assertFalse("Different strings should not be equal", equals); + } + + @Test + public void sameStrings_equal() { + boolean equals = JsonCodec.jsonEquals(Json.create("abc"), + Json.create("abc")); + + Assert.assertTrue("Same strings should be equal", equals); + } + + @Test + public void differentKeyCountObject_notEqual() { + JsonObject o1 = Json.createObject(); + o1.put("key", "value"); + + JsonObject o2 = Json.createObject(); + + boolean equals = JsonCodec.jsonEquals(o1, o2); + + Assert.assertFalse( + "Object with different key counts should not be equal", equals); + } + + @Test + public void differentKeySetObject_notEqual() { + JsonObject o1 = Json.createObject(); + o1.put("key", "value"); + + JsonObject o2 = Json.createObject(); + o2.put("key2", "value"); + + boolean equals = JsonCodec.jsonEquals(o1, o2); + + Assert.assertFalse("Object with different keys should not be equal", + equals); + } + + @Test + public void differentChildValuesObject_notEqual() { + JsonObject o1 = Json.createObject(); + o1.put("key", "value"); + + JsonObject o2 = Json.createObject(); + o2.put("key", true); + + boolean equals = JsonCodec.jsonEquals(o1, o2); + + Assert.assertFalse( + "Object with different child values should not be equal", + equals); + } + + @Test + public void emptyObjects_equal() { + JsonObject o1 = Json.createObject(); + JsonObject o2 = Json.createObject(); + + boolean equals = JsonCodec.jsonEquals(o1, o2); + + Assert.assertTrue("Empty objects should be equal", equals); + } + + @Test + public void sameObjects_equal() { + JsonObject o1 = Json.createObject(); + o1.put("key", "value"); + + JsonObject o2 = Json.createObject(); + o2.put("key", "value"); + + boolean equals = JsonCodec.jsonEquals(o1, o2); + + Assert.assertTrue("Same objects should be equal", equals); + } + + @Test + public void sameObjectsWithNullValues_equal() { + JsonObject o1 = Json.createObject(); + o1.put("key", Json.createNull()); + + JsonObject o2 = Json.createObject(); + o2.put("key", Json.createNull()); + + boolean equals = JsonCodec.jsonEquals(o1, o2); + + Assert.assertTrue("Same objects should be equal", equals); + } + + @Test + public void differentSizeArray_notEqual() { + JsonArray a1 = Json.createArray(); + a1.set(0, 0); + + JsonArray a2 = Json.createArray(); + + boolean equals = JsonCodec.jsonEquals(a1, a2); + + Assert.assertFalse("Arrays with different sizes should not be equal", + equals); + } + + @Test + public void differentContentArray_notEqual() { + JsonArray a1 = Json.createArray(); + a1.set(0, 0); + + JsonArray a2 = Json.createArray(); + a2.set(0, 1); + + boolean equals = JsonCodec.jsonEquals(a1, a2); + + Assert.assertFalse("Arrays with different content should not be equal", + equals); + } + + @Test + public void differentOrderArray_notEqual() { + JsonArray a1 = Json.createArray(); + a1.set(0, 0); + a1.set(1, true); + + JsonArray a2 = Json.createArray(); + a2.set(0, true); + a2.set(1, 0); + + boolean equals = JsonCodec.jsonEquals(a1, a2); + + Assert.assertFalse("Arrays with different order should not be equal", + equals); + } + + @Test + public void emptyArrays_equal() { + JsonArray a1 = Json.createArray(); + JsonArray a2 = Json.createArray(); + + boolean equals = JsonCodec.jsonEquals(a1, a2); + + Assert.assertTrue("Empty arrays should be equal", equals); + } + + @Test + public void sameArrays_equal() { + JsonArray a1 = Json.createArray(); + a1.set(0, 0); + a1.set(1, true); + + JsonArray a2 = Json.createArray(); + a2.set(0, 0); + a2.set(1, true); + + boolean equals = JsonCodec.jsonEquals(a1, a2); + + Assert.assertTrue("Same arrays should be equal", equals); + } + + @Test + public void sameArraysWitNull_equal() { + JsonArray a1 = Json.createArray(); + a1.set(0, Json.createNull()); + + JsonArray a2 = Json.createArray(); + a2.set(0, Json.createNull()); + + boolean equals = JsonCodec.jsonEquals(a1, a2); + + Assert.assertTrue("Same arrays should be equal", equals); + } + + @Test + public void differentDeeplyNested_notEquals() { + boolean equals = JsonCodec.jsonEquals(createDeeplyNestedValue(1), + createDeeplyNestedValue(2)); + + Assert.assertFalse("Values should not be equal", equals); + } + + @Test + public void sameDeeplyNested_equals() { + boolean equals = JsonCodec.jsonEquals(createDeeplyNestedValue(1), + createDeeplyNestedValue(1)); + + Assert.assertTrue("Values should be equal", equals); + } + + private static JsonValue createDeeplyNestedValue(int leafValue) { + JsonObject childObject = Json.createObject(); + childObject.put("value", leafValue); + + JsonArray childArray = Json.createArray(); + childArray.set(0, childObject); + + JsonObject value = Json.createObject(); + value.put("child", childArray); + return value; + } +} -- cgit v1.2.3 From 3be687e39f4f6ec25383c090d8badfacf380fec9 Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Tue, 20 Jan 2015 09:20:29 +0200 Subject: Button icon 'icon-align-top' style correction (#15140). Change-Id: I16bc415596431340e4e4d1944b3927dc3fd6cd96 --- .../com/vaadin/tests/themes/valo/AlignTopIconInButtonTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButtonTest.java b/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButtonTest.java index 287e25d402..02ef886721 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButtonTest.java +++ b/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButtonTest.java @@ -15,7 +15,10 @@ */ package com.vaadin.tests.themes.valo; -import org.junit.Assert; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.lessThanOrEqualTo; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -30,7 +33,7 @@ import com.vaadin.tests.tb3.MultiBrowserTest; public class AlignTopIconInButtonTest extends MultiBrowserTest { @Test - public void testIconPositioninButton() { + public void iconIsCenteredInsideButton() { openTestURL(); WebElement wrapper = findElement(By.className("v-button-wrap")); @@ -41,7 +44,6 @@ public class AlignTopIconInButtonTest extends MultiBrowserTest { + wrapper.getSize().getWidth() - icon.getLocation().getX() - icon.getSize().getWidth(); - Assert.assertTrue("Icon element is not centered inside button.", - Math.abs(rightSpace - leftSpace) <= 1); + assertThat(Math.abs(rightSpace - leftSpace), is(lessThanOrEqualTo(2))); } } -- cgit v1.2.3 From 0651b9aa3b8880110eeac9a220e267daa04c9b4f Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Wed, 12 Nov 2014 16:13:01 +0200 Subject: Embedded ThemeResource should react to theme change (#15194) Change-Id: Ied78a8c999e592a944c27138e179c37a31a0af54 --- .../VAADIN/themes/tests-components/images/logo.png | Bin 0 -> 19532 bytes .../client/ui/embedded/EmbeddedConnector.java | 54 ++++++++-- server/src/com/vaadin/ui/Embedded.java | 11 +-- .../components/embedded/EmbeddedThemeResource.java | 69 +++++++++++++ .../embedded/EmbeddedThemeResourceTest.java | 109 +++++++++++++++++++++ 5 files changed, 228 insertions(+), 15 deletions(-) create mode 100644 WebContent/VAADIN/themes/tests-components/images/logo.png create mode 100644 uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResource.java create mode 100644 uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java diff --git a/WebContent/VAADIN/themes/tests-components/images/logo.png b/WebContent/VAADIN/themes/tests-components/images/logo.png new file mode 100644 index 0000000000..9990cd2f28 Binary files /dev/null and b/WebContent/VAADIN/themes/tests-components/images/logo.png differ diff --git a/client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java b/client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java index cd4c79ccc6..38995cf800 100644 --- a/client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java +++ b/client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java @@ -32,6 +32,7 @@ import com.vaadin.client.Paintable; import com.vaadin.client.UIDL; import com.vaadin.client.VConsole; import com.vaadin.client.VTooltip; +import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.AbstractComponentConnector; import com.vaadin.client.ui.ClickEventHandler; import com.vaadin.client.ui.VEmbedded; @@ -46,11 +47,44 @@ import com.vaadin.ui.Embedded; public class EmbeddedConnector extends AbstractComponentConnector implements Paintable { + private Element resourceElement; + private ObjectElement objectElement; + private String resourceUrl; + @Override protected void init() { super.init(); } + @Override + public void onStateChanged(StateChangeEvent stateChangeEvent) { + super.onStateChanged(stateChangeEvent); + // if theme has changed the resourceUrl may need to be updated + updateResourceIfNecessary(); + } + + private void updateResourceIfNecessary() { + if (resourceElement != null || objectElement != null) { + String src = getResourceUrl("src"); + if (src != null && !src.isEmpty()) { + if (!src.equals(resourceUrl)) { + setResourceUrl(src); + } + } else if (resourceUrl != null && !resourceUrl.isEmpty()) { + setResourceUrl(""); + } + } + } + + private void setResourceUrl(String src) { + resourceUrl = src; + if (resourceElement != null) { + resourceElement.setAttribute("src", src); + } else if (objectElement != null) { + objectElement.setData(src); + } + } + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { if (!isRealUpdate(uidl)) { @@ -102,8 +136,9 @@ public class EmbeddedConnector extends AbstractComponentConnector implements style.setProperty("width", getState().width); style.setProperty("height", getState().height); - DOM.setElementProperty(el, "src", - getWidget().getSrc(uidl, client)); + resourceElement = el; + objectElement = null; + setResourceUrl(getResourceUrl("src")); if (uidl.hasAttribute(EmbeddedConstants.ALTERNATE_TEXT)) { el.setPropertyString( @@ -133,8 +168,9 @@ public class EmbeddedConnector extends AbstractComponentConnector implements getWidget().browserElement = DOM.getFirstChild(getWidget() .getElement()); } - DOM.setElementAttribute(getWidget().browserElement, "src", - getWidget().getSrc(uidl, client)); + resourceElement = getWidget().browserElement; + objectElement = null; + setResourceUrl(getResourceUrl("src")); clearBrowserElement = false; } else { VConsole.error("Unknown Embedded type '" + getWidget().type @@ -163,15 +199,19 @@ public class EmbeddedConnector extends AbstractComponentConnector implements getWidget().addStyleName(VEmbedded.CLASSNAME + "-svg"); String data; Map parameters = VEmbedded.getParameters(uidl); + ObjectElement obj = Document.get().createObjectElement(); + resourceElement = null; if (parameters.get("data") == null) { - data = getWidget().getSrc(uidl, client); + objectElement = obj; + data = getResourceUrl("src"); + setResourceUrl(data); } else { + objectElement = null; data = "data:image/svg+xml," + parameters.get("data"); + obj.setData(data); } getWidget().setHTML(""); - ObjectElement obj = Document.get().createObjectElement(); obj.setType(mime); - obj.setData(data); if (!isUndefinedWidth()) { obj.getStyle().setProperty("width", "100%"); } diff --git a/server/src/com/vaadin/ui/Embedded.java b/server/src/com/vaadin/ui/Embedded.java index 1086da8d09..d83eef9c4d 100644 --- a/server/src/com/vaadin/ui/Embedded.java +++ b/server/src/com/vaadin/ui/Embedded.java @@ -78,11 +78,6 @@ public class Embedded extends AbstractComponent implements LegacyComponent { */ private int type = TYPE_OBJECT; - /** - * Source of the embedded object. - */ - private Resource source = null; - /** * Generic object attributes. */ @@ -418,7 +413,7 @@ public class Embedded extends AbstractComponent implements LegacyComponent { * @return the Resource */ public Resource getSource() { - return source; + return getResource("src"); } /** @@ -445,8 +440,8 @@ public class Embedded extends AbstractComponent implements LegacyComponent { * the source to set. */ public void setSource(Resource source) { - if (source != null && !source.equals(this.source)) { - this.source = source; + if (source != null && !source.equals(getSource())) { + setResource("src", source); final String mt = source.getMIMEType(); if (mimeType == null) { diff --git a/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResource.java b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResource.java new file mode 100644 index 0000000000..ecc746b858 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResource.java @@ -0,0 +1,69 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.embedded; + +import com.vaadin.server.ThemeResource; +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.Embedded; +import com.vaadin.ui.Image; +import com.vaadin.ui.themes.Reindeer; + +/** + * Tests that {@link Embedded} uses correct theme when the theme is set with + * {@link #setTheme(String)}, and also updates correctly if theme is changed + * later. {@link Image} is used as the baseline for correct behaviour. + * + * @author Vaadin Ltd + */ +public class EmbeddedThemeResource extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + setTheme("tests-components"); + + addButton("Toggle theme", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + if (Reindeer.THEME_NAME.equals(getTheme())) { + setTheme("tests-components"); + } else { + setTheme(Reindeer.THEME_NAME); + } + } + }); + + // let's show a simple themeresource + ThemeResource logoResource = new ThemeResource("images/logo.png"); + Embedded embedded = new Embedded("embedded:", logoResource); + Image image = new Image("image:", logoResource); + + addComponents(embedded, image); + } + + @Override + protected String getTestDescription() { + return "Tests that Embedded updates correctly when using setTheme(String)"; + } + + @Override + protected Integer getTicketNumber() { + return 15194; + } +} diff --git a/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java new file mode 100644 index 0000000000..f3dca71cad --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java @@ -0,0 +1,109 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.embedded; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.support.ui.ExpectedCondition; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.EmbeddedElement; +import com.vaadin.testbench.elements.ImageElement; +import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.tb3.SingleBrowserTest; +import com.vaadin.ui.Embedded; + +/** + * Tests that {@link Embedded} uses correct theme when the theme is set with + * {@link #setTheme(String)}, and also updates correctly if theme is changed + * later. {@link Image} is used as the baseline for correct behaviour. + * + * @author Vaadin Ltd + */ +public class EmbeddedThemeResourceTest extends SingleBrowserTest { + + @Override + public List getBrowsersToTest() { + // Seems like stylesheet onload is not fired on PhantomJS + // https://github.com/ariya/phantomjs/issues/12332 + return Arrays.asList(MultiBrowserTest.Browser.FIREFOX + .getDesiredCapabilities()); + } + + @Before + @Override + public void setup() throws Exception { + super.setup(); + openTestURL(); + waitForElementPresent(By.className("v-embedded")); + } + + @Test + public void testInitialTheme() { + EmbeddedElement embedded = $(EmbeddedElement.class).first(); + ImageElement image = $(ImageElement.class).first(); + final String initial = image.getAttribute("src"); + + assertFalse( + "ThemeResource image source uses default theme instead of set theme.", + initial.contains("/reindeer/")); + assertThat( + "Embedded and Image aren't using the same source for the image despite sharing the ThemeResource.", + embedded.findElement(By.tagName("img")).getAttribute("src"), + is(initial)); + } + + @Test + public void testUpdatedTheme() { + EmbeddedElement embedded = $(EmbeddedElement.class).first(); + final ImageElement image = $(ImageElement.class).first(); + final String initial = image.getAttribute("src"); + + // update theme + $(ButtonElement.class).first().click(); + + waitUntil(new ExpectedCondition() { + @Override + public Boolean apply(WebDriver input) { + return !initial.equals(image.getAttribute("src")); + } + + @Override + public String toString() { + // Timed out after 10 seconds waiting for ... + return "image source to be updated (was: " + initial + ")"; + } + }); + + assertTrue("ThemeResource image source didn't update correctly.", image + .getAttribute("src").contains("/reindeer/")); + assertThat( + "Embedded and Image aren't using the same source for the image despite sharing the ThemeResource.", + embedded.findElement(By.tagName("img")).getAttribute("src"), + is(image.getAttribute("src"))); + } +} -- cgit v1.2.3 From 21b554709fb31131dca836710522bd89ddc2398c Mon Sep 17 00:00:00 2001 From: AMahdy AbdElAziz Date: Wed, 7 Jan 2015 15:01:28 +0200 Subject: Ignore change btwn paints and force update unfocused TextField (#15144) Change-Id: I0ddcea2a617fea00d707f7deaf155e98b9d6a832 --- .../client/ui/textfield/TextFieldConnector.java | 16 ++-- .../textfield/TextFieldEmptyingPrompt.java | 72 ++++++++++++++ .../textfield/TextFieldEmptyingPromptTest.java | 104 +++++++++++++++++++++ 3 files changed, 185 insertions(+), 7 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPrompt.java create mode 100644 uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPromptTest.java diff --git a/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java b/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java index 1a4b64b0a6..0d85e98ee3 100644 --- a/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java +++ b/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java @@ -22,6 +22,7 @@ import com.google.gwt.user.client.Event; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.Paintable; import com.vaadin.client.UIDL; +import com.vaadin.client.Util; import com.vaadin.client.ui.AbstractFieldConnector; import com.vaadin.client.ui.ShortcutActionHandler.BeforeShortcutActionListener; import com.vaadin.client.ui.VTextField; @@ -83,14 +84,15 @@ public class TextFieldConnector extends AbstractFieldConnector implements } /* * We skip the text content update if field has been repainted, but text - * has not been changed. Additional sanity check verifies there is no - * change in the queue (in which case we count more on the server side - * value). + * has not been changed (#6588). Additional sanity check verifies there + * is no change in the queue (in which case we count more on the server + * side value). is updated only when it looses focus, so we + * force updating if not focused. Lost focus issue appeared in (#15144) */ - if (!(uidl - .getBooleanAttribute(TextFieldConstants.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS) - && getWidget().valueBeforeEdit != null && text - .equals(getWidget().valueBeforeEdit))) { + if (!(Util.getFocusedElement() == getWidget().getElement()) + || !uidl.getBooleanAttribute(TextFieldConstants.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS) + || getWidget().valueBeforeEdit == null + || !text.equals(getWidget().valueBeforeEdit)) { getWidget().updateFieldContent(text); } diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPrompt.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPrompt.java new file mode 100644 index 0000000000..9fe18f131b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPrompt.java @@ -0,0 +1,72 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.tests.components.textfield; + +import com.vaadin.event.FieldEvents; +import com.vaadin.event.FieldEvents.TextChangeEvent; +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.TextField; + +@SuppressWarnings("serial") +public class TextFieldEmptyingPrompt extends AbstractTestUI { + + final TextField textField = new TextField(); + final Label label = new Label(); + final static String RANDOM_PROMPT = "Some prompt here"; + + @Override + public String getTestDescription() { + return "Type something, then erase it, then click on the button.
" + + "Input prompt should dissapear.
"; + } + + @Override + protected Integer getTicketNumber() { + return 15144; + } + + @Override + protected void setup(VaadinRequest request) { + + addComponent(label); + + textField.setInputPrompt(RANDOM_PROMPT); + textField.addTextChangeListener(new FieldEvents.TextChangeListener() { + + @Override + public void textChange(TextChangeEvent event) { + label.setValue("Textfield value: " + event.getText()); + } + }); + addComponent(textField); + + Button button = new Button("Click To Remove Prompt"); + button.addClickListener(new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + + textField.setInputPrompt(""); + } + }); + addComponent(button); + } +} diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPromptTest.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPromptTest.java new file mode 100644 index 0000000000..f4fa5d0dc5 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPromptTest.java @@ -0,0 +1,104 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.textfield; + +import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.ui.ExpectedCondition; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.LabelElement; +import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class TextFieldEmptyingPromptTest extends MultiBrowserTest { + + private String RANDOM_INPUT = "Some input here"; + + private TextFieldElement textfield; + private LabelElement label; + private ButtonElement button; + + @Test + public void testInputPrompt() throws InterruptedException { + openTestURL(); + + textfield = $(TextFieldElement.class).first(); + label = $(LabelElement.class).get(1); + button = $(ButtonElement.class).first(); + + // Write on the TextField + writeOnTextField(); + + // Make sure a complete server communication cycle happened + waitServerUpdate("Textfield value: " + RANDOM_INPUT); + + // Empty the TextField + emptyTextField(); + + // Click attempts to remove the prompt + button.click(); + + // Assert Prompt text disappeared + waitServerUpdateText(""); + } + + private void waitServerUpdate(final String expectedValue) { + waitUntil(new ExpectedCondition() { + + @Override + public Boolean apply(WebDriver input) { + return label.getText().equals(expectedValue); + } + + @Override + public String toString() { + // Timed out after 10 seconds waiting for ... + return "the server to get updated with the entered value: '" + + expectedValue + "' (was: '" + label.getText() + "')"; + } + }); + } + + private void waitServerUpdateText(final String expectedValue) { + waitUntil(new ExpectedCondition() { + + @Override + public Boolean apply(WebDriver input) { + return textfield.getValue().equals(expectedValue); + } + + @Override + public String toString() { + // Timed out after 10 seconds waiting for ... + return "the server to get updated with the entered value: '" + + expectedValue + "' (was: '" + textfield.getValue() + + "')"; + } + }); + } + + private void writeOnTextField() { + textfield.sendKeys(RANDOM_INPUT); + } + + private void emptyTextField() { + for (int i = 0; i < RANDOM_INPUT.length(); i++) { + textfield.sendKeys(Keys.BACK_SPACE); + } + } +} -- cgit v1.2.3 From b8ae4fc242495cc805ac931d708c918893c06183 Mon Sep 17 00:00:00 2001 From: Johannes Tuikkala Date: Mon, 12 Jan 2015 10:18:42 +0200 Subject: Fix for: TreeTable with ContainerHierarchicalWrapper not correctly displaying child items (#15421) Change-Id: Iadf1faa979fbae412b55551c6622b0429039a21c --- .../data/util/ContainerHierarchicalWrapper.java | 14 ++++ .../TreeTableContainerHierarchicalWrapper.java | 82 ++++++++++++++++++++++ .../TreeTableContainerHierarchicalWrapperTest.java | 55 +++++++++++++++ 3 files changed, 151 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapper.java create mode 100644 uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapperTest.java diff --git a/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java b/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java index 0bfec33957..199d186fab 100644 --- a/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java +++ b/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java @@ -450,6 +450,8 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, // Update parent parent.remove(itemId); + fireItemSetChangeIfAbstractContainer(); + return true; } @@ -490,9 +492,21 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, } } + fireItemSetChangeIfAbstractContainer(); + return true; } + /** + * inform container (if it is instance of AbstractContainer) about the + * change in hierarchy (#15421) + */ + private void fireItemSetChangeIfAbstractContainer() { + if (container instanceof AbstractContainer) { + ((AbstractContainer) container).fireItemSetChange(); + } + } + /** * Creates a new Item into the Container, assigns it an automatic ID, and * adds it to the hierarchy. diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapper.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapper.java new file mode 100644 index 0000000000..95f8c54e9e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapper.java @@ -0,0 +1,82 @@ +package com.vaadin.tests.components.treetable; + +import com.vaadin.data.util.BeanItemContainer; +import com.vaadin.data.util.ContainerHierarchicalWrapper; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Tree.ExpandEvent; +import com.vaadin.ui.Tree.ExpandListener; +import com.vaadin.ui.TreeTable; + +@SuppressWarnings("serial") +public class TreeTableContainerHierarchicalWrapper extends AbstractTestUI { + + TreeTable treetable = new TreeTable(); + BeanItemContainer beanContainer = new BeanItemContainer( + Bean.class); + ContainerHierarchicalWrapper hierarchicalWrapper = new ContainerHierarchicalWrapper( + beanContainer); + + @Override + protected void setup(VaadinRequest request) { + treetable = new TreeTable(); + treetable.setImmediate(true); + treetable.setWidth("100%"); + treetable.setHeight(null); + treetable.setPageLength(0); + treetable.setContainerDataSource(hierarchicalWrapper); + + treetable.addExpandListener(new ExpandListener() { + @Override + public void nodeExpand(ExpandEvent event) { + Bean parent = ((Bean) event.getItemId()); + if (!hierarchicalWrapper.hasChildren(parent)) { + for (int i = 1; i <= 5; i++) { + Bean newChild = new Bean(parent.getId() + "-" + i); + beanContainer.addBean(newChild); + hierarchicalWrapper.setParent(newChild, parent); + } + } + + } + }); + + for (int i = 0; i < 3; i++) { + beanContainer.addBean(new Bean("Item " + i)); + } + + addComponent(treetable); + } + + public class Bean { + public static final String PROP_ID = "id"; + private String id; + + public Bean() { + // empty + } + + public Bean(String id) { + this.id = id; + } + + public void setId(String id) { + this.id = id; + } + + public String getId() { + return id; + } + } + + @Override + protected String getTestDescription() { + return "Tests that TreeTable with ContainerHierarchicalWrapper is updated correctly when the setParent() is called for the item just added"; + } + + @Override + protected Integer getTicketNumber() { + return 15421; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapperTest.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapperTest.java new file mode 100644 index 0000000000..f767e5fd52 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapperTest.java @@ -0,0 +1,55 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.treetable; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.TestBenchElement; +import com.vaadin.testbench.elements.TreeTableElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Tests that TreeTable with ContainerHierarchicalWrapper is updated correctly + * when the setParent() is called for the item just added + * + * @author Vaadin Ltd + */ +public class TreeTableContainerHierarchicalWrapperTest extends MultiBrowserTest { + + @Test + public void testStructure() throws InterruptedException { + openTestURL(); + + TreeTableElement treeTable = $(TreeTableElement.class).first(); + WebElement findElement = treeTable.getCell(0, 0).findElement( + By.className("v-treetable-treespacer")); + findElement.click(); + + TestBenchElement cell = treeTable.getCell(5, 0); + WebElement findElement2 = cell.findElement(By + .className("v-treetable-treespacer")); + assertEquals("Item 0-5", cell.getText()); + findElement2.click(); + + TestBenchElement cell2 = treeTable.getCell(10, 0); + assertEquals("Item 0-5-5", cell2.getText()); + } + +} -- cgit v1.2.3 From 2a7fb2236cafe1ae0d1cb2fbd468c85b8a440e28 Mon Sep 17 00:00:00 2001 From: Matti Hosio Date: Wed, 14 Jan 2015 12:13:31 +0200 Subject: Remove unnecessary scrollbar when zooming in or out (#15164) Adds overflow-hidden in cases where scrollbars should not be needed Change-Id: Icee2444b0e7ee999fe49fadcb1598027453d49c5 --- client/src/com/vaadin/client/ui/VScrollTable.java | 18 ++ .../table/UnnecessaryScrollbarWhenZooming.java | 51 ++++++ .../table/UnnecessaryScrollbarWhenZoomingTest.java | 195 +++++++++++++++++++++ 3 files changed, 264 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZooming.java create mode 100644 uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZoomingTest.java diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index 895ea9aa8f..48036a6399 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -6890,7 +6890,16 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * visibleCellCount; if (willHaveScrollbars()) { totalExtraWidth += Util.getNativeScrollbarSize(); + // if there will be vertical scrollbar, let's enable it + scrollBodyPanel.getElement().getStyle().clearOverflowY(); + } else { + // if there is no need for vertical scrollbar, let's disable it + // this is necessary since sometimes the browsers insist showing + // the scrollbar even if the content would fit perfectly + scrollBodyPanel.getElement().getStyle() + .setOverflowY(Overflow.HIDDEN); } + availW -= totalExtraWidth; int forceScrollBodyWidth = -1; @@ -6908,6 +6917,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets, forceScrollBodyWidth = usedMinimumWidth + totalExtraWidth; } extraSpace = 0; + // if there will be horizontal scrollbar, let's enable it + scrollBodyPanel.getElement().getStyle().clearOverflowX(); + } else { + // if there is no need for horizontal scrollbar, let's disable + // it + // this is necessary since sometimes the browsers insist showing + // the scrollbar even if the content would fit perfectly + scrollBodyPanel.getElement().getStyle() + .setOverflowX(Overflow.HIDDEN); } if (forceScrollBodyWidth > 0) { diff --git a/uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZooming.java b/uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZooming.java new file mode 100644 index 0000000000..8d95261825 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZooming.java @@ -0,0 +1,51 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.table; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Table; + +public class UnnecessaryScrollbarWhenZooming extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + Table table = new Table("A Table"); + table.setId("test-table"); + table.addContainerProperty("Text property 1", String.class, null); + table.addContainerProperty("Text property 2", String.class, null); + table.addContainerProperty("Text property 3", String.class, null); + table.addContainerProperty("Numeric property", Integer.class, null); + table.addItem(new Object[] { "Value 1 ", "Value 2", "Value 3", + new Integer(39) }, new Integer(1)); + table.addItem(new Object[] { "Value 1 ", "Value 2", "Value 3", + new Integer(39) }, new Integer(2)); + table.setWidth("100%"); + table.setPageLength(0); + addComponent(table); + } + + @Override + protected String getTestDescription() { + return "Test case for extra scrollbar being displayed in Table when browser window is zoomed (or page length is 0)"; + } + + @Override + protected Integer getTicketNumber() { + return 15164; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZoomingTest.java b/uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZoomingTest.java new file mode 100644 index 0000000000..df01800180 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZoomingTest.java @@ -0,0 +1,195 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.table; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Arrays; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.commands.TestBenchCommandExecutor; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class UnnecessaryScrollbarWhenZoomingTest extends MultiBrowserTest { + + private ZoomLevelSetter zoomSetter; + private int zoomOutIterations = 3; + private int zoomInIterations = 3; + + @Before + public void init() { + testBench().resizeViewPortTo(995, 400); + DesiredCapabilities capabilities = getDesiredCapabilities(); + if (BrowserUtil.isChrome(capabilities) + || BrowserUtil.isPhantomJS(capabilities)) { + zoomSetter = new ChromeZoomLevelSetter(driver); + } else { + zoomSetter = new NonChromeZoomLevelSetter(driver); + } + zoomSetter.resetZoom(); + openTestURL(); + // IE sometimes has trouble waiting long enough. + new WebDriverWait(getDriver(), 30).until(ExpectedConditions + .presenceOfElementLocated(By + .cssSelector(".v-table-body-wrapper"))); + } + + @Test + public void testInitial() { + testExtraScrollbarsNotShown(); + } + + @Test + public void testZoomingIn() { + for (int i = 0; i < zoomInIterations; i++) { + zoomSetter.increaseZoom(); + testExtraScrollbarsNotShown(); + } + } + + @Test + public void testZoomingOut() throws InterruptedException { + for (int i = 0; i < zoomOutIterations; i++) { + zoomSetter.decreaseZoom(); + testExtraScrollbarsNotShown(); + } + } + + @After + public void resetZoomLevel() { + zoomSetter.resetZoom(); + } + + private void testExtraScrollbarsNotShown() { + // wait a bit for the layout + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + Assert.fail(); + } + WebElement element = findElement(By + .cssSelector(".v-table-body-wrapper")); + assertNotNull("There must be a table", element); + String overflow = element.getCssValue("overflow"); + // As long as the overflow is hidden, there will not be scroll bars. + if (!"hidden".equals(overflow)) { + // compare scroll width to offset width. True if scrolling. + String detectHorizontalScroll = "return arguments[0].scrollWidth > arguments[0].clientWidth"; + Boolean horizontal = (Boolean) ((TestBenchCommandExecutor) getDriver()) + .executeScript(detectHorizontalScroll, element); + assertEquals("there must be no horizontal scrollbar", false, + horizontal); + + String detectVerticalScroll = "return arguments[0].scrollHeight > arguments[0].clientHeight"; + Boolean vertical = (Boolean) ((TestBenchCommandExecutor) getDriver()) + .executeScript(detectVerticalScroll, element); + assertEquals("there must be no vertical scrollbar", false, vertical); + } + } + + interface ZoomLevelSetter { + public void increaseZoom(); + + public void decreaseZoom(); + + public void resetZoom(); + } + + /* + * A class for setting the zoom levels by sending keys such as ctrl and +. + */ + class NonChromeZoomLevelSetter implements ZoomLevelSetter { + private WebDriver driver; + + public NonChromeZoomLevelSetter(WebDriver driver) { + this.driver = driver; + } + + @Override + public void increaseZoom() { + getElement().sendKeys(Keys.chord(Keys.CONTROL, Keys.ADD)); + } + + @Override + public void decreaseZoom() { + getElement().sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT)); + } + + @Override + public void resetZoom() { + getElement().sendKeys(Keys.chord(Keys.CONTROL, "0")); + } + + private WebElement getElement() { + return driver.findElement(By.tagName("html")); + } + } + + /* + * A class for setting the zoom levels using JavaScript. This setter is used + * for browsers for which the method of sending the keys ctrl and + does not + * work. + */ + class ChromeZoomLevelSetter implements ZoomLevelSetter { + private JavascriptExecutor js; + private int currentZoomIndex = 2; + private int[] zoomLevels = { 70, 80, 90, 100, 110, 120, 130 }; + + public ChromeZoomLevelSetter(WebDriver driver) { + js = (JavascriptExecutor) driver; + } + + @Override + public void increaseZoom() { + currentZoomIndex++; + if (currentZoomIndex >= zoomLevels.length) { + currentZoomIndex = zoomLevels.length - 1; + } + js.executeScript("document.body.style.zoom='" + + zoomLevels[currentZoomIndex] + "%'"); + } + + @Override + public void decreaseZoom() { + currentZoomIndex--; + if (currentZoomIndex < 0) { + currentZoomIndex = 0; + } + js.executeScript("document.body.style.zoom='" + + zoomLevels[currentZoomIndex] + "%'"); + } + + @Override + public void resetZoom() { + js.executeScript("document.body.style.zoom='100%'"); + currentZoomIndex = Arrays.binarySearch(zoomLevels, 100); + } + } + +} -- cgit v1.2.3 From 5de08c952a7d94792b72cf551c3b79a2f058b865 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Wed, 21 Jan 2015 08:44:01 +0200 Subject: Fix WindowMaximizeRestoreTest. (#15408) Change-Id: I2c9c389723318c8f54e2e901cf4babfedc885a3f --- .../com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uitest/tb2/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html b/uitest/tb2/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html index 059e031035..65d5fd20e3 100644 --- a/uitest/tb2/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html +++ b/uitest/tb2/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html @@ -148,7 +148,7 @@ mouseClick - vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2] + vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0] 10,8 -- cgit v1.2.3 From f818f7cb44fc77db7252e97c78608ae6c67d6ab6 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Wed, 21 Jan 2015 08:43:33 +0000 Subject: Revert "Update text value also with timer triggered text change events. (#16270)" This reverts commit c8d4c9e8cf1fa869c89751dc9a9b55f9be64773f. Change-Id: I73f19e80aef0fe37231ec5c261e0901e6bbd2d99 --- client/src/com/vaadin/client/ui/VTextField.java | 3 +- server/src/com/vaadin/ui/AbstractTextField.java | 6 ++-- .../TextFieldWithPropertyFormatterTest.java | 25 ++++++-------- .../components/TextFieldValueChangeTest.java | 14 ++++---- .../textfield/TimerTriggeredTextChangeEvent.java | 40 ---------------------- .../TimerTriggeredTextChangeEventTest.java | 27 --------------- 6 files changed, 20 insertions(+), 95 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEvent.java delete mode 100644 uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEventTest.java diff --git a/client/src/com/vaadin/client/ui/VTextField.java b/client/src/com/vaadin/client/ui/VTextField.java index 792ea23a8a..b402ced218 100644 --- a/client/src/com/vaadin/client/ui/VTextField.java +++ b/client/src/com/vaadin/client/ui/VTextField.java @@ -392,8 +392,7 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler, String newText = prompting ? "" : getText(); if (newText != null && !newText.equals(valueBeforeEdit)) { sendValueChange = immediate; - client.updateVariable(paintableId, - TextFieldConstants.VAR_CUR_TEXT, newText, false); + client.updateVariable(paintableId, "text", newText, false); valueBeforeEdit = newText; valueBeforeEditIsSynced = true; } diff --git a/server/src/com/vaadin/ui/AbstractTextField.java b/server/src/com/vaadin/ui/AbstractTextField.java index 5f1bec2488..93025ac0fd 100644 --- a/server/src/com/vaadin/ui/AbstractTextField.java +++ b/server/src/com/vaadin/ui/AbstractTextField.java @@ -182,13 +182,11 @@ public abstract class AbstractTextField extends AbstractField implements } // Sets the text - if (variables.containsKey(TextFieldConstants.VAR_CUR_TEXT) && - !isReadOnly()) { + if (variables.containsKey("text") && !isReadOnly()) { // Only do the setting if the string representation of the value // has been updated - String newValue = (String) - variables.get(TextFieldConstants.VAR_CUR_TEXT); + String newValue = (String) variables.get("text"); // server side check for max length if (getMaxLength() != -1 && newValue.length() > getMaxLength()) { diff --git a/server/tests/src/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatterTest.java b/server/tests/src/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatterTest.java index 624a8eaf20..8f2bec455b 100644 --- a/server/tests/src/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatterTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatterTest.java @@ -1,21 +1,17 @@ package com.vaadin.tests.server.component.textfield; +import java.util.Collections; + +import junit.framework.TestCase; + import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.ObjectProperty; import com.vaadin.data.util.PropertyFormatter; -import com.vaadin.shared.ui.textfield.TextFieldConstants; import com.vaadin.ui.TextField; -import org.junit.Before; -import org.junit.Test; -import java.util.Collections; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class TextFieldWithPropertyFormatterTest { +public class TextFieldWithPropertyFormatterTest extends TestCase { private static final String INPUT_VALUE = "foo"; private static final String PARSED_VALUE = "BAR"; @@ -28,8 +24,10 @@ public class TextFieldWithPropertyFormatterTest { private int listenerCalled; private int repainted; - @Before - public void setUp() throws Exception { + @Override + protected void setUp() throws Exception { + super.setUp(); + field = new TextField() { @Override public void markAsDirty() { @@ -72,7 +70,6 @@ public class TextFieldWithPropertyFormatterTest { repainted = 0; } - @Test public void testWithServerApi() { checkInitialState(); @@ -96,13 +93,11 @@ public class TextFieldWithPropertyFormatterTest { assertEquals(FORMATTED_VALUE, field.getValue()); } - @Test public void testWithSimulatedClientSideChange() { checkInitialState(); field.changeVariables(null, - Collections.singletonMap(TextFieldConstants.VAR_CUR_TEXT, - (Object) INPUT_VALUE)); + Collections.singletonMap("text", (Object) INPUT_VALUE)); checkEndState(); diff --git a/server/tests/src/com/vaadin/tests/server/components/TextFieldValueChangeTest.java b/server/tests/src/com/vaadin/tests/server/components/TextFieldValueChangeTest.java index f25664c3cc..cfceb6f7d7 100644 --- a/server/tests/src/com/vaadin/tests/server/components/TextFieldValueChangeTest.java +++ b/server/tests/src/com/vaadin/tests/server/components/TextFieldValueChangeTest.java @@ -1,15 +1,15 @@ package com.vaadin.tests.server.components; +import java.util.HashMap; +import java.util.Map; + +import org.easymock.EasyMock; +import org.junit.Assert; + import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.util.ObjectProperty; -import com.vaadin.shared.ui.textfield.TextFieldConstants; import com.vaadin.ui.AbstractField; import com.vaadin.ui.TextField; -import org.easymock.EasyMock; -import org.junit.Assert; - -import java.util.HashMap; -import java.util.Map; /** * Check that the value change listener for a text field is triggered exactly @@ -38,7 +38,7 @@ public class TextFieldValueChangeTest extends @Override protected void setValue(AbstractField field) { Map variables = new HashMap(); - variables.put(TextFieldConstants.VAR_CUR_TEXT, "newValue"); + variables.put("text", "newValue"); ((TextField) field).changeVariables(field, variables); } diff --git a/uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEvent.java b/uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEvent.java deleted file mode 100644 index 89f8215547..0000000000 --- a/uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.vaadin.tests.components.textfield; - -import com.vaadin.event.FieldEvents; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.AbstractTextField; -import com.vaadin.ui.Label; -import com.vaadin.ui.TextField; - -public class TimerTriggeredTextChangeEvent extends AbstractTestUI { - @Override - protected void setup(VaadinRequest request) { - final TextField textfield = new TextField(); - final Label serverValue = new Label(); - serverValue.setCaption("Server:"); - - textfield.addTextChangeListener(new FieldEvents.TextChangeListener() { - @Override - public void textChange(FieldEvents.TextChangeEvent event) { - serverValue.setValue(textfield.getValue()); - } - }); - - textfield.setTextChangeEventMode( - AbstractTextField.TextChangeEventMode.EAGER); - - addComponent(textfield); - addComponent(serverValue); - } - - @Override - protected Integer getTicketNumber() { - return 16270; - } - - @Override - protected String getTestDescription() { - return "Text value in server should always be updated."; - } -} diff --git a/uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEventTest.java b/uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEventTest.java deleted file mode 100644 index c0fed66851..0000000000 --- a/uitest/src/com/vaadin/tests/components/textfield/TimerTriggeredTextChangeEventTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.vaadin.tests.components.textfield; - -import com.vaadin.testbench.elements.LabelElement; -import com.vaadin.testbench.elements.TextFieldElement; -import com.vaadin.tests.tb3.MultiBrowserTest; -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -public class TimerTriggeredTextChangeEventTest extends MultiBrowserTest { - - @Test - public void serverValueIsUpdated() { - openTestURL(); - - TextFieldElement textfield = $(TextFieldElement.class).first(); - LabelElement serverValue = $(LabelElement.class).caption("Server:") - .first(); - - textfield.sendKeys("f"); - - assertThat(textfield.getValue(), is("f")); - assertThat(serverValue.getText(), is("f")); - } - -} \ No newline at end of file -- cgit v1.2.3