use of org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture in project nebula.widgets.nattable by eclipse.
the class CommandPropagationTest method shouldPropagateToUnderlyingLayer.
@Test
public void shouldPropagateToUnderlyingLayer() {
LayerCommandFixture command = new LayerCommandFixture();
this.layer.doCommand(command);
Assert.assertTrue(command.getTargetLayer() instanceof DataLayerFixture);
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture in project nebula.widgets.nattable by eclipse.
the class AbstractLayerTest method commandHandlerRegistration.
@Test
public void commandHandlerRegistration() throws Exception {
LayerCommandFixture command = new LayerCommandFixture();
CommandHandlerFixture commandHandler = new CommandHandlerFixture();
this.dataLayer.registerCommandHandler(commandHandler);
this.dataLayer.doCommand(command);
assertNotNull(commandHandler.getLastCommandHandled());
commandHandler.clearLastCommandHandled();
this.dataLayer.unregisterCommandHandler(command.getClass());
this.dataLayer.doCommand(command);
assertNull(commandHandler.getLastCommandHandled());
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture in project nebula.widgets.nattable by eclipse.
the class ColumnReorderLayerTest method commandPassedOnToParentIfCannotBeHandled.
@Test
public void commandPassedOnToParentIfCannotBeHandled() throws Exception {
ColumnReorderLayer reorderLayer = new ColumnReorderLayer(new DataLayerFixture());
assertFalse(reorderLayer.doCommand(new LayerCommandFixture()));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture in project nebula.widgets.nattable by eclipse.
the class GridLayerTest method doCommandInvokesBodyFirst.
@Test
public void doCommandInvokesBodyFirst() throws Exception {
DummyCommandHandler bodyCommandHandler = new DummyCommandHandler(true);
DummyCommandHandler columnHeaderCommandHandler = new DummyCommandHandler(true);
DummyCommandHandler rowHeaderCommandHandler = new DummyCommandHandler(true);
DummyCommandHandler cornerCommandHandler = new DummyCommandHandler(true);
this.bodyDataLayer.registerCommandHandler(bodyCommandHandler);
this.columnHeaderDataLayer.registerCommandHandler(columnHeaderCommandHandler);
this.rowHeaderDataLayer.registerCommandHandler(rowHeaderCommandHandler);
this.cornerDataLayer.registerCommandHandler(cornerCommandHandler);
final ILayerCommand command = new LayerCommandFixture();
this.gridLayerUnderTest.doCommand(command);
Assert.assertTrue(bodyCommandHandler.isCommandCaught());
Assert.assertFalse(columnHeaderCommandHandler.isCommandCaught());
Assert.assertFalse(rowHeaderCommandHandler.isCommandCaught());
Assert.assertFalse(cornerCommandHandler.isCommandCaught());
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture in project nebula.widgets.nattable by eclipse.
the class GridLayerTest method doCommandInvokesOtherLayers.
@Test
public void doCommandInvokesOtherLayers() throws Exception {
DummyCommandHandler bodyCommandHandler = new DummyCommandHandler(false);
DummyCommandHandler columnHeaderCommandHandler = new DummyCommandHandler(false);
DummyCommandHandler rowHeaderCommandHandler = new DummyCommandHandler(false);
DummyCommandHandler cornerCommandHandler = new DummyCommandHandler(true);
this.bodyDataLayer.registerCommandHandler(bodyCommandHandler);
this.columnHeaderDataLayer.registerCommandHandler(columnHeaderCommandHandler);
this.rowHeaderDataLayer.registerCommandHandler(rowHeaderCommandHandler);
this.cornerDataLayer.registerCommandHandler(cornerCommandHandler);
final ILayerCommand command = new LayerCommandFixture();
this.gridLayerUnderTest.doCommand(command);
Assert.assertFalse(bodyCommandHandler.isCommandCaught());
Assert.assertFalse(columnHeaderCommandHandler.isCommandCaught());
Assert.assertFalse(rowHeaderCommandHandler.isCommandCaught());
Assert.assertTrue(cornerCommandHandler.isCommandCaught());
}
Aggregations