org.testfx.util.WaitForAsyncUtils Java Examples
The following examples show how to use
org.testfx.util.WaitForAsyncUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestLaTeXDraw.java From latexdraw with GNU General Public License v3.0 | 6 votes |
@Test public void testMoveViewPort(final FxRobot robot) { Platform.runLater(() -> { try { app.getMainStage().showAndWait(); }catch(final IllegalStateException ignored) { // Already visible } }); WaitForAsyncUtils.waitForFxEvents(); final ScrollPane pane = robot.lookup("#scrollPane").query(); final double hvalue = pane.getHvalue(); final double vvalue = pane.getVvalue(); robot.drag("#canvas", MouseButton.MIDDLE).dropBy(100d, 200d); WaitForAsyncUtils.waitForFxEvents(); assertThat(hvalue).isGreaterThan(pane.getHvalue()); assertThat(vvalue).isGreaterThan(pane.getVvalue()); }
Example #2
Source File: TestViewPlot.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testOnChangeNbPlotPoints() { final List<PathElement> before = duplicatePath(getCurvePath()); model.setNbPlottedPoints(model.getNbPlottedPoints() + 41); WaitForAsyncUtils.waitForFxEvents(); assertNotEquals(before, getCurvePath()); }
Example #3
Source File: TestViewBorderedShape.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testFillGradient() { assumeTrue(model.isFillable()); model.setFillingStyle(FillingStyle.GRAD); WaitForAsyncUtils.waitForFxEvents(); assertTrue(border.getFill() instanceof LinearGradient); }
Example #4
Source File: TestTabSelector.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test public void testClickPSTActivations() { clickOn(tabPane.lookup("#tabPST")); WaitForAsyncUtils.waitForFxEvents(); Mockito.verify(selector, Mockito.times(1)).setActivated(false, false); Mockito.verify(paster, Mockito.times(1)).setActivated(false, false); Mockito.verify(undo, Mockito.times(1)).setActivated(false, false); Mockito.verify(zoomer, Mockito.times(1)).setActivated(false, false); Mockito.verify(deleter, Mockito.times(1)).setActivated(false, false); Mockito.verify(zoomer, Mockito.times(1)).setActivated(false, false); }
Example #5
Source File: TestViewText.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testTextProducesImageWhenNotDefaultColour() throws InterruptedException, TimeoutException, ExecutionException { model.setLineColour(ShapeFactory.INST.createColorFX(Color.AQUAMARINE)); WaitForAsyncUtils.waitForFxEvents(); model.setText("hello"); view.getCurrentCompilation().get(5, TimeUnit.SECONDS); WaitForAsyncUtils.waitForFxEvents(); assertTrue(BadaboomCollector.INSTANCE.errorsProperty().isEmpty(), () -> HelperTest.getBadaboomMessages()); assertFalse(getImage().isDisable()); assertTrue(getImage().isVisible()); }
Example #6
Source File: TestViewText.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testCompilationDataDuringCompilation() throws InterruptedException, TimeoutException, ExecutionException { model.setText("$hello$"); view.getCurrentCompilation().get(5, TimeUnit.SECONDS); WaitForAsyncUtils.waitForFxEvents(); assertTrue(BadaboomCollector.INSTANCE.errorsProperty().isEmpty(), () -> HelperTest.getBadaboomMessages()); assertTrue(view.getCompilationData().isPresent()); }
Example #7
Source File: TestViewGrid.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testChangeGridWidthImpactOnLabels() { final List<Double> xBefore = view.getLabels().getChildren().stream().map(c -> ((Text) c).getX()).collect(Collectors.toList()); final List<Double> yBefore = view.getLabels().getChildren().stream().map(c -> ((Text) c).getY()).collect(Collectors.toList()); model.setGridWidth(43d); WaitForAsyncUtils.waitForFxEvents(); assertNotEquals(xBefore, view.getLabels().getChildren().stream().map(c -> ((Text) c).getX()).collect(Collectors.toList())); assertNotEquals(yBefore, view.getLabels().getChildren().stream().map(c -> ((Text) c).getY()).collect(Collectors.toList())); }
Example #8
Source File: SelectionTableWithoutDuplicateTest.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
private PdfDocumentDescriptor populate() throws Exception { File file = folder.newFile("temp.pdf"); PdfLoadRequestEvent loadEvent = new PdfLoadRequestEvent(MODULE); PdfDocumentDescriptor ret = PdfDocumentDescriptor.newDescriptorNoPassword(file); loadEvent.add(ret); WaitForAsyncUtils.waitForAsyncFx(2000, () -> eventStudio().broadcast(loadEvent, MODULE)); return ret; }
Example #9
Source File: TestViewAxes.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override @Test void testChangeGridEndX() { model.setGridEndX(model.getGridEndX() + 1d); WaitForAsyncUtils.waitForFxEvents(); assertEquals(ptH1, view.axesHoriz.getModel().getPtAt(0)); assertNotEquals(ptH2, view.axesHoriz.getModel().getPtAt(1)); assertEquals(ptV1, view.axesVert.getModel().getPtAt(0)); assertEquals(ptV2, view.axesVert.getModel().getPtAt(1)); assertNotEquals(pathTicksBefore, view.pathTicks.getElements()); }
Example #10
Source File: SelectionTableTest.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
@Test public void logEventOnclickOn() { WaitForAsyncUtils.waitForAsyncFx(2000, () -> firstItem.moveStatusTo(PdfDescriptorLoadingStatus.REQUESTED)); WaitForAsyncUtils.waitForFxEvents(); Text icon = lookup(".glyph-icon").queryAs(Text.class); assertEquals(PdfDescriptorLoadingStatus.REQUESTED.getIcon().unicode(), icon.getText()); WaitForAsyncUtils.waitForAsyncFx(2000, () -> firstItem.moveStatusTo(PdfDescriptorLoadingStatus.LOADING)); WaitForAsyncUtils.waitForFxEvents(); icon = lookup(".glyph-icon").queryAs(Text.class); assertEquals(PdfDescriptorLoadingStatus.LOADING.getIcon().unicode(), icon.getText()); }
Example #11
Source File: TestViewCircleArc.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@ParameterizedTest @EnumSource(ArcStyle.class) void testClipArrowSameType(final ArcStyle style) { assumeTrue(style.supportArrow()); model.setArcStyle(style); model.setArrowStyle(ArrowStyle.RIGHT_ARROW, 0); WaitForAsyncUtils.waitForFxEvents(); assertEquals(((Arc) view.border.getClip()).getType(), style.getJFXStyle()); }
Example #12
Source File: TestViewGrid.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testChangeGridWidthImpactOnStrokeWidth() { final double strokeBefore = view.getMaingrid().getStrokeWidth(); model.setGridWidth(21d); WaitForAsyncUtils.waitForFxEvents(); assertNotEquals(strokeBefore, view.getMaingrid().getStrokeWidth()); }
Example #13
Source File: TestViewBorderedShape.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testDashSepBlack() { assumeTrue(model.isLineStylable()); model.setLineStyle(LineStyle.DASHED); model.setDashSepBlack(21d); WaitForAsyncUtils.waitForFxEvents(); assertEquals(Arrays.asList(21d, model.getDashSepWhite()), border.getStrokeDashArray()); }
Example #14
Source File: TestViewAxes.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testChangeticksStyleFullProperty() { model.setTicksStyle(TicksStyle.TOP); WaitForAsyncUtils.waitForFxEvents(); pathTicksBefore = new ArrayList<>(view.pathTicks.getElements()); model.setTicksStyle(TicksStyle.FULL); WaitForAsyncUtils.waitForFxEvents(); assertNotEquals(pathTicksBefore, view.pathTicks.getElements()); }
Example #15
Source File: TestViewBezierCurve.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testShowPtsCtrl2DotsOkPosition() { model.setShowPts(true); WaitForAsyncUtils.waitForFxEvents(); final List<Point> centers = view.showPoint.getChildren().stream().filter(n -> n instanceof Ellipse). map(ell -> ShapeFactory.INST.createPoint(((Ellipse) ell).getCenterX(), ((Ellipse) ell).getCenterY())).collect(Collectors.toList()); assertThat(model.getSecondCtrlPts()) .allMatch(pt -> centers.contains(pt)); }
Example #16
Source File: TestViewCircleArc.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@ParameterizedTest @EnumSource(ArcStyle.class) void testClipArrowExists(final ArcStyle style) { assumeTrue(style.supportArrow()); model.setArcStyle(style); model.setArrowStyle(ArrowStyle.RIGHT_ARROW, 0); WaitForAsyncUtils.waitForFxEvents(); assertTrue(view.border.getClip() instanceof Arc); }
Example #17
Source File: TestViewCircleArc.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@ParameterizedTest @EnumSource(ArcStyle.class) void testClipArrowSameStrokeWidth(final ArcStyle style) { assumeTrue(style.supportArrow()); model.setArcStyle(style); model.setThickness(model.getThickness() * 2d); model.setArrowStyle(ArrowStyle.RIGHT_ARROW, 0); WaitForAsyncUtils.waitForFxEvents(); assertEquals(((Arc) view.border.getClip()).getStrokeWidth(), view.border.getStrokeWidth(), 0.0001); }
Example #18
Source File: TestViewAxes.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test @Override void testChangeGridStartY() { model.setGridStartY(model.getGridStartY() - 1d); WaitForAsyncUtils.waitForFxEvents(); assertEquals(ptH1, view.axesHoriz.getModel().getPtAt(0)); assertEquals(ptH2, view.axesHoriz.getModel().getPtAt(1)); assertNotEquals(ptV1, view.axesVert.getModel().getPtAt(0)); assertEquals(ptV2, view.axesVert.getModel().getPtAt(1)); assertNotEquals(pathTicksBefore, view.pathTicks.getElements()); }
Example #19
Source File: TestCanvasTranslation.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override @Before public void setUp() throws Exception { super.setUp(); hand.setActivated(true); when(pencil.isActivated()).thenReturn(false); WaitForAsyncUtils.waitForFxEvents(); }
Example #20
Source File: TestViewBorderedShape.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testLineStyleDottedSepDoubleLineAfterLineStyle() { assumeTrue(model.isLineStylable()); model.setLineStyle(LineStyle.DOTTED); if(model.isDbleBorderable()) { model.setHasDbleBord(true); } WaitForAsyncUtils.waitForFxEvents(); assertEquals(Arrays.asList(0d, model.getDotSep() + model.getFullThickness()), border.getStrokeDashArray()); }
Example #21
Source File: TestViewBorderedShape.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testLineStyleDottedSepDoubleLineDoubleSep() { assumeTrue(model.isLineStylable()); model.setLineStyle(LineStyle.DOTTED); if(model.isDbleBorderable()) { model.setHasDbleBord(true); model.setDbleBordSep(33d); } WaitForAsyncUtils.waitForFxEvents(); assertEquals(Arrays.asList(0d, model.getDotSep() + model.getFullThickness()), border.getStrokeDashArray()); }
Example #22
Source File: TestViewBorderedShape.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testLineStyleDottedSepSimpleLine() { assumeTrue(model.isLineStylable()); model.setLineStyle(LineStyle.DOTTED); WaitForAsyncUtils.waitForFxEvents(); assertEquals(Arrays.asList(0d, model.getDotSep() + model.getFullThickness()), border.getStrokeDashArray()); }
Example #23
Source File: TestViewBorderedShape.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testDashSepWhite() { assumeTrue(model.isLineStylable()); model.setLineStyle(LineStyle.DASHED); model.setDashSepWhite(2.451); WaitForAsyncUtils.waitForFxEvents(); assertEquals(Arrays.asList(model.getDashSepBlack(), 2.451), border.getStrokeDashArray()); }
Example #24
Source File: TestCanvasCreation.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override @Before public void setUp() throws Exception { super.setUp(); setter = injector.getInstance(TextSetter.class); when(hand.isActivated()).thenReturn(false); when(setter.isActivated()).thenReturn(false); textAutoSize = new TextAreaAutoSize(); when(setter.getTextField()).thenReturn(textAutoSize); pencil.setActivated(true); drawing = canvas.getDrawing(); injector.getInstance(PreferencesService.class).magneticGridProperty().set(false); WaitForAsyncUtils.waitForFxEvents(100); canvas.toFront(); }
Example #25
Source File: TestViewBezierCurve.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testShowPtsCtrlEllNoStroke() { model.setShowPts(true); WaitForAsyncUtils.waitForFxEvents(); assertThat(view.showPoint.getChildren()) .filteredOn(n -> n instanceof Ellipse) .extracting(n -> ((Shape) n).getStroke()) .containsOnlyNulls(); }
Example #26
Source File: OpenButtonTest.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
@Test public void fileOrDirDestination() { DirectoryTaskOutput output = mock(DirectoryTaskOutput.class); WaitForAsyncUtils.waitForAsyncFx(2000, () -> victim.dispatch(output)); verify(output).getDestination(); Text icon = lookup(".glyph-icon").queryAs(Text.class); assertEquals(MaterialDesignIcon.FOLDER_OUTLINE.unicode(), icon.getText()); }
Example #27
Source File: OpenButtonTest.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
@Test public void directoryDestination() { DirectoryTaskOutput output = mock(DirectoryTaskOutput.class); WaitForAsyncUtils.waitForAsyncFx(2000, () -> victim.dispatch(output)); verify(output).getDestination(); Text icon = lookup(".glyph-icon").queryAs(Text.class); assertEquals(MaterialDesignIcon.FOLDER_OUTLINE.unicode(), icon.getText()); }
Example #28
Source File: TestViewGrid.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override @Test void testChangeOriginX() { final List<Double> yBefore = view.getLabels().getChildren().stream().map(c -> ((Text) c).getY()).collect(Collectors.toList()); final List<Double> xBefore = view.getLabels().getChildren().stream().map(c -> ((Text) c).getX()).collect(Collectors.toList()); model.setOriginX(model.getOriginX() + 1d); WaitForAsyncUtils.waitForFxEvents(); assertNotEquals(xBefore, view.getLabels().getChildren().stream().map(c -> ((Text) c).getX()).collect(Collectors.toList())); assertEquals(yBefore, view.getLabels().getChildren().stream().map(c -> ((Text) c).getY()).collect(Collectors.toList())); }
Example #29
Source File: TestViewCircleArc.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testTicknessChangeHasDblBord() { final Arc arc = cloneArc(view.border); model.setHasDbleBord(true); WaitForAsyncUtils.waitForFxEvents(); assertNotEquals(arc.getRadiusX(), view.border.getRadiusX()); assertNotEquals(arc.getRadiusY(), view.border.getRadiusY()); }
Example #30
Source File: TestViewAxes.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override @Test void testChangeOriginX() { final List<String> textBefore = view.getLabels().getChildren().stream().map(c -> ((Text) c).getText()).collect(Collectors.toList()); model.setOriginX(model.getOriginX() + 1d); WaitForAsyncUtils.waitForFxEvents(); assertNotEquals(textBefore, view.getLabels().getChildren().stream().map(c -> ((Text) c).getText()).collect(Collectors.toList())); }