aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-09-03 12:31:35 +0000
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-09-03 12:31:35 +0000
commitc75cf3956abddcf71ec72e0743eae1cdd52aa661 (patch)
tree549c08aa6fa962d6fd569febb4b735e2b3dd341e
parent0b715b453186e492e0c20c4964a28706a76ef9e7 (diff)
downloadvaadin-framework-c75cf3956abddcf71ec72e0743eae1cdd52aa661.tar.gz
vaadin-framework-c75cf3956abddcf71ec72e0743eae1cdd52aa661.zip
TestBench test case for #8291
svn changeset:24289/svn branch:6.8
-rw-r--r--tests/testbench/com/vaadin/tests/components/table/TableReduceContainerSize.html67
-rw-r--r--tests/testbench/com/vaadin/tests/components/table/TableReduceContainerSize.java (renamed from tests/testbench/com/vaadin/tests/tickets/Ticket8291.java)56
2 files changed, 108 insertions, 15 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/table/TableReduceContainerSize.html b/tests/testbench/com/vaadin/tests/components/table/TableReduceContainerSize.html
new file mode 100644
index 0000000000..9bd0149bdb
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/table/TableReduceContainerSize.html
@@ -0,0 +1,67 @@
+<?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>TableReduceContainerSize</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TableReduceContainerSize</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/TableReduceContainerSize?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>scroll</td>
+ <td>vaadin=runTableReduceContainerSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]</td>
+ <td>19700</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>300</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runTableReduceContainerSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runTableReduceContainerSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td>
+ <td>Index: *</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runTableReduceContainerSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>scroll</td>
+ <td>vaadin=runTableReduceContainerSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]</td>
+ <td>19700</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>300</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runTableReduceContainerSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runTableReduceContainerSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td>
+ <td>Index: *</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket8291.java b/tests/testbench/com/vaadin/tests/components/table/TableReduceContainerSize.java
index 86b5db953b..bc729ef042 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket8291.java
+++ b/tests/testbench/com/vaadin/tests/components/table/TableReduceContainerSize.java
@@ -1,28 +1,28 @@
-package com.vaadin.tests.tickets;
+package com.vaadin.tests.components.table;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import com.vaadin.Application;
import com.vaadin.data.Container.Filter;
import com.vaadin.data.Item;
import com.vaadin.data.util.BeanItemContainer;
+import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
-import com.vaadin.ui.Window;
/**
* Test for #8291 and #7666: NegativeArraySizeException when Table scrolled to
* the end and its size reduced.
*/
-public class Ticket8291 extends Application {
+public class TableReduceContainerSize extends TestBase {
@Override
- public void init() {
- setMainWindow(new Window("", new TestView()));
+ protected void setup() {
+ addComponent(new TestView());
}
private static class DecimateFilter implements Filter {
@@ -59,25 +59,41 @@ public class Ticket8291 extends Application {
};
table.setContainerDataSource(container);
addComponent(table);
+ final Label label = new Label();
+ addComponent(label);
Button button = new Button("Click");
button.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
- reduceData = !reduceData;
- table.refreshRowCache();
+ try {
+ reduceData = !reduceData;
+ table.refreshRowCache();
+ label.setValue("Index: "
+ + table.getCurrentPageFirstItemIndex());
+ } catch (Exception e) {
+ label.setValue("Exception: "
+ + e.getClass().getSimpleName());
+ }
}
});
addComponent(button);
Button button2 = new Button("Filter");
button2.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
- if (filter != null) {
- container.removeAllContainerFilters();
- filter = null;
- } else {
- filter = new DecimateFilter();
- container.addContainerFilter(filter);
+ try {
+ if (filter != null) {
+ container.removeAllContainerFilters();
+ filter = null;
+ } else {
+ filter = new DecimateFilter();
+ container.addContainerFilter(filter);
+ }
+ table.refreshRowCache();
+ label.setValue("Index: "
+ + table.getCurrentPageFirstItemIndex());
+ } catch (Exception e) {
+ label.setValue("Exception: "
+ + e.getClass().getSimpleName());
}
- table.refreshRowCache();
}
});
addComponent(button2);
@@ -118,4 +134,14 @@ public class Ticket8291 extends Application {
}
+ @Override
+ protected String getDescription() {
+ return "Table throws NegativeArraySizeException if container size is reduced to less than current scroll position";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8291;
+ }
+
}