1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.imaging.formats.tiff.datareaders;
18
19 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
20
21 import org.apache.commons.imaging.formats.tiff.constants.TiffPlanarConfiguration;
22 import org.junit.jupiter.api.Test;
23
24 public class DataReaderStripsTest {
25 @Test
26 public void testApplyPredictor() {
27 final int[] bitsPerPixel = { 1, 2, 3 };
28 final DataReaderStrips strips = new DataReaderStrips(null, null, 3, bitsPerPixel, 2, 4, 0, 3, 1, 1, TiffPlanarConfiguration.CHUNKY, null, 2, null);
29 strips.resetPredictor();
30 final int[] samples = { 10, 355, 355, 255 };
31 int[] expected = { 10, 99, 99, 255 };
32 int[] predicted = strips.applyPredictor(samples);
33 assertArrayEquals(expected, predicted);
34 expected = new int[] { 20, 198, 198, 254 };
35 predicted = strips.applyPredictor(samples);
36 assertArrayEquals(expected, predicted);
37 }
38 }