Search in sources :

Example 16 with AdvancedFindTab

use of au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab in project constellation by constellation-app.

the class ColourCriteriaPanelNGTest method setUpMethod.

@BeforeMethod
public void setUpMethod() throws Exception {
    findViewTopComponent = mock(FindViewTopComponent.class);
    spyTopComponent = spy(findViewTopComponent);
    findViewPane = mock(FindViewPane.class);
    findViewTabs = mock(FindViewTabs.class);
    FindViewController.getDefault();
    basicFindTab = mock(BasicFindTab.class);
    replaceTab = mock(ReplaceTab.class);
    when(findViewTabs.getParentComponent()).thenReturn(findViewPane);
    when(findViewPane.getTabs()).thenReturn(findViewTabs);
    when(findViewTabs.getBasicFindTab()).thenReturn(basicFindTab);
    when(findViewTabs.getReplaceTab()).thenReturn(replaceTab);
    when(findViewTabs.getAdvancedFindTab()).thenReturn(advancedTab);
    advancedTab = new AdvancedFindTab(findViewTabs);
}
Also used : ReplaceTab(au.gov.asd.tac.constellation.views.find2.components.ReplaceTab) AdvancedFindTab(au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab) FindViewTabs(au.gov.asd.tac.constellation.views.find2.components.FindViewTabs) BasicFindTab(au.gov.asd.tac.constellation.views.find2.components.BasicFindTab) FindViewTopComponent(au.gov.asd.tac.constellation.views.find2.FindViewTopComponent) FindViewPane(au.gov.asd.tac.constellation.views.find2.components.FindViewPane) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 17 with AdvancedFindTab

use of au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab in project constellation by constellation-app.

the class ColourCriteriaPanelNGTest method testGetCriteriaValues.

/**
 * Test of getCriteriaValues method, of class ColourCriteriaPanel.
 */
@Test
public void testGetCriteriaValues() {
    System.out.println("getCriteriaValues");
    setupGraph();
    AdvancedFindTab parentComponent = spy(advancedTab);
    final GraphElementType type = GraphElementType.VERTEX;
    ColourCriteriaPanel colourCriteriaPanel = new ColourCriteriaPanel(parentComponent, "color", type);
    colourCriteriaPanel.getFilterChoiceBox().getSelectionModel().select("Is");
    final List<AdvancedCriteriaBorderPane> tempList = new ArrayList<>();
    final GridPane tempGrid = new GridPane();
    tempList.add(colourCriteriaPanel);
    tempGrid.add(tempList.get(0), 0, 0);
    when(parentComponent.getCorrespondingCriteriaList(Mockito.eq(type))).thenReturn(tempList);
    when(parentComponent.getCorrespondingGridPane(Mockito.eq(type))).thenReturn(tempGrid);
    final List<AdvancedCriteriaBorderPane> criteriaList = parentComponent.getCorrespondingCriteriaList(type);
    final FindCriteriaValues result = criteriaList.get(0).getCriteriaValues();
    final ColourCriteriaValues colourResult = (ColourCriteriaValues) result;
    assertEquals(colourResult.getAttribute(), "color");
    assertEquals(colourResult.getAttributeType(), "color");
    assertEquals(colourResult.getFilter(), "Is");
    assertEquals(colourResult.getColorValue(), ConstellationColor.BLUE);
}
Also used : FindCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FindCriteriaValues) GridPane(javafx.scene.layout.GridPane) AdvancedFindTab(au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab) ArrayList(java.util.ArrayList) ColourCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.ColourCriteriaValues) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) Test(org.testng.annotations.Test)

Example 18 with AdvancedFindTab

use of au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab in project constellation by constellation-app.

the class StringCriteriaPanelNGTest method testSetSearchFieldText.

/**
 * Test of setSearchFieldText method, of class StringCriteriaPanel.
 */
