Java Code Examples for org.testfx.util.WaitForAsyncUtils#waitForFxEvents()
The following examples show how to use
org.testfx.util.WaitForAsyncUtils#waitForFxEvents() .
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: TestCanvas.java From latexdraw with GNU General Public License v3.0 | 6 votes |
@Test public void testSelectionBorderUpdatedOnRedoModifyingCmd() { Cmds.of(addRec, selectAllShapes).execute(); final RotateShapes cmd = new RotateShapes(addedRec.getGravityCentre(), addedRec, Math.PI / 2d); cmd.doCmdBody(); cmd.done(); CommandsRegistry.getInstance().addCommand(cmd); WaitForAsyncUtils.waitForFxEvents(); final Bounds borderInitial = canvas.getSelectionBorder().getBoundsInLocal(); final Undo undo = new Undo(); undo.doIt(); undo.done(); CommandsRegistry.getInstance().addCommand(undo); WaitForAsyncUtils.waitForFxEvents(); final Bounds border = canvas.getSelectionBorder().getBoundsInLocal(); final Redo redo = new Redo(); redo.doIt(); redo.done(); CommandsRegistry.getInstance().addCommand(redo); WaitForAsyncUtils.waitForFxEvents(); final Bounds border2 = canvas.getSelectionBorder().getBoundsInLocal(); assertThat(border2).isNotEqualTo(border); assertThat(border2).isEqualTo(borderInitial); }
Example 2
Source File: TestCanvas.java From latexdraw with GNU General Public License v3.0 | 6 votes |
@Test public void testSelectionBorderUpdatedOnUndoModifyingCmd() { Cmds.of(addRec, selectAllShapes).execute(); final Bounds borderInitial = canvas.getSelectionBorder().getBoundsInLocal(); final RotateShapes cmd = new RotateShapes(addedRec.getGravityCentre(), addedRec, Math.PI / 2d); cmd.doIt(); cmd.done(); CommandsRegistry.getInstance().addCommand(cmd); WaitForAsyncUtils.waitForFxEvents(); final Bounds border = canvas.getSelectionBorder().getBoundsInLocal(); final Undo undo = new Undo(); undo.doIt(); undo.done(); CommandsRegistry.getInstance().addCommand(undo); WaitForAsyncUtils.waitForFxEvents(); final Bounds border2 = canvas.getSelectionBorder().getBoundsInLocal(); assertThat(border2).isNotEqualTo(border); assertThat(border2).isEqualTo(borderInitial); }
Example 3
Source File: SelectionTableTest.java From pdfsam with GNU Affero General Public License v3.0 | 6 votes |
@Test public void onSaveWorkspaceEncryptedNoPwdStored() { new DefaultUserContext().setBooleanPreference(BooleanUserPreference.SAVE_PWD_IN_WORKSPACE, false); WaitForAsyncUtils.waitForAsyncFx(2000, () -> { firstItem.moveStatusTo(PdfDescriptorLoadingStatus.REQUESTED); firstItem.moveStatusTo(PdfDescriptorLoadingStatus.LOADING); firstItem.moveStatusTo(PdfDescriptorLoadingStatus.ENCRYPTED); }); WaitForAsyncUtils.waitForFxEvents(); clickOn(".glyph-icon"); write("pwd").clickOn(DefaultI18nContext.getInstance().i18n("Unlock")); Map<String, String> data = new HashMap<>(); victim.saveStateTo(data); assertTrue(isBlank(data.get("victiminput.password.enc0"))); assertTrue(isBlank(data.get("victiminput.password.0"))); }
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: 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 6
Source File: TestViewCircleArc.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testThicknessChangeRadius() { final Arc arc = cloneArc(view.border); model.setThickness(model.getThickness() * 2d); WaitForAsyncUtils.waitForFxEvents(); assertNotEquals(arc.getRadiusX(), view.border.getRadiusX()); assertNotEquals(arc.getRadiusY(), view.border.getRadiusY()); }
Example 7
Source File: TestViewPlot.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testOnChangeDotDiametre() { model.setPlotStyle(PlotStyle.DOTS); WaitForAsyncUtils.waitForFxEvents(); final double before = ((Ellipse) ((ViewDot) view.getChildren().get(0)).getChildren().get(0)).getRadiusX(); model.setDiametre(model.getDiametre() * 1.577); WaitForAsyncUtils.waitForFxEvents(); assertNotEquals(before, ((Ellipse) ((ViewDot) view.getChildren().get(0)).getChildren().get(0)).getRadiusX()); }
Example 8
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 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: 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 11
Source File: TestViewAxes.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testChangelabelsDisplayedYProperty() { final int sizeBefore = view.getLabels().getChildren().size(); model.setLabelsDisplayed(PlottingStyle.Y); WaitForAsyncUtils.waitForFxEvents(); assertNotEquals(sizeBefore, view.getLabels().getChildren().size()); }
Example 12
Source File: TestViewBorderedShape.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testDoubleBorderStrokeWidth() { assumeTrue(model.isDbleBorderable()); model.setHasDbleBord(true); WaitForAsyncUtils.waitForFxEvents(); assertEquals(model.getDbleBordSep(), view.getDbleBorder().orElseThrow().getStrokeWidth(), 0.001); }
Example 13
Source File: TestViewAxes.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testChangeaxesStyleAxesProperty() { model.setAxesStyle(AxesStyle.NONE); WaitForAsyncUtils.waitForFxEvents(); mainAxesBefore = new ArrayList<>(view.framePath.getElements()); model.setAxesStyle(AxesStyle.FRAME); WaitForAsyncUtils.waitForFxEvents(); assertNotEquals(mainAxesBefore, view.framePath.getElements()); }
Example 14
Source File: TestViewGrid.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testChangeSubGridWidth() { final double strokeBefore = view.getSubgrid().getStrokeWidth(); model.setSubGridWidth(11d); WaitForAsyncUtils.waitForFxEvents(); assertNotEquals(strokeBefore, view.getSubgrid().getStrokeWidth()); }
Example 15
Source File: TestBadaboomController.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test public void testTableClickErrorShowsIt() { Platform.runLater(() -> BadaboomCollector.INSTANCE.add(new IllegalArgumentException("test exception"))); WaitForAsyncUtils.waitForFxEvents(); Platform.runLater(() -> { final TableView<?> table = find("#table"); table.getSelectionModel().select(0); }); WaitForAsyncUtils.waitForFxEvents(); final TextArea stack = find("#stack"); assertFalse(stack.getText().isEmpty()); }
Example 16
Source File: TestViewAxes.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test @Override void testChangeGridEndY() { model.setGridEndY(model.getGridEndY() + 1d); WaitForAsyncUtils.waitForFxEvents(); assertEquals(ptH1, view.axesHoriz.getModel().getPtAt(0)); assertEquals(ptH2, view.axesHoriz.getModel().getPtAt(1)); assertEquals(ptV1, view.axesVert.getModel().getPtAt(0)); assertNotEquals(ptV2, view.axesVert.getModel().getPtAt(1)); assertNotEquals(pathTicksBefore, view.pathTicks.getElements()); }
Example 17
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 18
Source File: TestViewBezierCurve.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testShowPtsCtrlLineSizeDbleLine() { model.setShowPts(true); model.setHasDbleBord(true); model.setDbleBordSep(12d); model.setThickness(5d); WaitForAsyncUtils.waitForFxEvents(); assertThat(view.showPoint.getChildren()) .filteredOn(n -> n instanceof Line) .allMatch(elt -> MathUtils.INST.equalsDouble(((Shape) elt).getStrokeWidth(), 11d)); }
Example 19
Source File: TestViewCircleArc.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@ParameterizedTest @MethodSource("styleFunction") void testTypeArc(final ArcStyle style, final Function<ViewCircleArc, Arc> fct) { model.setArcStyle(style); WaitForAsyncUtils.waitForFxEvents(); assertEquals(style.getJFXStyle(), fct.apply(view).getType()); }
Example 20
Source File: TestViewBorderedShape.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test void testLineStyleDottedSepAfter() { assumeTrue(model.isLineStylable()); model.setLineStyle(LineStyle.DOTTED); model.setDotSep(23.23); WaitForAsyncUtils.waitForFxEvents(); assertEquals(Arrays.asList(0d, 23.23 + model.getFullThickness()), border.getStrokeDashArray()); }