Search in sources :

Example 1 with MockDataProvider

use of org.gwtproject.view.client.AbstractDataProviderTest.MockDataProvider in project gwtproject by treblereel.

the class DefaultNodeInfoTest method testSetDataDisplay.

public void testSetDataDisplay() {
    SelectionModel<String> model = new SingleSelectionModel<String>();
    org.gwtproject.view.client.DefaultSelectionEventManager<String> manager = DefaultSelectionEventManager.createDefaultManager();
    MockDataProvider<String> provider = new MockDataProvider<String>(null);
    DefaultNodeInfo<String> nodeInfo = new DefaultNodeInfo<String>(provider, new TextCell(), model, manager, null);
    MockHasData<String> display = new MockHasData<String>();
    display.setVisibleRange(0, 10);
    display.clearLastRowDataAndRange();
    assertEquals(0, display.getHandlerCount(org.gwtproject.view.client.CellPreviewEvent.getType()));
    // setDataDisplay.
    nodeInfo.setDataDisplay(display);
    assertEquals(1, display.getHandlerCount(org.gwtproject.view.client.CellPreviewEvent.getType()));
    provider.assertLastRangeChanged(display);
    provider.clearLastRangeChanged();
    display.setVisibleRange(0, 5);
    provider.assertLastRangeChanged(display);
    provider.clearLastRangeChanged();
    // unsetDataDisplay.
    nodeInfo.unsetDataDisplay();
    assertEquals(0, display.getHandlerCount(CellPreviewEvent.getType()));
    display.setVisibleRange(0, 5);
    provider.assertLastRangeChanged(null);
}
Also used : DefaultNodeInfo(org.gwtproject.view.client.TreeViewModel.DefaultNodeInfo) TextCell(org.gwtproject.cell.client.TextCell) MockDataProvider(org.gwtproject.view.client.AbstractDataProviderTest.MockDataProvider)

Aggregations

TextCell (org.gwtproject.cell.client.TextCell)1 MockDataProvider (org.gwtproject.view.client.AbstractDataProviderTest.MockDataProvider)1 DefaultNodeInfo (org.gwtproject.view.client.TreeViewModel.DefaultNodeInfo)1