@Before public void setup() { image = makeImage(tileWidth, xTiles, yTiles); graphics = image.createGraphics(); imageBounds = image.getBounds(); // Set up a rectangle in the middle of the image to // be used by tests midRect = new Rectangle( imageBounds.x + imageBounds.width / 4, imageBounds.y + imageBounds.height / 4, imageBounds.width / 2, imageBounds.height / 2); }
@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)); } } } */ }