diff options
author | John Alhroos <john.ahlroos@itmill.com> | 2010-12-21 13:53:09 +0000 |
---|---|---|
committer | John Alhroos <john.ahlroos@itmill.com> | 2010-12-21 13:53:09 +0000 |
commit | 9ee0c0d568410fb76b35d8e6f4bbdc910c69759a (patch) | |
tree | dc2bf27e1f582601e899d78decdef06dc6873ec9 /tests | |
parent | f23bf594fd61f943723bafb6db48151115f2ba3e (diff) | |
download | vaadin-framework-9ee0c0d568410fb76b35d8e6f4bbdc910c69759a.tar.gz vaadin-framework-9ee0c0d568410fb76b35d8e6f4bbdc910c69759a.zip |
Fix for #6188 + Testbench tests
svn changeset:16608/svn branch:6.5
Diffstat (limited to 'tests')
4 files changed, 252 insertions, 0 deletions
diff --git a/tests/src/com/vaadin/tests/components/tabsheet/TabGetAndReplaceComponent.html b/tests/src/com/vaadin/tests/components/tabsheet/TabGetAndReplaceComponent.html new file mode 100644 index 0000000000..fce39361e1 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/tabsheet/TabGetAndReplaceComponent.html @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<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.tabsheet.TabGetAndReplaceComponent?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabGetAndReplaceComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> + <td>18,13</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabGetAndReplaceComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VLabel[1]</td> + <td>Content 2</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabGetAndReplaceComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabGetAndReplaceComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VLabel[1]</td> + <td>Replacement 2</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabGetAndReplaceComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td> + <td>41,13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabGetAndReplaceComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]</td> + <td>16,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabGetAndReplaceComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td> + <td>39,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabGetAndReplaceComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> + <td>42,12</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabGetAndReplaceComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>37,10</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabGetAndReplaceComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VLabel[0]</td> + <td>Content 1</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/src/com/vaadin/tests/components/tabsheet/TabGetAndReplaceComponent.java b/tests/src/com/vaadin/tests/components/tabsheet/TabGetAndReplaceComponent.java new file mode 100644 index 0000000000..c49133dd7c --- /dev/null +++ b/tests/src/com/vaadin/tests/components/tabsheet/TabGetAndReplaceComponent.java @@ -0,0 +1,54 @@ +package com.vaadin.tests.components.tabsheet; + +import java.util.Iterator; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Component; +import com.vaadin.ui.Label; +import com.vaadin.ui.TabSheet; +import com.vaadin.ui.TabSheet.Tab; + +public class TabGetAndReplaceComponent extends TestBase { + + @Override + protected void setup() { + final TabSheet tabs = new TabSheet(); + + tabs.addTab(new Label("Content 1"), "Content 1", null); + tabs.addTab(new Label("Content 2"), "Content 2", null); + tabs.addTab(new Label("Content 3"), "Content 3", null); + tabs.addTab(new Label("Content 4"), "Content 4", null); + tabs.addTab(new Label("Content 5"), "Content 5", null); + addComponent(tabs); + + Button replace2 = new Button("Replace Content 2", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Iterator<Component> iter = tabs.getComponentIterator(); + iter.next(); + + Component content2 = iter.next(); + Tab tab = tabs.getTab(content2); + + // Replace content + tabs.replaceComponent(tab.getComponent(), new Label( + "Replacement 2")); + + } + }); + addComponent(replace2); + } + + @Override + protected String getDescription() { + return "The tab should have a reference to the component it holds"; + } + + @Override + protected Integer getTicketNumber() { + return 6188; + } + +} diff --git a/tests/src/com/vaadin/tests/components/tabsheet/TabSheetIndexOperations.html b/tests/src/com/vaadin/tests/components/tabsheet/TabSheetIndexOperations.html new file mode 100644 index 0000000000..8db5641603 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/tabsheet/TabSheetIndexOperations.html @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.tabsheet.TabSheetIndexOperations?restartApplication</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetIndexOperations::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetIndexOperations::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td> + <td>Added Tab 1</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetIndexOperations::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetIndexOperations::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td> + <td>1 baT deddA</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetIndexOperations::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetIndexOperations::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td> + <td>Tab 1</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/src/com/vaadin/tests/components/tabsheet/TabSheetIndexOperations.java b/tests/src/com/vaadin/tests/components/tabsheet/TabSheetIndexOperations.java new file mode 100644 index 0000000000..31bf1f1588 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/tabsheet/TabSheetIndexOperations.java @@ -0,0 +1,74 @@ +package com.vaadin.tests.components.tabsheet; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Label; +import com.vaadin.ui.TabSheet; +import com.vaadin.ui.TabSheet.Tab; + +public class TabSheetIndexOperations extends TestBase { + + private int tabCounter = 1; + + @Override + protected void setup() { + final TabSheet tabs = new TabSheet(); + + // Add some tabs + tabs.addTab(new Label("Content 1"), "Tab 1", null); + tabs.addTab(new Label("Content 2"), "Tab 2", null); + tabs.addTab(new Label("Content 3"), "Tab 3", null); + + addComponent(tabs); + + Button addTab = new Button("Add tab at index 2", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + tabs.addTab(new Label("Content " + tabCounter), + "Added Tab " + tabCounter, null, 2); + tabCounter++; + } + }); + addComponent(addTab); + + Button setCaption = new Button("Invert tab caption at index 2", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Tab tab = tabs.getTab(2); + tab.setCaption(new StringBuffer(tab.getCaption()) + .reverse().toString()); + } + }); + addComponent(setCaption); + + Button move = new Button("Move selected tab to index 2", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + tabs.setTabIndex(tabs.getTab(tabs.getSelectedTab()), 2); + } + }); + addComponent(move); + + Button getIndex = new Button("Get selected tab index", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + getMainWindow().showNotification( + "Index: " + + tabs.getTabIndex(tabs.getTab(tabs + .getSelectedTab()))); + + } + }); + addComponent(getIndex); + } + + @Override + protected String getDescription() { + return "You can use indexes to add and reorder the TabSheet"; + } + + @Override + protected Integer getTicketNumber() { + return 6188; + } + +} |