#865 TIFF: Half decoding fix, now uses standard conversion.

This commit is contained in:
Harald Kuhr
2023-11-15 10:49:33 +01:00
parent 1d3a7fe812
commit 0378f504e7
2 changed files with 12 additions and 10 deletions
@@ -1,16 +1,16 @@
package com.twelvemonkeys.imageio.metadata.tiff;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.twelvemonkeys.io.FastByteArrayOutputStream;
import org.junit.Test;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Random;
import org.junit.Test;
import com.twelvemonkeys.io.FastByteArrayOutputStream;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* HalfTest.
@@ -36,6 +36,13 @@ public class HalfTest {
}
}
@Test
public void testExactEncoding() {
for (short half = -2048; half < 2048; half++) {
assertEquals(String.valueOf(half), half, Half.shortBitsToFloat(Half.floatToShortBits(half)), 0);
}
}
@Test
public void testRoundTripBack() {
for (int i = 0; i < 1024; i++) {