use of org.corpus_tools.annis.gui.flatquerybuilder.MetaBox in project ANNIS by korpling.
the class FlatQueryBuilderTest method removeBoxes.
@Test
void removeBoxes() {
initQueryBuilder(0);
// Add a token and two meta data boxes
queryBuilder.addLinguisticSequenceBox("tok");
queryBuilder.addMetaBox("Titel");
queryBuilder.addMetaBox("Genre");
List<VerticalNode> verticalBoxes = _find(VerticalNode.class);
assertEquals(1, verticalBoxes.size());
List<MetaBox> metaBoxes = _find(MetaBox.class);
assertEquals(2, metaBoxes.size());
// Check that the added meta data values have been made invisible in the menu
List<MenuBar> menus = _find(queryBuilder, MenuBar.class);
assertEquals(4, menus.size());
assertEquals(1, menus.get(3).getItems().size());
assertEquals("Add", menus.get(3).getItems().get(0).getText());
for (MenuItem item : menus.get(3).getItems().get(0).getChildren()) {
if ("Titel".equals(item.getText()) || "Genre".equals(item.getText())) {
assertFalse(item.isVisible());
} else {
assertTrue(item.isVisible());
}
}
// Remove these boxes again using the "X" button
_click(_get(metaBoxes.get(0), Button.class, spec -> spec.withCaption("X")));
_click(_get(metaBoxes.get(1), Button.class, spec -> spec.withCaption("X")));
List<Button> closeButtons = _find(verticalBoxes.get(0), Button.class, spec -> spec.withCaption("X"));
// There are two buttons, one for the inner search box and one for the enclosing vertical box
assertEquals(2, closeButtons.size());
_click(closeButtons.get(1));
_click(closeButtons.get(0));
assertEquals(0, _find(VerticalNode.class).size());
assertEquals(0, _find(MetaBox.class).size());
}
Aggregations