This commit is contained in:
Rune Bremnes
2014-03-04 14:37:02 +01:00
3 changed files with 61 additions and 30 deletions
@@ -513,9 +513,7 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
// Validate strip colors
for (int i = 0; i < strip.getWidth() / 128; i++) {
int actualRGB = strip.getRGB(i * 128, 4);
assertEquals((actualRGB >> 16) & 0xff, (expectedRGB[i] >> 16) & 0xff, 5);
assertEquals((actualRGB >> 8) & 0xff, (expectedRGB[i] >> 8) & 0xff, 5);
assertEquals((actualRGB) & 0xff, (expectedRGB[i]) & 0xff, 5);
assertRGBEquals(expectedRGB[i], actualRGB);
}
}
@@ -543,9 +541,7 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
// Validate strip colors
for (int i = 0; i < thumbnail.getWidth() / 8; i++) {
int actualRGB = thumbnail.getRGB(i * 8, 4);
assertEquals((actualRGB >> 16) & 0xff, (expectedRGB[i] >> 16) & 0xff, 5);
assertEquals((actualRGB >> 8) & 0xff, (expectedRGB[i] >> 8) & 0xff, 5);
assertEquals((actualRGB) & 0xff, (expectedRGB[i]) & 0xff, 5);
assertRGBEquals(expectedRGB[i], actualRGB);
}
}
@@ -680,12 +676,19 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
// Validate strip colors
for (int i = 0; i < image.getWidth() / 10; i++) {
int actualRGB = image.getRGB(i * 10, 7);
assertEquals((actualRGB >> 16) & 0xff, (expectedRGB[i] >> 16) & 0xff, 5);
assertEquals((actualRGB >> 8) & 0xff, (expectedRGB[i] >> 8) & 0xff, 5);
assertEquals((actualRGB ) & 0xff, (expectedRGB[i] ) & 0xff, 5);
assertRGBEquals(expectedRGB[i], actualRGB);
}
}
/**
* Slightly fuzzy RGB equals method. Tolerance +/-5 steps.
*/
private void assertRGBEquals(int expectedRGB, int actualRGB) {
assertEquals((expectedRGB >> 16) & 0xff, (actualRGB >> 16) & 0xff, 5);
assertEquals((expectedRGB >> 8) & 0xff, (actualRGB >> 8) & 0xff, 5);
assertEquals((expectedRGB ) & 0xff, (actualRGB ) & 0xff, 5);
}
// Regression: Test subsampling offset within of bounds
// NOTE: These tests assumes the reader will read at least 1024 scanlines (if available) each iteration,
// this might change in the future. If so, the tests will no longer test what tey are supposed to....
@@ -716,8 +719,8 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
assertNotNull(image);
// Make sure correct color is actually read, not just left empty
assertEquals(0xfefefd, image.getRGB(0, image.getHeight() - 2) & 0xffffff);
assertEquals(0xfefefd, image.getRGB(0, image.getHeight() - 1) & 0xffffff);
assertRGBEquals(0xfefefd, image.getRGB(0, image.getHeight() - 2));
assertRGBEquals(0xfefefd, image.getRGB(0, image.getHeight() - 1));
}
@Ignore
@@ -734,8 +737,8 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
assertNotNull(image);
// Make sure correct color is actually read, not just left empty
assertEquals(0xfefefd, image.getRGB(0, image.getHeight() - 2) & 0xffffff);
assertEquals(0xfefefd, image.getRGB(0, image.getHeight() - 1) & 0xffffff);
assertRGBEquals(0xfefefd, image.getRGB(0, image.getHeight() - 2));
assertRGBEquals(0xfefefd, image.getRGB(0, image.getHeight() - 1));
}
@Ignore
@@ -752,8 +755,8 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
assertNotNull(image);
// Make sure correct color is actually read, not just left empty
assertEquals(0xfefefd, image.getRGB(0, image.getHeight() - 2) & 0xffffff);
assertEquals(0xfefefd, image.getRGB(0, image.getHeight() - 1) & 0xffffff);
assertRGBEquals(0xfefefd, image.getRGB(0, image.getHeight() - 2));
assertRGBEquals(0xfefefd, image.getRGB(0, image.getHeight() - 1));
}
@Test
@@ -783,8 +786,8 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
assertNotNull(image);
// Make sure correct color is actually read, not just left empty
assertEquals(0xfefefd, image.getRGB(0, image.getHeight() - 2) & 0xffffff);
assertEquals(0xfefefd, image.getRGB(0, image.getHeight() - 1) & 0xffffff);
assertRGBEquals(0xfefefd, image.getRGB(0, image.getHeight() - 2));
assertRGBEquals(0xfefefd, image.getRGB(0, image.getHeight() - 1));
}
@Ignore
@@ -801,8 +804,8 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
assertNotNull(image);
// Make sure correct color is actually read, not just left empty
assertEquals(0xfefefd, image.getRGB(0, image.getHeight() - 2) & 0xffffff);
assertEquals(0xfefefd, image.getRGB(0, image.getHeight() - 1) & 0xffffff);
assertRGBEquals(0xfefefd, image.getRGB(0, image.getHeight() - 2));
assertRGBEquals(0xfefefd, image.getRGB(0, image.getHeight() - 1));
}
@Test