use of au.gov.asd.tac.constellation.views.tableview.state.TableViewState in project constellation by constellation-app.
the class TableNGTest method updateColumnsGraphNull.
@Test
public void updateColumnsGraphNull() {
try (final MockedStatic<Platform> platformMockedStatic = Mockito.mockStatic(Platform.class)) {
table.updateColumns(null, new TableViewState());
platformMockedStatic.verifyNoInteractions();
}
}
use of au.gov.asd.tac.constellation.views.tableview.state.TableViewState in project constellation by constellation-app.
the class TableNGTest method updateDataGraphNull.
@Test
public void updateDataGraphNull() {
try (final MockedStatic<Platform> platformMockedStatic = Mockito.mockStatic(Platform.class)) {
table.updateData(null, new TableViewState(), null);
platformMockedStatic.verifyNoInteractions();
}
}
use of au.gov.asd.tac.constellation.views.tableview.state.TableViewState in project constellation by constellation-app.
the class TableViewPageFactoryNGTest method updateSelectionNotOnFxThread.
@Test(expectedExceptions = IllegalStateException.class)
public void updateSelectionNotOnFxThread() {
try (final MockedStatic<Platform> platformMockedStatic = Mockito.mockStatic(Platform.class)) {
platformMockedStatic.when(Platform::isFxApplicationThread).thenReturn(false);
tableViewPageFactory.restoreSelectionFromGraph(graph, new TableViewState(), null);
}
}
use of au.gov.asd.tac.constellation.views.tableview.state.TableViewState in project constellation by constellation-app.
the class SelectedOnlySelectionListenerNGTest method onChanged.
@Test
public void onChanged() {
final TableViewState currentState = new TableViewState();
currentState.setSelectedOnly(true);
final TableViewSelectionModel<ObservableList<String>> selectionModel = mock(TableViewSelectionModel.class);
when(tableViewTopComponent.getCurrentState()).thenReturn(currentState);
// 4 rows. Rows 1 and 3 are currently selected. Row 2 was previously selected. Row 4 is not
// selected and never was.
final ObservableList<ObservableList<String>> items = FXCollections.observableList(List.of(FXCollections.observableList(List.of("row1Column1", "row1Column2")), FXCollections.observableList(List.of("row2Column1", "row2Column2")), FXCollections.observableList(List.of("row3Column1", "row3Column2")), FXCollections.observableList(List.of("row4Column1", "row4Column2"))));
final ObservableList<ObservableList<String>> selectedItems = FXCollections.observableList(List.of(FXCollections.observableList(List.of("row1Column1", "row1Column2")), FXCollections.observableList(List.of("row3Column1", "row3Column2"))));
selectedOnlySelectedRows.add(FXCollections.observableList(List.of("row2Column1", "row2Column2")));
when(tableView.getItems()).thenReturn(items);
when(tableView.getSelectionModel()).thenReturn(selectionModel);
when(selectionModel.getSelectedItems()).thenReturn(selectedItems);
selectedOnlySelectionListener.onChanged(null);
final Set<ObservableList<String>> expectedSelectedRows = Set.of(FXCollections.observableList(List.of("row1Column1", "row1Column2")), FXCollections.observableList(List.of("row3Column1", "row3Column2")));
assertEquals(expectedSelectedRows, selectedOnlySelectedRows);
}
use of au.gov.asd.tac.constellation.views.tableview.state.TableViewState in project constellation by constellation-app.
the class TableSelectionListenerNGTest method changedCurrentStateSelectedOnlyModeFalse.
@Test
public void changedCurrentStateSelectedOnlyModeFalse() {
try (MockedStatic<TableViewUtilities> tableViewUtilitiesMockedStatic = Mockito.mockStatic(TableViewUtilities.class)) {
final TableViewState currentState = new TableViewState();
currentState.setSelectedOnly(false);
currentState.setElementType(GraphElementType.META);
final Graph graph = mock(Graph.class);
when(tableViewTopComponent.getCurrentState()).thenReturn(currentState);
when(tableViewTopComponent.getCurrentGraph()).thenReturn(graph);
tableSelectionListener.changed(null, null, null);
tableViewUtilitiesMockedStatic.verify(() -> TableViewUtilities.copySelectionToGraph(same(tableView), same(rowToElementIdIndex), eq(GraphElementType.META), same(graph)));
}
}
Aggregations