use of org.corpus_tools.annis.gui.visualizers.component.grid.GridComponent in project ANNIS by korpling.
the class AnnisUITest method tokenSearchDialog.
@Test
void tokenSearchDialog() throws Exception {
executeTokenSearch("dialog.demo", 102, 1);
// Test that there is a grid visualizer
SingleResultPanel resultPanel = _find(SingleResultPanel.class).get(0);
GridComponent gridVis = _get(resultPanel, GridComponent.class, spec -> spec.withPredicate(g -> !(g instanceof KWICComponent)));
AnnotationGrid annoGrid = _get(gridVis, AnnotationGrid.class);
ArrayList<Row> tokens = annoGrid.getRowsByAnnotation().get("default_ns::norm0");
assertEquals(1, tokens.size());
assertEquals(Arrays.asList("äh", "fang", "einfach", "mal", "an"), tokens.get(0).getEvents().stream().map(GridEvent::getValue).collect(Collectors.toList()));
// Open the video visualizer and check that media component is loaded
Button btOpenVisualizer = _get(resultPanel, Button.class, spec -> spec.withCaption("video"));
_click(btOpenVisualizer);
awaitCondition(120, () -> !_find(resultPanel, MediaElementPlayer.class).isEmpty());
MediaElementPlayer player = _get(resultPanel, MediaElementPlayer.class, spec -> spec.withCount(1));
assertEquals("video/webm", player.getState().getMimeType());
assertEquals("/Binary?file=dialog.demo%2Fdialog.demo%2Fdialog.demo.webm&toplevelCorpusName=dialog.demo", player.getState().getResourceURL());
// Close the visualizer again
_click(btOpenVisualizer);
awaitCondition(120, () -> _find(resultPanel, MediaElementPlayer.class).isEmpty());
}
Aggregations