mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 04:25:29 -04:00
Add missing tests.
(cherry picked from commit 5040e9fe8a8d07676fb9ce280a630229087705fb)
This commit is contained in:
parent
fbaa13d48d
commit
5757743db7
@ -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