diff options
author | Anna Koskinen <anna@vaadin.com> | 2013-01-11 11:48:32 +0200 |
---|---|---|
committer | Anna Koskinen <anna@vaadin.com> | 2013-01-11 11:48:32 +0200 |
commit | f9dca2ef3f4b25ef5516fefc5cf3b037e75996cd (patch) | |
tree | 5b456e0998a9591233f2cb6d6bacd769b89dbdb1 /uitest/src | |
parent | 0b6c89db179c03903db2423f4925ad097ce001c7 (diff) | |
download | vaadin-framework-f9dca2ef3f4b25ef5516fefc5cf3b037e75996cd.tar.gz vaadin-framework-f9dca2ef3f4b25ef5516fefc5cf3b037e75996cd.zip |
Merge of (#8298) to Vaadin 7.
Viewport calculation fix.
Change-Id: Ic5195e5f7027ab41f18ddcd8262f9b5a23a0da8b
Diffstat (limited to 'uitest/src')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.html | 61 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.java | 73 |
2 files changed, 134 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.html b/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.html new file mode 100644 index 0000000000..aa2b29b3b7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.html @@ -0,0 +1,61 @@ +<?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>ViewPortCalculation</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">ViewPortCalculation</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.table.ViewPortCalculation?restartApplication</td> + <td></td> +</tr> +<tr> + <td>doubleClickAt</td> + <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[0]</td> + <td>25,7</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td> + <td>v-table-focus</td> +</tr> +<tr> + <td>doubleClickAt</td> + <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[6]/domChild[2]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[6]</td> + <td>v-table-focus</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[2]/domChild[0]</td> + <td>15,9</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]</td> + <td>v-table-focus</td> +</tr> +<tr> + <td>doubleClickAt</td> + <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[9]/domChild[2]</td> + <td>23,7</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[9]</td> + <td>v-table-focus</td> +</tr> +</tbody></table> +</body> +</html>
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.java b/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.java new file mode 100644 index 0000000000..878dd0d3c4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.java @@ -0,0 +1,73 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.data.Item; +import com.vaadin.event.ItemClickEvent; +import com.vaadin.event.ItemClickEvent.ItemClickListener; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Table; +import com.vaadin.ui.Table.CellStyleGenerator; + +public class ViewPortCalculation extends TestBase { + + private Object lastDoubleClickedItemId; + + @Override + protected void setup() { + getLayout().setSpacing(true); + addComponent(createTestTable(10)); + } + + @Override + protected String getDescription() { + return "Table rows that are too far down (but still visible) don't get focus after refreshRowCache/select (double-click)." + + "<br> Double-clicking on the seventh (or any further) row of causes focus to jump to the first row."; + } + + @Override + protected Integer getTicketNumber() { + return 8298; + } + + private Table createTestTable(int rows) { + final Table table = new Table(); + table.setId("table"); + table.setSelectable(true); + table.setPageLength(0); + + table.addContainerProperty("col1", String.class, null); + table.addContainerProperty("col2", String.class, null); + table.addContainerProperty("col3", String.class, null); + + for (int i = 1; i <= rows; ++i) { + testData(table.addItem("row" + i), i); + } + + table.setCellStyleGenerator(new CellStyleGenerator() { + public String getStyle(Table source, Object itemId, + Object propertyId) { + if (itemId.equals(lastDoubleClickedItemId)) { + return "bold"; + } + return null; + } + }); + + table.addItemClickListener(new ItemClickListener() { + public void itemClick(ItemClickEvent event) { + if (event.isDoubleClick()) { + lastDoubleClickedItemId = event.getItemId(); + table.refreshRowCache(); + table.select(event.getItemId()); + } + } + }); + return table; + } + + private void testData(Item item, int i) { + item.getItemProperty("col1").setValue("test1-" + i); + item.getItemProperty("col2").setValue("test2-" + i); + item.getItemProperty("col3").setValue("test3-" + i); + } + +} |