@Test public void testGetTypeSpecifiers() throws IOException { final ImageReader reader = createReader(); for (TestData data : getTestData()) { reader.setInput(data.getInputStream()); ImageTypeSpecifier rawType = reader.getRawImageType(0); if (rawType == null && allowsNullRawImageType()) { continue; } assertNotNull(rawType); Iterator<ImageTypeSpecifier> types = reader.getImageTypes(0); assertNotNull(types); assertTrue(types.hasNext()); // TODO: This might fail even though the specifiers are obviously equal, if the // color spaces they use are not the SAME instance, as ColorSpace uses identity equals // and Interleaved ImageTypeSpecifiers are only equal if color spaces are equal... boolean rawFound = false; while (types.hasNext()) { ImageTypeSpecifier type = types.next(); if (type.equals(rawType)) { rawFound = true; break; } } assertTrue("ImageTypeSepcifier from getRawImageType should be in the iterator from getImageTypes", rawFound); } reader.dispose(); }
@Test public void testGetTypeSpecifiers() throws IOException { final ImageReader reader = createReader(); for (TestData data : getTestData()) { reader.setInput(data.getInputStream()); ImageTypeSpecifier rawType = reader.getRawImageType(0); if (rawType == null && allowsNullRawImageType()) { continue; } assertNotNull(rawType); Iterator<ImageTypeSpecifier> types = reader.getImageTypes(0); assertNotNull(types); assertTrue(types.hasNext()); // TODO: This might fail even though the specifiers are obviously equal, if the // color spaces they use are not the SAME instance, as ColorSpace uses identity equals // and Interleaved ImageTypeSpecifiers are only equal if color spaces are equal... boolean rawFound = false; while (types.hasNext()) { ImageTypeSpecifier type = types.next(); if (type.equals(rawType)) { rawFound = true; break; } } assertTrue("ImageTypeSepcifier from getRawImageType should be in the iterator from getImageTypes", rawFound); } }