mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-04 12:05:29 -04:00
Add missing tests.
This commit is contained in:
parent
fc72cd34a1
commit
5040e9fe8a
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user