private void showImage(String title) throws Exception { if (!HEADLESS && SHOW_IMAGE) { CountDownLatch latch = new CountDownLatch(1); WaitingImageFrame.showImage(image, title, latch); latch.await(); } }
@Ignore("original test - refactor if we keep it and allow for platform differences") @Test public void test() throws Exception { DiskMemImage dmi = makeImage(tileWidth, xTiles, yTiles); BufferedImage bi = new BufferedImage(tileWidth, tileHeight, BufferedImage.TYPE_INT_ARGB); draw(dmi.createGraphics()); draw(bi.createGraphics()); if (!HEADLESS && SAVE_IMAGE) { String dmiPath = File.createTempFile("diskmem", "tif").getPath(); JAI.create("filestore", dmi, dmiPath, "TIFF", null); String bmPath = File.createTempFile("buffered", "tif").getPath(); JAI.create("filestore", bi, bmPath, "TIFF", null); System.out.println("Saved test image files to:"); System.out.println(dmiPath); System.out.println(bmPath); } if (!HEADLESS && SHOW_IMAGE) { CountDownLatch latch = new CountDownLatch(1); WaitingImageFrame.showImage(dmi, "Close window to continue test", latch); latch.await(); } /* // Test for matching pixels between image tiles and reference tile Raster refTile = bi.getData(); Raster tile = dmi.getTile(0, 0); assertEquals(tile.getWidth(), refTile.getWidth()); assertEquals(tile.getHeight(), refTile.getHeight()); assertEquals(tile.getNumBands(), refTile.getNumBands()); for (int y = 0; y < tileHeight; y++) { for (int x = 0; x < tileWidth; x++) { for (int band = 0; band < dmi.getNumBands(); band++) { assertEquals(refTile.getSample(x, y, band), tile.getSample(x + tile.getMinX(), y + tile.getMinY(), band)); } } } */ }