blob: c9208e3226859843acab62cd5f0516538a1257d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package com.vaadin.tests.components.grid;
import com.vaadin.testbench.elements.GridElement;
import com.vaadin.tests.tb3.SingleBrowserTest;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
public class GridColumnWidthWithoutHeaderTest extends SingleBrowserTest {
public static final int THRESHOLD = 3;
@Test
public void testWidthWithoutHeader() {
openTestURL();
GridElement grid = $(GridElement.class).first();
int columnsWidth = getColWidthsRounded(grid);
assertTrue(Math
.abs(columnsWidth - grid.getSize().getWidth()) <= THRESHOLD);
}
private int getColWidthsRounded(GridElement grid) {
GridElement.GridRowElement firstRow = grid.getRow(0);
int width = 0;
for (int i = 0; i < 3; i++) {
width = width + firstRow.getCell(i).getSize().getWidth();
}
return width;
}
}
|