Search in sources :

Example 1 with LayerCommandFixture

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);
}
Also used : LayerCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) Test(org.junit.Test)

Example 2 with LayerCommandFixture

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());
}
Also used : LayerCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture) CommandHandlerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.command.CommandHandlerFixture) Test(org.junit.Test)

Example 3 with LayerCommandFixture

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()));
}
Also used : LayerCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) BaseDataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture) Test(org.junit.Test)

Example 4 with 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());
}
Also used : LayerCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture) ILayerCommand(org.eclipse.nebula.widgets.nattable.command.ILayerCommand) Test(org.junit.Test)

Example 5 with LayerCommandFixture

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());
}
Also used : LayerCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture) ILayerCommand(org.eclipse.nebula.widgets.nattable.command.ILayerCommand) Test(org.junit.Test)

Aggregations

LayerCommandFixture (org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture)6 Test (org.junit.Test)6 DataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture)3 ILayerCommand (org.eclipse.nebula.widgets.nattable.command.ILayerCommand)2 BaseDataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture)2 CommandHandlerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.command.CommandHandlerFixture)1