use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.
the class ContextGridTest method assertNOPDomainObjectSelection.
private void assertNOPDomainObjectSelection() {
verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
assertThat(domainObjectSelectionEvent.getDomainObject()).isInstanceOf(NOPDomainObject.class);
}
use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.
the class ExpressionContainerGridTest method testSelectCellWithCoordinates.
@Test
public void testSelectCellWithCoordinates() {
final int uiRowIndex = 0;
final int uiColumnIndex = 1;
final LiteralExpression domainObject = mock(LiteralExpression.class);
when(hasExpression.asDMNModelInstrumentedBase()).thenReturn(domainObject);
grid.setExpression(NODE_UUID, hasExpression, Optional.of(hasName), false);
grid.selectCell(uiRowIndex, uiColumnIndex, false, true);
verify(gridLayer).select(eq(grid));
verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
assertThat(domainObjectSelectionEvent.getCanvasHandler()).isEqualTo(canvasHandler);
assertThat(domainObjectSelectionEvent.getDomainObject()).isEqualTo(domainObject);
verify(cellSelectionManager).selectCell(eq(uiRowIndex), eq(uiColumnIndex), eq(false), eq(true));
}
use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method assertDomainObjectEventFiring.
private void assertDomainObjectEventFiring() {
verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
assertThat(domainObjectSelectionEvent.getDomainObject()).isInstanceOf(NOPDomainObject.class);
}
use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testSelectFirstCellWithRowAndNonRowNumberColumn.
@Test
public void testSelectFirstCellWithRowAndNonRowNumberColumn() {
grid.getModel().appendRow(new BaseGridRow());
appendColumns(GridColumn.class);
grid.selectFirstCell();
assertThat(grid.getModel().getSelectedCells()).isNotEmpty();
assertThat(grid.getModel().getSelectedCells()).contains(new GridData.SelectedCell(0, 0));
verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
assertThat(domainObjectSelectionEvent.getDomainObject()).isInstanceOf(NOPDomainObject.class);
}
use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testSelectCellWithPoint.
@Test
public void testSelectCellWithPoint() {
grid.getModel().appendRow(new BaseGridRow());
appendColumns(RowNumberColumn.class, GridColumn.class);
final Point2D point = mock(Point2D.class);
final double columnOffset = grid.getModel().getColumns().get(0).getWidth();
final double columnWidth = grid.getModel().getColumns().get(1).getWidth() / 2;
final double rowOffset = HEADER_HEIGHT + grid.getModel().getRow(0).getHeight() / 2;
when(point.getX()).thenReturn(columnOffset + columnWidth);
when(point.getY()).thenReturn(rowOffset);
grid.selectCell(point, false, true);
assertThat(grid.getModel().getSelectedCells()).isNotEmpty();
assertThat(grid.getModel().getSelectedCells()).contains(new GridData.SelectedCell(0, 1));
verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
assertThat(domainObjectSelectionEvent.getDomainObject()).isInstanceOf(NOPDomainObject.class);
}
Aggregations