summaryrefslogtreecommitdiff
path: root/src/jniglue/tests/org/OpenColorIO/ColorSpaceTest.java
blob: f49e5824c2acf32c238f0f3eaebfaf18e8c24c2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import junit.framework.TestCase;
import org.OpenColorIO.*;

public class ColorSpaceTest extends TestCase {
    
    protected void setUp() {
    }
    
    protected void tearDown() {
    }
    
    public void test_interface() {
        ColorSpace cs = new ColorSpace().Create();
        cs.setName("mynewcolspace");
        assertEquals("mynewcolspace", cs.getName());
        cs.setFamily("fam1");
        assertEquals("fam1", cs.getFamily());
        cs.setEqualityGroup("match1");
        assertEquals("match1", cs.getEqualityGroup());
        cs.setDescription("this is a test");
        assertEquals("this is a test", cs.getDescription());
        cs.setBitDepth(BitDepth.BIT_DEPTH_F16);
        assertEquals(BitDepth.BIT_DEPTH_F16, cs.getBitDepth());
        cs.setIsData(false);
        assertEquals(false, cs.isData());
        cs.setAllocation(Allocation.ALLOCATION_LG2);
        assertEquals(Allocation.ALLOCATION_LG2, cs.getAllocation());
        float test[] = new float[]{0.1f, 0.2f, 0.3f};
        cs.setAllocationVars(3, test);
        assertEquals(3, cs.getAllocationNumVars());
        float out[] = new float[3];
        cs.getAllocationVars(out);
        LogTransform lt = new LogTransform().Create();
        lt.setBase(10.f);
        cs.setTransform(lt, ColorSpaceDirection.COLORSPACE_DIR_TO_REFERENCE);
        LogTransform ott = (LogTransform)cs.getTransform(ColorSpaceDirection.COLORSPACE_DIR_TO_REFERENCE);
        assertEquals(10.f, ott.getBase());
    }
    
}