use of org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent in project nebula.widgets.nattable by eclipse.
the class RowSelectionModelStructuralChangeEventHandlerTest method shouldFireRowSelectionEventOnDelete.
@Test
public void shouldFireRowSelectionEventOnDelete() {
// Select single row
this.nattable.doCommand(new SelectRowsCommand(this.nattable, 5, 5, false, false));
assertEquals(1, this.selectionLayer.getSelectedRowCount());
assertEquals(1, this.listener.getEventsCount());
assertTrue(this.listener.containsInstanceOf(RowSelectionEvent.class));
RowSelectionEvent event = (RowSelectionEvent) this.listener.getReceivedEvents().get(0);
assertEquals(4, event.getRowPositionRanges().iterator().next().start);
assertEquals(5, event.getRowPositionRanges().iterator().next().end);
// Delete the selected row
this.listFixture.remove(4);
this.bodyDataLayer.fireLayerEvent(new RowDeleteEvent(this.bodyDataLayer, 4));
assertEquals(0, this.selectionLayer.getSelectedRowCount());
assertEquals(3, this.listener.getEventsCount());
assertTrue(this.listener.containsInstanceOf(RowSelectionEvent.class));
event = (RowSelectionEvent) this.listener.getReceivedEvents().get(1);
assertEquals(1, event.getRowPositionRanges().size());
assertEquals(4, event.getRowPositionRanges().iterator().next().start);
assertEquals(5, event.getRowPositionRanges().iterator().next().end);
}
Aggregations