aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin
diff options
context:
space:
mode:
authorHenrik Paul <henrik@vaadin.com>2015-03-05 10:00:33 +0200
committerHenrik Paul <henrik@vaadin.com>2015-03-05 10:00:33 +0200
commit44c874331e789b9cd09f7132ae5710736141386a (patch)
tree2f8d048cd036c8c59151d45c04fcede693b99118 /uitest/src/com/vaadin
parentdc760a8a2cd74642c5e188ad7f890cb43047a6ad (diff)
parentcdb8996e925784c908b8b7607b1650c09811f293 (diff)
downloadvaadin-framework-44c874331e789b9cd09f7132ae5710736141386a.tar.gz
vaadin-framework-44c874331e789b9cd09f7132ae5710736141386a.zip
Merge branch 'master' into HEAD
Change-Id: I85867836aba8bd2cb51729fecdb1c449c439d3e7
Diffstat (limited to 'uitest/src/com/vaadin')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridWidthIncreaseTest.java34
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientColumnPropertiesTest.java10
2 files changed, 27 insertions, 17 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridWidthIncreaseTest.java b/uitest/src/com/vaadin/tests/components/grid/GridWidthIncreaseTest.java
index bf9110b01d..96b1a56fba 100644
--- a/uitest/src/com/vaadin/tests/components/grid/GridWidthIncreaseTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/GridWidthIncreaseTest.java
@@ -16,12 +16,15 @@
package com.vaadin.tests.components.grid;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
import org.junit.Test;
+import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.parallel.BrowserUtil;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class GridWidthIncreaseTest extends MultiBrowserTest {
@@ -29,28 +32,37 @@ public class GridWidthIncreaseTest extends MultiBrowserTest {
private static int INCREASE_COUNT = 3;
@Test
- public void testColumnsExpandWithGrid() {
+ public void testColumnsExpandWithGrid() throws IOException {
openTestURL();
GridElement grid = $(GridElement.class).first();
- int[] widths = new int[GridWidthIncrease.COLUMN_COUNT];
+ double accuracy = 1.0d;
+ DesiredCapabilities cap = getDesiredCapabilities();
+ if (BrowserUtil.isIE(cap, 8) || BrowserUtil.isIE(cap, 9)
+ || BrowserUtil.isPhantomJS(cap)) {
+ accuracy = 2.0d;
+ }
+
for (int i = 0; i < INCREASE_COUNT; ++i) {
- int totalWidth = 0;
$(ButtonElement.class).first().click();
+ int prevWidth = 0;
for (int c = 0; c < GridWidthIncrease.COLUMN_COUNT; ++c) {
int width = grid.getCell(0, c).getSize().getWidth();
- totalWidth += width;
- widths[c] = width;
if (c > 0) {
// check that columns are roughly the same width.
- assertEquals("Difference in column widths", widths[c],
- widths[c - 1], 1.0d);
+ assertEquals("Difference in column widths", prevWidth,
+ width, accuracy);
}
+ prevWidth = width;
}
- // Column widths should be the same as table wrapper size
- assertTrue(totalWidth == grid.getTableWrapper().getSize()
- .getWidth());
+ /*
+ * Column widths should be the same as table wrapper size. Since
+ * Selenium doesn't support subpixels correctly, we use a rough
+ * estimation.
+ */
+ assertEquals(grid.getRow(0).getSize().getWidth(), grid
+ .getTableWrapper().getSize().getWidth(), accuracy);
}
}
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientColumnPropertiesTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientColumnPropertiesTest.java
index 2ba1dbc311..9e7256e0d3 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientColumnPropertiesTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientColumnPropertiesTest.java
@@ -145,14 +145,12 @@ public class GridClientColumnPropertiesTest extends GridBasicClientFeaturesTest
gridElement = getGridElement();
headerCells = gridElement.getHeaderCells(0);
final int size = headerCells.size();
- // skip last column since there is a bug in the width of the last column
- for (int i = 0; i < size - 1; i++) {
+ for (int i = 0; i < size; i++) {
+ // Avoid issues with inaccuracies regarding subpixels.
assertEquals(
"Column widths don't match after reset, index after flip "
- + i,
- columnWidths.get(i),
- Integer.valueOf(headerCells.get(size - 1 - i).getSize()
- .getWidth()));
+ + i, columnWidths.get(i),
+ headerCells.get(size - 1 - i).getSize().getWidth(), 1.0d);
}
}