FixationSequence { public void saveToFile(final File outputFile) { final BufferedImage bImage = SwingFXUtils.fromFXImage(image, null); try { ImageIO.write(bImage, "png", outputFile); } catch (final IOException e) { throw new RuntimeException(e); } } FixationSequence(final int width, final int height, ArrayList<LinkedList<FixationPoint>> fixationPoints, int sequenceIndex); void saveToFile(final File outputFile); static LinkedList<FixationPoint> vertexReduction(final LinkedList<FixationPoint> allPoints, final double tolerance); static final int MOUSE_FIXATION_SEQUENCE; static final int GAZE_FIXATION_SEQUENCE; }
@Test void shouldSaveImageToFile() throws InterruptedException { Platform.runLater(() -> { File testFile = new File("image.png"); FixationSequence sequence = new FixationSequence(1920, 1080, fixationPoints, FixationSequence.MOUSE_FIXATION_SEQUENCE); sequence.saveToFile(testFile); assertTrue(testFile.isFile()); testFile.delete(); }); TestingUtils.waitForRunLater(); Platform.runLater(() -> { File testFile = new File("image.png"); FixationSequence sequence = new FixationSequence(1920, 1080, fixationPoints, FixationSequence.GAZE_FIXATION_SEQUENCE); sequence.saveToFile(testFile); assertTrue(testFile.isFile()); testFile.delete(); }); TestingUtils.waitForRunLater(); }