/** * Tile-aware override. * * @throws Exception */ @Test @Override public void testGetImageInfo() throws Exception { ImageInfo expectedInfo = new ImageInfo(64, 56, Format.TIF); expectedInfo.getImages().get(0).tileWidth = 16; expectedInfo.getImages().get(0).tileHeight = 16; final File fixture = TestUtil.getImage("tif-rgb-monores-64x56x8-tiled-uncompressed.tif"); // test as a StreamProcessor StreamProcessor sproc = (StreamProcessor) newInstance(); StreamSource streamSource = new TestStreamSource(fixture); sproc.setStreamSource(streamSource); sproc.setSourceFormat(Format.TIF); assertEquals(expectedInfo, sproc.getImageInfo()); // test as a FileProcessor FileProcessor fproc = (FileProcessor) newInstance(); fproc.setSourceFile(fixture); fproc.setSourceFormat(Format.TIF); assertEquals(expectedInfo, fproc.getImageInfo()); try { fproc.setSourceFile(TestUtil.getImage("mpg")); fproc.setSourceFormat(Format.MPG); expectedInfo = new ImageInfo(640, 360, Format.MPG); assertEquals(expectedInfo, fproc.getImageInfo()); } catch (UnsupportedSourceFormatException e) { // pass } }
@Test public void testGetImageInfoWithOrientation() throws Exception { Configuration.getInstance().setProperty(RESPECT_ORIENTATION_CONFIG_KEY, true); final File fixture = TestUtil.getImage("jpg-rotated.jpg"); final FileProcessor fproc = (FileProcessor) newInstance(); fproc.setSourceFile(fixture); fproc.setSourceFormat(Format.JPG); final ImageInfo info = fproc.getImageInfo(); assertEquals(Orientation.ROTATE_90, info.getOrientation()); }