Repository: commons-imaging
Updated Branches:
  refs/heads/master a009a9a92 -> 40ab2ccf4


add test for DataReaderStripsTest::applyPredictor


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/611c3bb5
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/611c3bb5
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/611c3bb5

Branch: refs/heads/master
Commit: 611c3bb5af022eb9e2f485dbc3368065d369de54
Parents: a009a9a
Author: testingsavvy <testingsa...@gmail.com>
Authored: Sat Oct 14 21:59:52 2017 -0500
Committer: Bruno P. Kinoshita <brunodepau...@yahoo.com.br>
Committed: Sun Dec 24 00:01:36 2017 +1300

----------------------------------------------------------------------
 .../tiff/datareaders/DataReaderStripsTest.java  | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/611c3bb5/src/test/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStripsTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStripsTest.java
 
b/src/test/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStripsTest.java
new file mode 100644
index 0000000..42de961
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStripsTest.java
@@ -0,0 +1,21 @@
+package org.apache.commons.imaging.formats.tiff.datareaders;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertArrayEquals;
+
+public class DataReaderStripsTest {
+    @Test
+    public void testApplyPredictor() throws Exception {
+        int[] bitsPerPixel = {1,2,3};
+        DataReaderStrips strips = new DataReaderStrips(null, null, 3, 
bitsPerPixel , 2, 4, 3, 1, 1, null, 2, null);
+        strips.resetPredictor();
+        int[] samples = {10, 355, 355, 255};
+        int[] expected = {10, 99, 99, 255};
+        int[] predicted = strips.applyPredictor(samples);
+        assertArrayEquals(expected, predicted);
+        expected = new int[]{20, 198, 198, 254};
+        predicted = strips.applyPredictor(samples);
+        assertArrayEquals(expected, predicted);
+    }
+}
\ No newline at end of file

Reply via email to