diff options
author | Automerge <automerge@vaadin.com> | 2012-04-18 13:21:15 +0000 |
---|---|---|
committer | Automerge <automerge@vaadin.com> | 2012-04-18 13:21:15 +0000 |
commit | c521f6ed4c40eeee5f4a9fa1628aff711e37bb7d (patch) | |
tree | 75fbc23a0f4d395da33a0bf3670197cb70858bd2 /tests | |
parent | c3e10ebbbc48d124a88d6e92e16faccdebe43223 (diff) | |
download | vaadin-framework-c521f6ed4c40eeee5f4a9fa1628aff711e37bb7d.tar.gz vaadin-framework-c521f6ed4c40eeee5f4a9fa1628aff711e37bb7d.zip |
[merge from 6.7] Test for #8662: Improved old #2864 test case and added a TestBench script
svn changeset:23572/svn branch:6.8
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testbench/com/vaadin/tests/components/table/TestCurrentPageFirstItem.html | 42 | ||||
-rw-r--r-- | tests/testbench/com/vaadin/tests/components/table/TestCurrentPageFirstItem.java | 83 |
2 files changed, 91 insertions, 34 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/table/TestCurrentPageFirstItem.html b/tests/testbench/com/vaadin/tests/components/table/TestCurrentPageFirstItem.html new file mode 100644 index 0000000000..ac06706aa5 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/TestCurrentPageFirstItem.html @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>TestCurrentPageFirstItem</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">TestCurrentPageFirstItem</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/TestCurrentPageFirstItem?restartApplication</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runTestCurrentPageFirstItem::/VHorizontalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runTestCurrentPageFirstItem::/VHorizontalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runTestCurrentPageFirstItem::/VHorizontalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/table/TestCurrentPageFirstItem.java b/tests/testbench/com/vaadin/tests/components/table/TestCurrentPageFirstItem.java index 1733b15e80..6e38f2a156 100644 --- a/tests/testbench/com/vaadin/tests/components/table/TestCurrentPageFirstItem.java +++ b/tests/testbench/com/vaadin/tests/components/table/TestCurrentPageFirstItem.java @@ -1,60 +1,75 @@ package com.vaadin.tests.components.table; -import com.vaadin.Application; import com.vaadin.data.Container; import com.vaadin.data.Item; import com.vaadin.data.util.IndexedContainer; +import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Table; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -public class TestCurrentPageFirstItem extends Application implements - ClickListener { +public class TestCurrentPageFirstItem extends TestBase implements ClickListener { private Button buttonIndex; private Button buttonItem; - private Table table; + private Table[] tables = new Table[4]; private int counter = 0; IndexedContainer container = new IndexedContainer(); @Override - public void init() { - try { - Window main = new Window("Table header Test"); - setMainWindow(main); - main.setSizeFull(); - // setTheme("testtheme"); - VerticalLayout baseLayout = new VerticalLayout(); - main.setContent(baseLayout); - - table = new Table(); - container.addContainerProperty("row", String.class, ""); - table.setContainerDataSource(container); - table.setWidth("100%"); - table.setPageLength(3); - buttonIndex = new Button("Add row and select last index", this); - buttonItem = new Button("Add row and select last item", this); - - baseLayout.addComponent(table); - baseLayout.addComponent(buttonIndex); - baseLayout.addComponent(buttonItem); - } catch (Exception e) { - e.printStackTrace(); + public void setup() { + container.addContainerProperty("row", String.class, ""); + + HorizontalLayout baseLayout = new HorizontalLayout(); + baseLayout.setHeight("115px"); + addComponent(baseLayout); + + for (int i = 0; i < tables.length; ++i) { + Table t = new Table(); + t.setContainerDataSource(container); + t.setWidth("100px"); + baseLayout.addComponent(t); + tables[i] = t; } + tables[0].setSizeFull(); + tables[0].setCaption("Full"); + tables[1].setHeight("100px"); + tables[1].setCaption("100px"); + tables[2].setHeight("95%"); + tables[2].setCaption("95%"); + tables[3].setPageLength(3); + tables[3].setCaption("3 rows"); + + buttonIndex = new Button("Add row and select last index", this); + buttonItem = new Button("Add row and select last item", this); + baseLayout.addComponent(buttonIndex); + baseLayout.addComponent(buttonItem); } public void buttonClick(ClickEvent event) { Item item = container.addItem(++counter); item.getItemProperty("row").setValue(counter + ""); - table.select(counter); - if (event.getButton() == buttonIndex) { - table.setCurrentPageFirstItemIndex(((Container.Indexed) table - .getContainerDataSource()).indexOfId(counter)); - } else { - table.setCurrentPageFirstItemId(counter); + for (int i = 0; i < tables.length; ++i) { + Table t = tables[i]; + t.select(counter); + if (event.getButton() == buttonIndex) { + t.setCurrentPageFirstItemIndex(((Container.Indexed) t + .getContainerDataSource()).indexOfId(counter)); + } else { + t.setCurrentPageFirstItemId(counter); + } } } + + @Override + protected String getDescription() { + return "Table height changes when using setCurrentPageFirstItemId"; + } + + @Override + protected Integer getTicketNumber() { + return 2864; + } } |