diff options
author | John Ahlroos <john@vaadin.com> | 2012-11-07 15:09:41 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-11-09 12:17:58 +0000 |
commit | 2d77a27144caf8f679e467bd8486e042a13c8594 (patch) | |
tree | 213d86dd61e4313d67d91363f3f44a19ca9d07f4 /uitest/src/com | |
parent | ed73e06bb76666788c187741d574c99947bcf69c (diff) | |
download | vaadin-framework-2d77a27144caf8f679e467bd8486e042a13c8594.tar.gz vaadin-framework-2d77a27144caf8f679e467bd8486e042a13c8594.zip |
Fixed ordering in ordered layout when inserting components #10154
Change-Id: I025745a4f575ecaece0e897e9b8f90adba7c2d63
Diffstat (limited to 'uitest/src/com')
2 files changed, 234 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/OrderedLayoutComponentOrdering.html b/uitest/src/com/vaadin/tests/components/orderedlayout/OrderedLayoutComponentOrdering.html new file mode 100644 index 0000000000..ba75d7e56e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/OrderedLayoutComponentOrdering.html @@ -0,0 +1,151 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8888/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.orderedlayout.OrderedLayoutComponentOrdering?restartApplication</td> + <td></td> +</tr> +<!--Add two buttons as first--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>3</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td>4</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td>1</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td>2</td> +</tr> +<!--Add two buttons as second--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>3</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td>5</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td>6</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td>4</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td>1</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[5]/VButton[0]/domChild[0]/domChild[0]</td> + <td>2</td> +</tr> +<!--Add two buttons as third--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>3</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td>5</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td>7</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td>8</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td>6</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[5]/VButton[0]/domChild[0]/domChild[0]</td> + <td>4</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[6]/VButton[0]/domChild[0]/domChild[0]</td> + <td>1</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[7]/VButton[0]/domChild[0]/domChild[0]</td> + <td>2</td> +</tr> +<!--Move last to first--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>2</td> +</tr> +<!--Move forth to second--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[5]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutComponentOrdering::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VHorizontalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td>7</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/OrderedLayoutComponentOrdering.java b/uitest/src/com/vaadin/tests/components/orderedlayout/OrderedLayoutComponentOrdering.java new file mode 100644 index 0000000000..5857df20b1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/OrderedLayoutComponentOrdering.java @@ -0,0 +1,83 @@ +package com.vaadin.tests.components.orderedlayout; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.HorizontalLayout; + +public class OrderedLayoutComponentOrdering extends TestBase { + + int counter = 0; + + @Override + protected void setup() { + + // Initially horizontal layout has a,b + Button a = new Button(String.valueOf(++counter)); + Button b = new Button(String.valueOf(++counter)); + final HorizontalLayout hl = new HorizontalLayout(a, b); + hl.setCaption("Horizontal layout"); + hl.setSpacing(true); + addComponent(hl); + + Button addFirst = new Button("add first"); + addFirst.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + hl.addComponent(new Button(String.valueOf(++counter)), 0); + hl.addComponent(new Button(String.valueOf(++counter)), 1); + } + }); + addComponent(addFirst); + + Button add = new Button("add second"); + add.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + hl.addComponent(new Button(String.valueOf(++counter)), 1); + hl.addComponent(new Button(String.valueOf(++counter)), 2); + } + }); + addComponent(add); + + Button addThird = new Button("add third"); + addThird.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + hl.addComponent(new Button(String.valueOf(++counter)), 2); + hl.addComponent(new Button(String.valueOf(++counter)), 3); + } + }); + addComponent(addThird); + + Button move = new Button("move last to first"); + move.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + hl.addComponentAsFirst(hl.getComponent(hl.getComponentCount() - 1)); + } + }); + addComponent(move); + + Button swap = new Button("move forth to second"); + swap.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + hl.addComponent(hl.getComponent(3), 1); + } + }); + addComponent(swap); + + } + + @Override + protected String getDescription() { + return "The order should be 1,3,4,2"; + } + + @Override + protected Integer getTicketNumber() { + return 10154; + } + +} |