import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
$(NativeButtonElement.class).caption("Add").first().click();
// Click the button in cell 1,1
- TestBenchElement cell = getGrid().getCell(1, 1);
+ TestBenchElement cell = getGrid().getCell(1, 2);
WebElement gwtButton = cell.findElement(By.tagName("button"));
gwtButton.click();
$(NativeButtonElement.class).caption("DetachAttach").first().click();
// Click the button in cell 1,1
- TestBenchElement cell = getGrid().getCell(1, 1);
+ TestBenchElement cell = getGrid().getCell(1, 2);
WebElement gwtButton = cell.findElement(By.tagName("button"));
gwtButton.click();
openTestURL();
- addColumn(Renderers.CPLX_RENDERER);
+ // Test initial renderering with contentVisible = False
+ TestBenchElement cell = getGrid().getCell(51, 1);
+ String backgroundColor = cell.getCssValue("backgroundColor");
+ assertEquals("Background color was not red.", colorRed, backgroundColor);
+ // data arrives...
sleep((int) (latency * SLEEP_MULTIPLIER));
+ // Content becomes visible
+ cell = getGrid().getCell(51, 1);
+ backgroundColor = cell.getCssValue("backgroundColor");
+ assertNotEquals("Background color was red.", colorRed, backgroundColor);
+
+ // scroll down, new cells becomes contentVisible = False
getGrid().scrollToRow(60);
+
// Cell should be red (setContentVisible set cell red)
- TestBenchElement cell = getGrid().getCell(51, 1);
- String backgroundColor = cell.getCssValue("backgroundColor");
+ cell = getGrid().getCell(55, 1);
+ backgroundColor = cell.getCssValue("backgroundColor");
assertEquals("Background color was not red.", colorRed, backgroundColor);
- // Wait for data to arrive
+ // data arrives...
sleep((int) (latency * SLEEP_MULTIPLIER));
// Cell should no longer be red
private class DelayedDataSource implements DataSource<String> {
private DataSource<String> ds;
- private int firstRowIndex;
+ private int firstRowIndex = -1;
private int numberOfRows;
private DataChangeHandler dataChangeHandler;
private int latency;
grid.addColumn(c);
grid.getHeader().getDefaultRow().getCell(0).setText("Column 1");
+ // Add another column with a custom complex renderer
+ c = createColumnWithRenderer(Renderers.CPLX_RENDERER);
+ grid.addColumn(c);
+ grid.getHeader().getDefaultRow().getCell(1).setText("Column 2");
+
// Add method for testing sort event firing
grid.addSortHandler(new SortEventHandler<String>() {
@Override