Add missing tests.

This commit is contained in:
Harald Kuhr 2020-09-24 15:07:40 +02:00
parent fc72cd34a1
commit 5040e9fe8a
3 changed files with 100 additions and 0 deletions

View File

@ -0,0 +1,31 @@
package com.twelvemonkeys.imageio.plugins.hdr.tonemap;
import org.junit.Test;
import static org.junit.Assert.assertArrayEquals;
public class DefaultToneMapperTest {
private final DefaultToneMapper mapper = new DefaultToneMapper();
@Test
public void testMap0() {
float[] rgb = {0};
mapper.map(rgb);
assertArrayEquals(new float[]{0}, rgb, 0);
}
@Test
public void testMap1() {
float[] rgb = {1};
mapper.map(rgb);
assertArrayEquals(new float[]{0.5f}, rgb, 0);
}
@Test
public void testMapMax() {
float[] rgb = {Float.MAX_VALUE};
mapper.map(rgb);
assertArrayEquals(new float[]{1}, rgb, 0);
}
}

View File

@ -0,0 +1,38 @@
package com.twelvemonkeys.imageio.plugins.hdr.tonemap;
import org.junit.Test;
import static org.junit.Assert.assertArrayEquals;
public class GammaToneMapperTest {
private final GammaToneMapper mapper = new GammaToneMapper();
@Test
public void testMap0() {
float[] rgb = {0};
mapper.map(rgb);
assertArrayEquals(new float[]{0}, rgb, 0);
}
@Test
public void testMap1() {
float[] rgb = {1};
mapper.map(rgb);
assertArrayEquals(new float[]{0.5f}, rgb, 0);
}
@Test
public void testMap16() {
float[] rgb = {15.999999f};
mapper.map(rgb);
assertArrayEquals(new float[]{1}, rgb, 0);
}
@Test
public void testMapMax() {
float[] rgb = {Float.MAX_VALUE};
mapper.map(rgb);
assertArrayEquals(new float[]{1}, rgb, 0);
}
}

View File

@ -0,0 +1,31 @@
package com.twelvemonkeys.imageio.plugins.hdr.tonemap;
import org.junit.Test;
import static org.junit.Assert.assertArrayEquals;
public class NullToneMapperTest {
private final NullToneMapper mapper = new NullToneMapper();
@Test
public void testMap0() {
float[] rgb = {0};
mapper.map(rgb);
assertArrayEquals(new float[]{0}, rgb, 0);
}
@Test
public void testMap1() {
float[] rgb = {1};
mapper.map(rgb);
assertArrayEquals(new float[]{1}, rgb, 0);
}
@Test
public void testMapMax() {
float[] rgb = {Float.MAX_VALUE};
mapper.map(rgb);
assertArrayEquals(new float[]{Float.MAX_VALUE}, rgb, 0);
}
}