@Test public void convert() throws Exception { File xwdFile = tmp.newFile("example.xwd"); ByteSources.gunzipping(getClass().getResource("/example.xwd.gz")).copyTo(Files.asByteSink(xwdFile)); XwdFileToPngConverter converter = new XwdFileToPngConverter(processTrackerRule.getTracker(), tmp.getRoot().toPath()); ImageioReadableScreenshot pngShot = converter.convert(XwdFileScreenshot.from(xwdFile)); ImageInfo info = ImageInfos.read(pngShot.asByteSource()); assertEquals("format", ImageInfo.Format.PNG, info.getFormat()); }
@Override public ImageioReadableScreenshot convert(Screenshot source) throws IOException, XvfbException { File pnmFile = File.createTempFile("xwdtopnm-stdout", ".ppm", tempDir.toFile()); try { return convert(source, pnmFile); } finally { if (!pnmFile.delete()) { log.info("failed to delete {}", pnmFile); } } }
XwdFileToPngConverter implements ScreenshotConverter<Screenshot, ImageioReadableScreenshot> { @Override public ImageioReadableScreenshot convert(Screenshot source) throws IOException, XvfbException { File pnmFile = File.createTempFile("xwdtopnm-stdout", ".ppm", tempDir.toFile()); try { return convert(source, pnmFile); } finally { if (!pnmFile.delete()) { log.info("failed to delete {}", pnmFile); } } } }
XwdFileToPngConverter implements ScreenshotConverter<Screenshot, ImageioReadableScreenshot> { @Override public ImageioReadableScreenshot convert(Screenshot source) throws IOException, XvfbException { File pnmFile = File.createTempFile("xwdtopnm-stdout", ".ppm", tempDir.toFile()); try { return convert(source, pnmFile); } finally { if (!pnmFile.delete()) { log.info("failed to delete {}", pnmFile); } } } XwdFileToPngConverter(ProcessTracker processTracker, Path tempDir); }
XwdFileToPngConverter implements ScreenshotConverter<Screenshot, ImageioReadableScreenshot> { @Override public ImageioReadableScreenshot convert(Screenshot source) throws IOException, XvfbException { File pnmFile = File.createTempFile("xwdtopnm-stdout", ".ppm", tempDir.toFile()); try { return convert(source, pnmFile); } finally { if (!pnmFile.delete()) { log.info("failed to delete {}", pnmFile); } } } XwdFileToPngConverter(ProcessTracker processTracker, Path tempDir); @Override ImageioReadableScreenshot convert(Screenshot source); ImageioReadableScreenshot convert(Screenshot source, File pnmFile, File stderrFile); static Iterable<String> getRequiredPrograms(); }
XwdFileToPngConverter implements ScreenshotConverter<Screenshot, ImageioReadableScreenshot> { @Override public ImageioReadableScreenshot convert(Screenshot source) throws IOException, XvfbException { File pnmFile = File.createTempFile("xwdtopnm-stdout", ".ppm", tempDir.toFile()); try { return convert(source, pnmFile); } finally { if (!pnmFile.delete()) { log.info("failed to delete {}", pnmFile); } } } XwdFileToPngConverter(ProcessTracker processTracker, Path tempDir); @Override ImageioReadableScreenshot convert(Screenshot source); ImageioReadableScreenshot convert(Screenshot source, File pnmFile, File stderrFile); static Iterable<String> getRequiredPrograms();  }