1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.imaging.roundtrip;
19
20 import java.awt.image.BufferedImage;
21 import java.util.stream.Stream;
22
23 import org.junit.jupiter.params.ParameterizedTest;
24 import org.junit.jupiter.params.provider.Arguments;
25 import org.junit.jupiter.params.provider.MethodSource;
26
27 public class LimitedColorRoundtripTest extends RoundtripBase {
28
29 public static BufferedImage[] images = new BufferedImage[] {
30 TestImages.createLimitedColorImage(1, 1),
31 TestImages.createLimitedColorImage(2, 2),
32 TestImages.createLimitedColorImage(10, 10),
33 TestImages.createLimitedColorImage(300, 300),
34 };
35
36 public static Stream<Arguments> testLimitedColorRoundtrip() {
37 return createRoundtripArguments(images);
38 }
39
40 @ParameterizedTest
41 @MethodSource
42 public void testLimitedColorRoundtrip(final BufferedImage testImage, final FormatInfo formatInfo) throws Exception {
43 boolean imageExact = true;
44 if (formatInfo.colorSupport == FormatInfo.COLOR_BITMAP) {
45 imageExact = false;
46 }
47 if (formatInfo.colorSupport == FormatInfo.COLOR_GRAYSCALE) {
48 imageExact = false;
49 }
50
51 roundtrip(formatInfo, testImage, "indexable", imageExact);
52 }
53
54 }