From 5981b6e6b693eb2a4166c1954f96ab0f93c7f744 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Fri, 13 Jun 2014 10:45:40 +0300 Subject: Convert GridLayoutMoveComponentTest to TB4. (#8855) Change-Id: I4be636273b2fd8dae544a6f0b88d8fdb00c33826 --- .../tests/layouts/GridLayoutMoveComponent.html | 57 ----------------- .../tests/layouts/GridLayoutMoveComponent.java | 69 --------------------- .../gridlayout/GridLayoutMoveComponent.java | 72 ++++++++++++++++++++++ .../gridlayout/GridLayoutMoveComponentTest.java | 31 ++++++++++ 4 files changed, 103 insertions(+), 126 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.html delete mode 100644 uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.java create mode 100644 uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java create mode 100644 uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponentTest.java (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.html b/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.html deleted file mode 100644 index 77a17263f8..0000000000 --- a/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.layouts.GridLayoutMoveComponent?restartApplication
screenCaptureall-left
clickvaadin=runcomvaadintestslayoutsGridLayoutMoveComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapturelabel-right
clickvaadin=runcomvaadintestslayoutsGridLayoutMoveComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapturelabel-button-right
clickvaadin=runcomvaadintestslayoutsGridLayoutMoveComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapturelabel-button-textfield-right
- - diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.java deleted file mode 100644 index efd1277653..0000000000 --- a/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.vaadin.tests.layouts; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.TextField; - -public class GridLayoutMoveComponent extends TestBase { - - @Override - protected void setup() { - final GridLayout grid = new GridLayout(2, 3); - grid.setCaption("Fixed size grid"); - grid.setWidth("300px"); - grid.setHeight("100px"); - addComponent(grid); - - final Label l = new Label("100% label"); - final Button b = new Button("100px button"); - b.setWidth("100px"); - final TextField tf = new TextField("Undef textfield"); - - // Adding component to grid - grid.addComponent(l, 0, 0); - grid.addComponent(b, 0, 1); - grid.addComponent(tf, 0, 2); - - addComponent(new Button("Shift label right", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - // Moving component from 0,0 -> 1,0 - grid.removeComponent(l); - grid.addComponent(l, 1, 0); - } - })); - - addComponent(new Button("Shift button right", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - grid.removeComponent(b); - grid.addComponent(b, 1, 1); - } - })); - - addComponent(new Button("Shift text field right", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - grid.removeComponent(tf); - grid.addComponent(tf, 1, 2); - } - })); - } - - @Override - protected String getDescription() { - return "Click the buttons below the GridLayout to move the components to the right. Should definitely work no matter what."; - } - - @Override - protected Integer getTicketNumber() { - return 5525; - } - -} diff --git a/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java new file mode 100644 index 0000000000..cd86fbcf3c --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java @@ -0,0 +1,72 @@ +package com.vaadin.tests.layouts.gridlayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.TextField; + +public class GridLayoutMoveComponent extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final GridLayout grid = new GridLayout(2, 3); + grid.setCaption("Fixed size grid"); + grid.setWidth("300px"); + grid.setHeight("100px"); + addComponent(grid); + + final Label l = new Label("100% label"); + final Button b = new Button("100px button"); + b.setWidth("100px"); + final TextField tf = new TextField("Undef textfield"); + + // Adding component to grid + grid.addComponent(l, 0, 0); + grid.addComponent(b, 0, 1); + grid.addComponent(tf, 0, 2); + + addComponent(new Button("Shift label right", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + // Moving component from 0,0 -> 1,0 + grid.removeComponent(l); + grid.addComponent(l, 1, 0); + } + })); + + addComponent(new Button("Shift button right", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + grid.removeComponent(b); + grid.addComponent(b, 1, 1); + } + })); + + addComponent(new Button("Shift text field right", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + grid.removeComponent(tf); + grid.addComponent(new Label("I'm on left"), 0, 2); + grid.addComponent(tf, 1, 2); + } + })); + } + + @Override + protected String getTestDescription() { + return "Click the buttons below the GridLayout to move the components to the right. Should definitely work no matter what."; + } + + @Override + protected Integer getTicketNumber() { + return 5525; + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponentTest.java b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponentTest.java new file mode 100644 index 0000000000..0fab64989a --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponentTest.java @@ -0,0 +1,31 @@ +package com.vaadin.tests.layouts.gridlayout; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.MultiBrowserTest; +import org.junit.Test; + +import java.io.IOException; + +public class GridLayoutMoveComponentTest extends MultiBrowserTest { + + @Test + public void componentsShouldMoveRight() throws IOException { + openTestURL(); + + compareScreen("all-left"); + + clickButtonWithCaption("Shift label right"); + compareScreen("label-right"); + + clickButtonWithCaption("Shift button right"); + compareScreen("label-button-right"); + + clickButtonWithCaption("Shift text field right"); + compareScreen("label-button-textfield-right"); + } + + private void clickButtonWithCaption(String caption) { + $(ButtonElement.class).caption(caption).first().click(); + } + +} \ No newline at end of file -- cgit v1.2.3