@Test
public void testSetSearchFieldText() {
    System.out.println("setSearchFieldText");
    setupGraph();
    AdvancedFindTab parentComponent = spy(advancedTab);
    final GraphElementType type = GraphElementType.VERTEX;
    StringCriteriaPanel stringCriteriaPanel = new StringCriteriaPanel(parentComponent, "Identifier", type);
    stringCriteriaPanel.getFilterChoiceBox().getSelectionModel().select("Is");
    stringCriteriaPanel.setSearchFieldText("test");
    assertEquals(stringCriteriaPanel.getSearchFieldText(), "test");
// TODO review the generated test code and remove the default call to fail.
}
Also used : AdvancedFindTab(au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) Test(org.testng.annotations.Test)

Example 19 with AdvancedFindTab

use of au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab in project constellation by constellation-app.

the class StringCriteriaPanelNGTest method testGetCriteriaValues.

/**
 * Test of getCriteriaValues method, of class StringCriteriaPanel.
 */
@Test
public void testGetCriteriaValues() {
    System.out.println("getCriteriaValues");
    setupGraph();
    AdvancedFindTab parentComponent = spy(advancedTab);
    final GraphElementType type = GraphElementType.VERTEX;
    StringCriteriaPanel stringCriteriaPanel = new StringCriteriaPanel(parentComponent, "Identifier", type);
    stringCriteriaPanel.getFilterChoiceBox().getSelectionModel().select("Is");
    stringCriteriaPanel.setSearchFieldText("hello");
    final List<AdvancedCriteriaBorderPane> tempList = new ArrayList<>();
    final GridPane tempGrid = new GridPane();
    tempList.add(stringCriteriaPanel);
    tempGrid.add(tempList.get(0), 0, 0);
    when(parentComponent.getCorrespondingCriteriaList(Mockito.eq(type))).thenReturn(tempList);
    when(parentComponent.getCorrespondingGridPane(Mockito.eq(type))).thenReturn(tempGrid);
    final List<AdvancedCriteriaBorderPane> criteriaList = parentComponent.getCorrespondingCriteriaList(type);
    final FindCriteriaValues result = criteriaList.get(0).getCriteriaValues();
    final StringCriteriaValues floatResult = (StringCriteriaValues) result;
    assertEquals(floatResult.getAttribute(), "Identifier");
    assertEquals(floatResult.getAttributeType(), "string");
    assertEquals(floatResult.getFilter(), "Is");
    assertEquals(floatResult.getText(), "hello");
}
Also used : FindCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FindCriteriaValues) GridPane(javafx.scene.layout.GridPane) AdvancedFindTab(au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab) ArrayList(java.util.ArrayList) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) StringCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.StringCriteriaValues) Test(org.testng.annotations.Test)

Aggregations

GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)15 Test (org.testng.annotations.Test)15 AdvancedFindTab (au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab)14 FindCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FindCriteriaValues)8 ArrayList (java.util.ArrayList)8 FindViewTopComponent (au.gov.asd.tac.constellation.views.find2.FindViewTopComponent)4 BasicFindTab (au.gov.asd.tac.constellation.views.find2.components.BasicFindTab)4 FindViewPane (au.gov.asd.tac.constellation.views.find2.components.FindViewPane)4 FindViewTabs (au.gov.asd.tac.constellation.views.find2.components.FindViewTabs)4 ReplaceTab (au.gov.asd.tac.constellation.views.find2.components.ReplaceTab)4 AdvancedCriteriaBorderPane (au.gov.asd.tac.constellation.views.find2.components.advanced.AdvancedCriteriaBorderPane)4 StringCriteriaPanel (au.gov.asd.tac.constellation.views.find2.components.advanced.StringCriteriaPanel)4 StringCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.StringCriteriaValues)4 GridPane (javafx.scene.layout.GridPane)4 BeforeMethod (org.testng.annotations.BeforeMethod)4 FindViewController (au.gov.asd.tac.constellation.views.find2.FindViewController)3 ChoiceBox (javafx.scene.control.ChoiceBox)3 BooleanCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.BooleanCriteriaValues)1 ColourCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.ColourCriteriaValues)1 FloatCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FloatCriteriaValues)1