summaryrefslogtreecommitdiff
path: root/src/jniglue/tests/org/OpenColorIO
diff options
context:
space:
mode:
authorMatteo F. Vescovi <mfv.debian@gmail.com>2013-08-20 09:53:19 +0100
committerMatteo F. Vescovi <mfv.debian@gmail.com>2013-08-20 09:53:19 +0100
commit66e5d9e2915733247bca47d077414ec2594aedad (patch)
treef4070a31bf015e159dadd34378cda703d8f6edea /src/jniglue/tests/org/OpenColorIO
opencolorio (1.0.8~dfsg0-2) unstable; urgency=low
* debian/rules: get-orig-source stuff added * debian/rules: useless dh addon removed * debian/rules: License.txt duplicate removed * debian/rules: SSE optimization disabled (Closes: #719174) * debian/libopencolorio1.symbols: file removed (Closes: #719175) # imported from the archive
Diffstat (limited to 'src/jniglue/tests/org/OpenColorIO')
-rw-r--r--src/jniglue/tests/org/OpenColorIO/BakerTest.java84
-rw-r--r--src/jniglue/tests/org/OpenColorIO/ColorSpaceTest.java41
-rw-r--r--src/jniglue/tests/org/OpenColorIO/ConfigTest.java220
-rw-r--r--src/jniglue/tests/org/OpenColorIO/ContextTest.java38
-rw-r--r--src/jniglue/tests/org/OpenColorIO/GlobalsTest.java150
-rw-r--r--src/jniglue/tests/org/OpenColorIO/GpuShaderDescTest.java24
-rw-r--r--src/jniglue/tests/org/OpenColorIO/LookTest.java35
-rw-r--r--src/jniglue/tests/org/OpenColorIO/OpenColorIOTestSuite.java30
-rw-r--r--src/jniglue/tests/org/OpenColorIO/PackedImageDescTest.java39
-rw-r--r--src/jniglue/tests/org/OpenColorIO/PlanarImageDescTest.java51
-rw-r--r--src/jniglue/tests/org/OpenColorIO/TransformsTest.java237
-rw-r--r--src/jniglue/tests/org/OpenColorIO/test.cc11
12 files changed, 960 insertions, 0 deletions
diff --git a/src/jniglue/tests/org/OpenColorIO/BakerTest.java b/src/jniglue/tests/org/OpenColorIO/BakerTest.java
new file mode 100644
index 0000000..63f540a
--- /dev/null
+++ b/src/jniglue/tests/org/OpenColorIO/BakerTest.java
@@ -0,0 +1,84 @@
+
+import junit.framework.TestCase;
+import org.OpenColorIO.*;
+
+public class BakerTest extends TestCase {
+
+ String SIMPLE_PROFILE = ""
+ + "ocio_profile_version: 1\n"
+ + "\n"
+ + "strictparsing: false\n"
+ + "\n"
+ + "colorspaces:\n"
+ + "\n"
+ + " - !<ColorSpace>\n"
+ + " name: lnh\n"
+ + " bitdepth: 16f\n"
+ + " isdata: false\n"
+ + " allocation: lg2\n"
+ + "\n"
+ + " - !<ColorSpace>\n"
+ + " name: test\n"
+ + " bitdepth: 8ui\n"
+ + " isdata: false\n"
+ + " allocation: uniform\n"
+ + " to_reference: !<ExponentTransform> {value: [2.2, 2.2, 2.2, 1]}\n";
+
+ String EXPECTED_LUT = ""
+ + "CSPLUTV100\n"
+ + "3D\n"
+ + "BEGIN METADATA\n"
+ + "this is some metadata!\n"
+ + "END METADATA\n"
+ + "\n"
+ + "4\n"
+ + "0.000977 0.039373 1.587401 64.000000\n"
+ + "0.000000 0.333333 0.666667 1.000000\n"
+ + "4\n"
+ + "0.000977 0.039373 1.587401 64.000000\n"
+ + "0.000000 0.333333 0.666667 1.000000\n"
+ + "4\n"
+ + "0.000977 0.039373 1.587401 64.000000\n"
+ + "0.000000 0.333333 0.666667 1.000000\n"
+ + "\n"
+ + "2 2 2\n"
+ + "0.042823 0.042823 0.042823\n"
+ + "6.622026 0.042823 0.042823\n"
+ + "0.042823 6.622026 0.042823\n"
+ + "6.622026 6.622026 0.042823\n"
+ + "0.042823 0.042823 6.622026\n"
+ + "6.622026 0.042823 6.622026\n"
+ + "0.042823 6.622026 6.622026\n"
+ + "6.622026 6.622026 6.622026\n"
+ + "\n";
+
+ protected void setUp() {
+ }
+
+ protected void tearDown() {
+ }
+
+ public void test_interface() {
+ Baker bake = new Baker().Create();
+ Baker bakee = bake.createEditableCopy();
+ Config cfg = new Config().CreateFromStream(SIMPLE_PROFILE);
+ bakee.setConfig(cfg);
+ bakee.setFormat("cinespace");
+ assertEquals("cinespace", bakee.getFormat());
+ bakee.setType("3D");
+ assertEquals("3D", bakee.getType());
+ bakee.setMetadata("this is some metadata!");
+ assertEquals("this is some metadata!", bakee.getMetadata());
+ bakee.setInputSpace("lnh");
+ assertEquals("lnh", bakee.getInputSpace());
+ bakee.setTargetSpace("test");
+ assertEquals("test", bakee.getTargetSpace());
+ bakee.setShaperSize(4);
+ assertEquals(4, bakee.getShaperSize());
+ bakee.setCubeSize(2);
+ assertEquals(2, bakee.getCubeSize());
+ String output = bakee.bake();
+ assertEquals(EXPECTED_LUT, output);
+ }
+
+}
diff --git a/src/jniglue/tests/org/OpenColorIO/ColorSpaceTest.java b/src/jniglue/tests/org/OpenColorIO/ColorSpaceTest.java
new file mode 100644
index 0000000..f49e582
--- /dev/null
+++ b/src/jniglue/tests/org/OpenColorIO/ColorSpaceTest.java
@@ -0,0 +1,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());
+ }
+
+}
diff --git a/src/jniglue/tests/org/OpenColorIO/ConfigTest.java b/src/jniglue/tests/org/OpenColorIO/ConfigTest.java
new file mode 100644
index 0000000..a676bae
--- /dev/null
+++ b/src/jniglue/tests/org/OpenColorIO/ConfigTest.java
@@ -0,0 +1,220 @@
+
+import junit.framework.TestCase;
+import org.OpenColorIO.*;
+import java.nio.*;
+
+public class ConfigTest extends TestCase {
+
+ String SIMPLE_PROFILE = ""
+ + "ocio_profile_version: 1\n"
+ + "\n"
+ + "search_path: luts\n"
+ + "strictparsing: false\n"
+ + "luma: [0.2126, 0.7152, 0.0722]\n"
+ + "\n"
+ + "roles:\n"
+ + " default: raw\n"
+ + " scene_linear: lnh\n"
+ + "\n"
+ + "displays:\n"
+ + " sRGB:\n"
+ + " - !<View> {name: Film1D, colorspace: vd8}\n"
+ + " - !<View> {name: Raw, colorspace: raw}\n"
+ + "\n"
+ + "active_displays: []\n"
+ + "active_views: []\n"
+ + "\n"
+ + "colorspaces:\n"
+ + " - !<ColorSpace>\n"
+ + " name: raw\n"
+ + " family: raw\n"
+ + " bitdepth: 32f\n"
+ + " description: |\n"
+ + " A raw color space. Conversions to and from this space are no-ops.\n"
+ + " \n"
+ + " isdata: true\n"
+ + " allocation: uniform\n"
+ + "\n"
+ + " - !<ColorSpace>\n"
+ + " name: lnh\n"
+ + " family: ln\n"
+ + " bitdepth: 16f\n"
+ + " description: |\n"
+ + " The show reference space. This is a sensor referred linear\n"
+ + " representation of the scene with primaries that correspond to\n"
+ + " scanned film. 0.18 in this space corresponds to a properly\n"
+ + " exposed 18% grey card.\n"
+ + " \n"
+ + " isdata: false\n"
+ + " allocation: lg2\n"
+ + "\n"
+ + " - !<ColorSpace>\n"
+ + " name: vd8\n"
+ + " family: vd8\n"
+ + " bitdepth: 8ui\n"
+ + " description: |\n"
+ + " how many transforms can we use?\n"
+ + " \n"
+ + " isdata: false\n"
+ + " allocation: uniform\n"
+ + " to_reference: !<GroupTransform>\n"
+ + " children:\n"
+ + " - !<ExponentTransform> {value: [2.2, 2.2, 2.2, 1]}\n"
+ + " - !<MatrixTransform> {matrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], offset: [0, 0, 0, 0]}\n"
+ + " - !<CDLTransform> {slope: [1, 1, 1], offset: [0.1, 0.3, 0.4], power: [1.1, 1.1, 1.1], saturation: 0.9}\n";
+
+ String GLSLResult = ""
+ + "\n"
+ + "// Generated by OpenColorIO\n"
+ + "\n"
+ + "vec4 jnitestocio(in vec4 inPixel, \n"
+ + " const sampler3D lut3d) \n"
+ + "{\n"
+ + "vec4 out_pixel = inPixel; \n"
+ + "out_pixel = out_pixel * mat4(1.08749, -0.0794667, -0.00802222, 0, -0.0236222, 1.03164, -0.00802222, 0, -0.0236222, -0.0794667, 1.10309, 0, 0, 0, 0, 1);\n"
+ + "out_pixel = pow(max(out_pixel, vec4(0, 0, 0, 0)), vec4(0.909091, 0.909091, 0.909091, 1));\n"
+ + "out_pixel = vec4(-0.1, -0.3, -0.4, -0) + out_pixel;\n"
+ + "out_pixel = pow(max(out_pixel, vec4(0, 0, 0, 0)), vec4(0.454545, 0.454545, 0.454545, 1));\n"
+ + "// OSX segfault work-around: Force a no-op sampling of the 3d lut.\n"
+ + "texture3D(lut3d, -inf * out_pixel.rgb + inf).rgb;\n"
+ + "return out_pixel;\n"
+ + "}\n"
+ + "\n";
+
+ protected void setUp() {
+ }
+
+ protected void tearDown() {
+ }
+
+ public void test_interface() {
+
+ Config _cfg = new Config().CreateFromStream(SIMPLE_PROFILE);
+ Config _cfge = _cfg.createEditableCopy();
+ assertEquals("luts", _cfge.getSearchPath());
+ _cfge.setSearchPath("otherdir");
+ assertEquals("otherdir", _cfge.getSearchPath());
+ _cfge.sanityCheck();
+ _cfge.setDescription("testdesc");
+ assertEquals("testdesc", _cfge.getDescription());
+ //assertEquals(SIMPLE_PROFILE, _cfg.serialize());
+ //assertEquals("$07d1fb1509eeae1837825fd4242f8a69:$885ad1683add38a11f7bbe34e8bf9ac0",
+ // _cfg.getCacheID());
+ Context con = _cfg.getCurrentContext();
+ assertNotSame(0, con.getNumStringVars());
+ //assertEquals("", _cfg.getCacheID(con)); // test env makes this fail
+ //assertEquals("", _cfge.getWorkingDir());
+ _cfge.setWorkingDir("/foobar");
+ assertEquals("/foobar", _cfge.getWorkingDir());
+ assertEquals(3, _cfge.getNumColorSpaces());
+ assertEquals("lnh", _cfge.getColorSpaceNameByIndex(1));
+ //public native ColorSpace getColorSpace(String name);
+ assertEquals(0, _cfge.getIndexForColorSpace("foobar"));
+ //public native void addColorSpace(ColorSpace cs);
+ //public native void clearColorSpaces();
+ //public native String parseColorSpaceFromString(String str);
+ if(_cfg.isStrictParsingEnabled()) fail("strict parsing should be off");
+ _cfge.setStrictParsingEnabled(true);
+ if(!_cfge.isStrictParsingEnabled()) fail("strict parsing should be on");
+ assertEquals(2, _cfge.getNumRoles());
+ if(_cfg.hasRole("foo")) fail("shouldn't have role foo");
+ _cfge.setRole("foo", "dfadfadf");
+ assertEquals(3, _cfge.getNumRoles());
+ if(!_cfge.hasRole("foo")) fail("should have role foo");
+ assertEquals("foo", _cfge.getRoleName(1));
+ assertEquals("sRGB", _cfge.getDefaultDisplay());
+ assertEquals(1, _cfge.getNumDisplays());
+ assertEquals("sRGB", _cfge.getDisplay(0));
+ assertEquals("Film1D", _cfge.getDefaultView("sRGB"));
+ assertEquals(2, _cfge.getNumViews("sRGB"));
+ assertEquals("Raw", _cfge.getView("sRGB", 1));
+ assertEquals("vd8", _cfge.getDisplayColorSpaceName("sRGB", "Film1D"));
+ assertEquals("", _cfg.getDisplayLooks("sRGB", "Film1D"));
+
+ // TODO: seems that 4 string params causes a memory error in the JNI layer?
+ //_cfge.addDisplay("foo", "bar", "foo", 0);
+
+ _cfge.clearDisplays();
+ _cfge.setActiveDisplays("sRGB");
+ assertEquals("sRGB", _cfge.getActiveDisplays());
+ _cfge.setActiveViews("Film1D");
+ assertEquals("Film1D", _cfge.getActiveViews());
+ float luma[] = new float[3];
+ _cfge.getDefaultLumaCoefs(luma);
+ assertEquals(0.2126, luma[0], 1e-8);
+ float[] newluma = new float[]{0.1f, 0.2f, 0.3f};
+ _cfge.setDefaultLumaCoefs(newluma);
+ float tnewluma[] = new float[3];
+ _cfge.getDefaultLumaCoefs(tnewluma);
+ assertEquals(0.1f, tnewluma[0], 1e-8);
+ assertEquals(0, _cfge.getNumLooks());
+ Look lk = new Look().Create();
+ lk.setName("coollook");
+ lk.setProcessSpace("somespace");
+ ExponentTransform et = new ExponentTransform().Create();
+ et.setValue(new float[]{0.1f, 0.2f, 0.3f, 0.4f});
+ lk.setTransform(et);
+ ExponentTransform iet = new ExponentTransform().Create();
+ iet.setValue(new float[]{-0.1f, -0.2f, -0.3f, -0.4f});
+ lk.setInverseTransform(iet);
+ _cfge.addLook(lk);
+ assertEquals(1, _cfge.getNumLooks());
+ assertEquals("coollook", _cfge.getLookNameByIndex(0));
+ Look glk = _cfge.getLook("coollook");
+ assertEquals("somespace", glk.getProcessSpace());
+ _cfge.clearLooks();
+ assertEquals(0, _cfge.getNumLooks());
+
+ //public native Processor getProcessor(Context context, ColorSpace srcColorSpace, ColorSpace dstColorSpace);
+
+ Processor _proc = _cfg.getProcessor("lnh", "vd8");
+ assertEquals(false, _proc.isNoOp());
+ assertEquals(true, _proc.hasChannelCrosstalk());
+ float packedpix[] = new float[]{0.48f, 0.18f, 0.9f, 1.0f,
+ 0.48f, 0.18f, 0.18f, 1.0f,
+ 0.48f, 0.18f, 0.18f, 1.0f,
+ 0.48f, 0.18f, 0.18f, 1.0f };
+ FloatBuffer buf = ByteBuffer.allocateDirect(2 * 2 * 4 * Float.SIZE / 8).asFloatBuffer();
+ buf.put(packedpix);
+ PackedImageDesc foo = new PackedImageDesc(buf, 2, 2, 4);
+ _proc.apply(foo);
+ FloatBuffer wee = foo.getData();
+ assertEquals(-2.4307251581696764E-35f, wee.get(2), 1e-8);
+ float rgbfoo[] = new float[]{0.48f, 0.18f, 0.18f};
+ _proc.applyRGB(rgbfoo);
+ assertEquals(0.6875247f, rgbfoo[0], 1e-8);
+ float rgbafoo[] = new float[]{0.48f, 0.18f, 0.18f, 1.f};
+ _proc.applyRGBA(rgbafoo);
+ assertEquals(1.f, rgbafoo[3], 1e-8);
+ //assertEquals("$a92ef63abd9edf61ad5a7855da064648", _proc.getCpuCacheID());
+ GpuShaderDesc desc = new GpuShaderDesc();
+ desc.setLanguage(GpuLanguage.GPU_LANGUAGE_GLSL_1_3);
+ desc.setFunctionName("jnitestocio");
+ desc.setLut3DEdgeLen(32);
+ String glsl = _proc.getGpuShaderText(desc);
+ //assertEquals(GLSLResult, glsl);
+ //assertEquals("$1dead2bf42974cd1769164e45a0c9e40", _proc.getGpuShaderTextCacheID(desc));
+ int len = desc.getLut3DEdgeLen();
+ int size = 3 * len * len * len;
+ FloatBuffer lut3d = ByteBuffer.allocateDirect(size * Float.SIZE / 8).asFloatBuffer();
+ _proc.getGpuLut3D(lut3d, desc);
+ assertEquals(0.0f, lut3d.get(size-1));
+ assertEquals("<NULL>", _proc.getGpuLut3DCacheID(desc));
+
+ //public native Processor getProcessor(Context context, String srcName, String dstName);
+ //public native Processor getProcessor(Transform transform);
+ //public native Processor getProcessor(Transform transform, TransformDirection direction);
+ //public native Processor getProcessor(Context context, Transform transform, TransformDirection direction);
+
+ _cfge.dispose();
+ _cfg.dispose();
+
+ //System.out.println(_cfge.serialize());
+ //_cfge.sanityCheck();
+ //System.out.println(_cfge.getNumColorSpaces());
+ //System.out.println(_cfg.getCacheID());
+ //System.out.println(_cfge.serialize());
+
+ }
+
+}
diff --git a/src/jniglue/tests/org/OpenColorIO/ContextTest.java b/src/jniglue/tests/org/OpenColorIO/ContextTest.java
new file mode 100644
index 0000000..87579e3
--- /dev/null
+++ b/src/jniglue/tests/org/OpenColorIO/ContextTest.java
@@ -0,0 +1,38 @@
+
+import junit.framework.TestCase;
+import org.OpenColorIO.*;
+
+public class ContextTest extends TestCase {
+
+ protected void setUp() {
+ }
+
+ protected void tearDown() {
+ }
+
+ public void test_interface() {
+ Context cont = new Context().Create();
+ cont.setSearchPath("testing123");
+ cont.setWorkingDir("/dir/123");
+ assertEquals("$af84c0ff921e48843d711a761e05b80f", cont.getCacheID());
+ assertEquals("testing123", cont.getSearchPath());
+ assertEquals("/dir/123", cont.getWorkingDir());
+ cont.setStringVar("TeSt", "foobar");
+ assertEquals("foobar", cont.getStringVar("TeSt"));
+ assertEquals(1, cont.getNumStringVars());
+ assertEquals("TeSt", cont.getStringVarNameByIndex(0));
+ cont.loadEnvironment();
+ assertNotSame(0, cont.getNumStringVars());
+ cont.setStringVar("TEST1", "foobar");
+ assertEquals("/foo/foobar/bar",
+ cont.resolveStringVar("/foo/${TEST1}/bar"));
+ try {
+ cont.setSearchPath("testing123");
+ String foo = cont.resolveFileLocation("test.lut");
+ System.out.println(foo);
+ } catch (ExceptionMissingFile e) {
+ //System.out.println(e);
+ }
+ }
+
+}
diff --git a/src/jniglue/tests/org/OpenColorIO/GlobalsTest.java b/src/jniglue/tests/org/OpenColorIO/GlobalsTest.java
new file mode 100644
index 0000000..72f92f8
--- /dev/null
+++ b/src/jniglue/tests/org/OpenColorIO/GlobalsTest.java
@@ -0,0 +1,150 @@
+
+import junit.framework.TestCase;
+import org.OpenColorIO.*;
+
+public class GlobalsTest extends TestCase {
+
+ String FOO = ""
+ + "ocio_profile_version: 1\n"
+ + "\n"
+ + "search_path: \n"
+ + "strictparsing: false\n"
+ + "luma: [0.2126, 0.7152, 0.0722]\n"
+ + "\n"
+ + "roles:\n"
+ + " default: raw\n"
+ + "\n"
+ + "displays:\n"
+ + " sRGB:\n"
+ + " - !<View> {name: Raw, colorspace: raw}\n"
+ + "\n"
+ + "active_displays: []\n"
+ + "active_views: []\n"
+ + "\n"
+ + "colorspaces:\n"
+ + " - !<ColorSpace>\n"
+ + " name: raw\n"
+ + " family: raw\n"
+ + " equalitygroup: \n"
+ + " bitdepth: 32f\n"
+ + " description: |\n"
+ + " A raw color space. Conversions to and from this space are no-ops.\n"
+ + " isdata: true\n"
+ + " allocation: uniform\n";
+
+ protected void setUp() {
+ }
+
+ public void test_interface() {
+
+ Globals globals = new Globals();
+
+ // Globals
+ globals.ClearAllCaches();
+ //assertEquals("1.0.1", globals.GetVersion());
+ //assertEquals(16777472, globals.GetVersionHex());
+ assertEquals(LoggingLevel.LOGGING_LEVEL_INFO, globals.GetLoggingLevel());
+ globals.SetLoggingLevel(LoggingLevel.LOGGING_LEVEL_NONE);
+ assertEquals(LoggingLevel.LOGGING_LEVEL_NONE, globals.GetLoggingLevel());
+ Config foo = globals.GetCurrentConfig();
+ assertEquals(FOO, foo.serialize());
+ globals.SetLoggingLevel(LoggingLevel.LOGGING_LEVEL_INFO);
+ Config bar = new Config().CreateFromStream(foo.serialize());
+ globals.SetCurrentConfig(bar);
+ Config wee = globals.GetCurrentConfig();
+
+ // LoggingLevel
+ assertEquals(globals.LoggingLevelToString(LoggingLevel.LOGGING_LEVEL_NONE), "none");
+ assertEquals(globals.LoggingLevelFromString("none"), LoggingLevel.LOGGING_LEVEL_NONE);
+ assertEquals(globals.LoggingLevelToString(LoggingLevel.LOGGING_LEVEL_WARNING), "warning");
+ assertEquals(globals.LoggingLevelFromString("warning"), LoggingLevel.LOGGING_LEVEL_WARNING);
+ assertEquals(globals.LoggingLevelToString(LoggingLevel.LOGGING_LEVEL_INFO), "info");
+ assertEquals(globals.LoggingLevelFromString("info"), LoggingLevel.LOGGING_LEVEL_INFO);
+ assertEquals(globals.LoggingLevelToString(LoggingLevel.LOGGING_LEVEL_DEBUG), "debug");
+ assertEquals(globals.LoggingLevelFromString("debug"), LoggingLevel.LOGGING_LEVEL_DEBUG);
+ assertEquals(globals.LoggingLevelToString(LoggingLevel.LOGGING_LEVEL_UNKNOWN), "unknown");
+ assertEquals(globals.LoggingLevelFromString("unknown"), LoggingLevel.LOGGING_LEVEL_UNKNOWN);
+
+ // TransformDirection
+ assertEquals(globals.TransformDirectionToString(TransformDirection.TRANSFORM_DIR_UNKNOWN), "unknown");
+ assertEquals(globals.TransformDirectionFromString("unknown"), TransformDirection.TRANSFORM_DIR_UNKNOWN);
+ assertEquals(globals.TransformDirectionToString(TransformDirection.TRANSFORM_DIR_FORWARD), "forward");
+ assertEquals(globals.TransformDirectionFromString("forward"), TransformDirection.TRANSFORM_DIR_FORWARD);
+ assertEquals(globals.TransformDirectionToString(TransformDirection.TRANSFORM_DIR_INVERSE), "inverse");
+ assertEquals(globals.TransformDirectionFromString("inverse"), TransformDirection.TRANSFORM_DIR_INVERSE);
+ assertEquals(globals.GetInverseTransformDirection(TransformDirection.TRANSFORM_DIR_UNKNOWN), TransformDirection.TRANSFORM_DIR_UNKNOWN);
+ assertEquals(globals.GetInverseTransformDirection(TransformDirection.TRANSFORM_DIR_FORWARD), TransformDirection.TRANSFORM_DIR_INVERSE);
+ assertEquals(globals.GetInverseTransformDirection(TransformDirection.TRANSFORM_DIR_INVERSE), TransformDirection.TRANSFORM_DIR_FORWARD);
+
+ // ColorSpaceDirection
+ assertEquals(globals.ColorSpaceDirectionToString(ColorSpaceDirection.COLORSPACE_DIR_UNKNOWN), "unknown");
+ assertEquals(globals.ColorSpaceDirectionFromString("unknown"), ColorSpaceDirection.COLORSPACE_DIR_UNKNOWN);
+ assertEquals(globals.ColorSpaceDirectionToString(ColorSpaceDirection.COLORSPACE_DIR_TO_REFERENCE), "to_reference");
+ assertEquals(globals.ColorSpaceDirectionFromString("to_reference"), ColorSpaceDirection.COLORSPACE_DIR_TO_REFERENCE);
+ assertEquals(globals.ColorSpaceDirectionToString(ColorSpaceDirection.COLORSPACE_DIR_FROM_REFERENCE), "from_reference");
+ assertEquals(globals.ColorSpaceDirectionFromString("from_reference"), ColorSpaceDirection.COLORSPACE_DIR_FROM_REFERENCE);
+
+ // BitDepth
+ assertEquals(globals.BitDepthToString(BitDepth.BIT_DEPTH_UNKNOWN), "unknown");
+ assertEquals(globals.BitDepthFromString("unknown"), BitDepth.BIT_DEPTH_UNKNOWN);
+ assertEquals(globals.BitDepthToString(BitDepth.BIT_DEPTH_UINT8), "8ui");
+ assertEquals(globals.BitDepthFromString("8ui"), BitDepth.BIT_DEPTH_UINT8);
+ assertEquals(globals.BitDepthToString(BitDepth.BIT_DEPTH_UINT10), "10ui");
+ assertEquals(globals.BitDepthFromString("10ui"), BitDepth.BIT_DEPTH_UINT10);
+ assertEquals(globals.BitDepthToString(BitDepth.BIT_DEPTH_UINT12), "12ui");
+ assertEquals(globals.BitDepthFromString("12ui"), BitDepth.BIT_DEPTH_UINT12);
+ assertEquals(globals.BitDepthToString(BitDepth.BIT_DEPTH_UINT14), "14ui");
+ assertEquals(globals.BitDepthFromString("14ui"), BitDepth.BIT_DEPTH_UINT14);
+ assertEquals(globals.BitDepthToString(BitDepth.BIT_DEPTH_UINT16), "16ui");
+ assertEquals(globals.BitDepthFromString("16ui"), BitDepth.BIT_DEPTH_UINT16);
+ assertEquals(globals.BitDepthToString(BitDepth.BIT_DEPTH_UINT32), "32ui");
+ assertEquals(globals.BitDepthFromString("32ui"), BitDepth.BIT_DEPTH_UINT32);
+ assertEquals(globals.BitDepthToString(BitDepth.BIT_DEPTH_F16), "16f");
+ assertEquals(globals.BitDepthFromString("16f"), BitDepth.BIT_DEPTH_F16);
+ assertEquals(globals.BitDepthToString(BitDepth.BIT_DEPTH_F32), "32f");
+ assertEquals(globals.BitDepthFromString("32f"), BitDepth.BIT_DEPTH_F32);
+
+ // Allocation
+ assertEquals(globals.AllocationToString(Allocation.ALLOCATION_UNKNOWN), "unknown");
+ assertEquals(globals.AllocationFromString("unknown"), Allocation.ALLOCATION_UNKNOWN);
+ assertEquals(globals.AllocationToString(Allocation.ALLOCATION_UNIFORM), "uniform");
+ assertEquals(globals.AllocationFromString("uniform"), Allocation.ALLOCATION_UNIFORM);
+ assertEquals(globals.AllocationToString(Allocation.ALLOCATION_LG2), "lg2");
+ assertEquals(globals.AllocationFromString("lg2"), Allocation.ALLOCATION_LG2);
+
+ // Interpolation
+ assertEquals(globals.InterpolationToString(Interpolation.INTERP_UNKNOWN), "unknown");
+ assertEquals(globals.InterpolationFromString("unknown"), Interpolation.INTERP_UNKNOWN);
+ assertEquals(globals.InterpolationToString(Interpolation.INTERP_NEAREST), "nearest");
+ assertEquals(globals.InterpolationFromString("nearest"), Interpolation.INTERP_NEAREST);
+ assertEquals(globals.InterpolationToString(Interpolation.INTERP_LINEAR), "linear");
+ assertEquals(globals.InterpolationFromString("linear"), Interpolation.INTERP_LINEAR);
+ assertEquals(globals.InterpolationToString(Interpolation.INTERP_TETRAHEDRAL), "tetrahedral");
+ assertEquals(globals.InterpolationFromString("tetrahedral"), Interpolation.INTERP_TETRAHEDRAL);
+ assertEquals(globals.InterpolationToString(Interpolation.INTERP_BEST), "best");
+ assertEquals(globals.InterpolationFromString("best"), Interpolation.INTERP_BEST);
+
+ // GpuLanguage
+ assertEquals(globals.GpuLanguageToString(GpuLanguage.GPU_LANGUAGE_UNKNOWN), "unknown");
+ assertEquals(globals.GpuLanguageFromString("unknown"), GpuLanguage.GPU_LANGUAGE_UNKNOWN);
+ assertEquals(globals.GpuLanguageToString(GpuLanguage.GPU_LANGUAGE_CG), "cg");
+ assertEquals(globals.GpuLanguageFromString("cg"), GpuLanguage.GPU_LANGUAGE_CG);
+ assertEquals(globals.GpuLanguageToString(GpuLanguage.GPU_LANGUAGE_GLSL_1_0), "glsl_1.0");
+ assertEquals(globals.GpuLanguageFromString("glsl_1.0"), GpuLanguage.GPU_LANGUAGE_GLSL_1_0);
+ assertEquals(globals.GpuLanguageToString(GpuLanguage.GPU_LANGUAGE_GLSL_1_3), "glsl_1.3");
+ assertEquals(globals.GpuLanguageFromString("glsl_1.3"), GpuLanguage.GPU_LANGUAGE_GLSL_1_3);
+
+ // Roles
+ assertEquals(globals.ROLE_DEFAULT, "default");
+ assertEquals(globals.ROLE_REFERENCE, "reference");
+ assertEquals(globals.ROLE_DATA, "data");
+ assertEquals(globals.ROLE_COLOR_PICKING, "color_picking");
+ assertEquals(globals.ROLE_SCENE_LINEAR, "scene_linear");
+ assertEquals(globals.ROLE_COMPOSITING_LOG, "compositing_log");
+ assertEquals(globals.ROLE_COLOR_TIMING, "color_timing");
+ assertEquals(globals.ROLE_TEXTURE_PAINT, "texture_paint");
+ assertEquals(globals.ROLE_MATTE_PAINT, "matte_paint");
+
+ }
+
+}
diff --git a/src/jniglue/tests/org/OpenColorIO/GpuShaderDescTest.java b/src/jniglue/tests/org/OpenColorIO/GpuShaderDescTest.java
new file mode 100644
index 0000000..08b0a16
--- /dev/null
+++ b/src/jniglue/tests/org/OpenColorIO/GpuShaderDescTest.java
@@ -0,0 +1,24 @@
+
+import junit.framework.TestCase;
+import org.OpenColorIO.*;
+
+public class GpuShaderDescTest extends TestCase {
+
+ protected void setUp() {
+ }
+
+ protected void tearDown() {
+ }
+
+ public void test_interface() {
+ GpuShaderDesc desc = new GpuShaderDesc();
+ desc.setLanguage(GpuLanguage.GPU_LANGUAGE_GLSL_1_3);
+ assertEquals(GpuLanguage.GPU_LANGUAGE_GLSL_1_3, desc.getLanguage());
+ desc.setFunctionName("foo123");
+ assertEquals("foo123", desc.getFunctionName());
+ desc.setLut3DEdgeLen(32);
+ assertEquals(32, desc.getLut3DEdgeLen());
+ assertEquals("glsl_1.3 foo123 32", desc.getCacheID());
+ }
+
+}
diff --git a/src/jniglue/tests/org/OpenColorIO/LookTest.java b/src/jniglue/tests/org/OpenColorIO/LookTest.java
new file mode 100644
index 0000000..778c124
--- /dev/null
+++ b/src/jniglue/tests/org/OpenColorIO/LookTest.java
@@ -0,0 +1,35 @@
+
+import junit.framework.TestCase;
+import org.OpenColorIO.*;
+
+public class LookTest extends TestCase {
+
+ protected void setUp() {
+ }
+
+ protected void tearDown() {
+ }
+
+ public void test_interface() {
+ Look lk = new Look().Create();
+ lk.setName("coollook");
+ assertEquals("coollook", lk.getName());
+ lk.setProcessSpace("somespace");
+ assertEquals("somespace", lk.getProcessSpace());
+ ExponentTransform et = new ExponentTransform().Create();
+ et.setValue(new float[]{0.1f, 0.2f, 0.3f, 0.4f});
+ lk.setTransform(et);
+ ExponentTransform oet = (ExponentTransform)lk.getTransform();
+ float vals[] = new float[4];
+ oet.getValue(vals);
+ assertEquals(0.2f, vals[1], 1e-8);
+ ExponentTransform iet = new ExponentTransform().Create();
+ iet.setValue(new float[]{-0.1f, -0.2f, -0.3f, -0.4f});
+ lk.setInverseTransform(iet);
+ ExponentTransform ioet = (ExponentTransform)lk.getInverseTransform();
+ float vals2[] = new float[4];
+ ioet.getValue(vals2);
+ assertEquals(-0.2f, vals2[1], 1e-8);
+ }
+
+}
diff --git a/src/jniglue/tests/org/OpenColorIO/OpenColorIOTestSuite.java b/src/jniglue/tests/org/OpenColorIO/OpenColorIOTestSuite.java
new file mode 100644
index 0000000..b847d96
--- /dev/null
+++ b/src/jniglue/tests/org/OpenColorIO/OpenColorIOTestSuite.java
@@ -0,0 +1,30 @@
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class OpenColorIOTestSuite {
+
+ public static Test suite() {
+
+ TestSuite suite = new TestSuite();
+
+ // Core
+ suite.addTestSuite(GlobalsTest.class);
+ suite.addTestSuite(ConfigTest.class);
+ suite.addTestSuite(ColorSpaceTest.class);
+ suite.addTestSuite(LookTest.class);
+ suite.addTestSuite(BakerTest.class);
+ suite.addTestSuite(PackedImageDescTest.class);
+ suite.addTestSuite(PlanarImageDescTest.class);
+ suite.addTestSuite(GpuShaderDescTest.class);
+ suite.addTestSuite(ContextTest.class);
+ suite.addTestSuite(TransformsTest.class);
+
+ return suite;
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+
+}
diff --git a/src/jniglue/tests/org/OpenColorIO/PackedImageDescTest.java b/src/jniglue/tests/org/OpenColorIO/PackedImageDescTest.java
new file mode 100644
index 0000000..741a13d
--- /dev/null
+++ b/src/jniglue/tests/org/OpenColorIO/PackedImageDescTest.java
@@ -0,0 +1,39 @@
+
+import junit.framework.TestCase;
+import org.OpenColorIO.*;
+import java.nio.*;
+
+public class PackedImageDescTest extends TestCase {
+
+ protected void setUp() {
+ }
+
+ protected void tearDown() {
+ }
+
+ public void test_interface() {
+
+ int width = 2;
+ int height = 2;
+ int channels = 4;
+ float packedpix[] = new float[]{0.1f, 0.1f, 0.1f, 1.0f,
+ 0.2f, 0.2f, 0.2f, 1.0f,
+ 0.3f, 0.3f, 0.3f, 1.0f,
+ 0.4f, 0.4f, 0.4f, 1.0f };
+ FloatBuffer buf = ByteBuffer.allocateDirect(width * height * channels
+ * Float.SIZE / 8).asFloatBuffer();
+ buf.put(packedpix);
+ //
+ PackedImageDesc foo = new PackedImageDesc(buf, width, height, channels);
+ FloatBuffer wee = foo.getData();
+ assertEquals(0.3f, wee.get(10));
+ assertEquals(2, foo.getWidth());
+ assertEquals(2, foo.getHeight());
+ assertEquals(4, foo.getNumChannels());
+ assertEquals(4, foo.getChanStrideBytes());
+ assertEquals(16, foo.getXStrideBytes());
+ assertEquals(32, foo.getYStrideBytes());
+
+ }
+
+}
diff --git a/src/jniglue/tests/org/OpenColorIO/PlanarImageDescTest.java b/src/jniglue/tests/org/OpenColorIO/PlanarImageDescTest.java
new file mode 100644
index 0000000..e0d4deb
--- /dev/null
+++ b/src/jniglue/tests/org/OpenColorIO/PlanarImageDescTest.java
@@ -0,0 +1,51 @@
+
+import junit.framework.TestCase;
+import org.OpenColorIO.*;
+import java.nio.*;
+
+public class PlanarImageDescTest extends TestCase {
+
+ protected void setUp() {
+ }
+
+ protected void tearDown() {
+ }
+
+ public void test_interface() {
+
+ int width = 2;
+ int height = 2;
+ int channels = 4;
+ //
+ float rpix[] = new float[]{0.1f, 0.2f, 0.3f, 0.4f};
+ float gpix[] = new float[]{0.1f, 0.2f, 0.3f, 0.4f};
+ float bpix[] = new float[]{0.1f, 0.2f, 0.3f, 0.4f};
+ float apix[] = new float[]{1.0f, 1.0f, 1.0f, 1.0f};
+ int alloc = width * height * Float.SIZE / 8;
+ //
+ FloatBuffer rbuf = ByteBuffer.allocateDirect(alloc).asFloatBuffer();
+ rbuf.put(rpix);
+ FloatBuffer gbuf = ByteBuffer.allocateDirect(alloc).asFloatBuffer();
+ gbuf.put(gpix);
+ FloatBuffer bbuf = ByteBuffer.allocateDirect(alloc).asFloatBuffer();
+ bbuf.put(bpix);
+ FloatBuffer abuf = ByteBuffer.allocateDirect(alloc).asFloatBuffer();
+ abuf.put(apix);
+ //
+ PlanarImageDesc foo = new PlanarImageDesc(rbuf, gbuf, bbuf, abuf,
+ width, height);
+ FloatBuffer trb = foo.getRData();
+ FloatBuffer tgb = foo.getGData();
+ FloatBuffer tbb = foo.getBData();
+ FloatBuffer tab = foo.getAData();
+ assertEquals(0.1f, trb.get(0));
+ assertEquals(0.2f, tgb.get(1));
+ assertEquals(0.3f, tbb.get(2));
+ assertEquals(1.0f, tab.get(3));
+ assertEquals(2, foo.getWidth());
+ assertEquals(2, foo.getHeight());
+ assertEquals(8, foo.getYStrideBytes());
+
+ }
+
+}
diff --git a/src/jniglue/tests/org/OpenColorIO/TransformsTest.java b/src/jniglue/tests/org/OpenColorIO/TransformsTest.java
new file mode 100644
index 0000000..6300079
--- /dev/null
+++ b/src/jniglue/tests/org/OpenColorIO/TransformsTest.java
@@ -0,0 +1,237 @@
+
+import junit.framework.TestCase;
+import org.OpenColorIO.*;
+
+public class TransformsTest extends TestCase {
+
+ protected void setUp() {
+ }
+
+ protected void tearDown() {
+ }
+
+ public void test_interface() {
+
+ //// AllocationTransform ////
+ AllocationTransform at = new AllocationTransform().Create();
+ assertEquals(Allocation.ALLOCATION_UNIFORM, at.getAllocation());
+ at.setAllocation(Allocation.ALLOCATION_LG2);
+ assertEquals(Allocation.ALLOCATION_LG2, at.getAllocation());
+ assertEquals(0, at.getNumVars());
+ float[] vars = new float[]{0.1f, 0.2f, 0.3f};
+ at.setVars(3, vars);
+ assertEquals(3, at.getNumVars());
+ float newvars[] = new float[3];
+ at.getVars(newvars);
+ assertEquals(0.2f, newvars[1], 1e-8);
+
+ // Base Transform method tests
+ assertEquals(TransformDirection.TRANSFORM_DIR_FORWARD, at.getDirection());
+ at.setDirection(TransformDirection.TRANSFORM_DIR_UNKNOWN);
+ assertEquals(TransformDirection.TRANSFORM_DIR_UNKNOWN, at.getDirection());
+
+ //// CDLTransform ////
+ CDLTransform cdl = new CDLTransform().Create();
+ String CC = ""
+ +"<ColorCorrection id=\"foo\">"
+ +"<SOPNode>"
+ +"<Description>this is a descipt</Description>"
+ +"<Slope>1.1 1.2 1.3</Slope>"
+ +"<Offset>2.1 2.2 2.3</Offset>"
+ +"<Power>3.1 3.2 3.3</Power>"
+ +"</SOPNode>"
+ +"<SatNode><Saturation>0.7</Saturation></SatNode>"
+ +"</ColorCorrection>";
+ // Don't want to deal with getting the correct path so this runs
+ //CDLTransform cdlfile = new CDLTransform().CreateFromFile("../OpenColorIO/src/jniglue/tests/org/OpenColorIO/test.cc", "foo");
+ //assertEquals(CC, cdlfile.getXML());
+ cdl.setXML(CC);
+ assertEquals(CC, cdl.getXML());
+ //CDLTransform match = new CDLTransform().Create();
+ CDLTransform match = (CDLTransform)cdl.createEditableCopy();
+ match.setOffset(new float[]{1.0f, 1.0f, 1.f});
+ assertEquals(false, cdl.equals(match));
+ cdl.setSlope(new float[]{0.1f, 0.2f, 0.3f});
+ cdl.setOffset(new float[]{1.1f, 1.2f, 1.3f});
+ cdl.setPower(new float[]{2.1f, 2.2f, 2.3f});
+ cdl.setSat(0.5f);
+ String CC2 = ""
+ +"<ColorCorrection id=\"foo\">"
+ +"<SOPNode>"
+ +"<Description>this is a descipt</Description>"
+ +"<Slope>0.1 0.2 0.3</Slope>"
+ +"<Offset>1.1 1.2 1.3</Offset>"
+ +"<Power>2.1 2.2 2.3</Power>"
+ +"</SOPNode>"
+ +"<SatNode><Saturation>0.5</Saturation></SatNode>"
+ +"</ColorCorrection>";
+ assertEquals(CC2, cdl.getXML());
+ cdl.setSOP(new float[]{1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f});
+ float newsop[] = new float[9];
+ cdl.getSOP(newsop);
+ assertEquals(1.5f, newsop[4], 1e-8);
+ float slope[] = new float[3];
+ cdl.getSlope(slope);
+ assertEquals(1.2f, slope[1], 1e-8);
+ float offset[] = new float[3];
+ cdl.getOffset(offset);
+ assertEquals(1.6f, offset[2], 1e-8);
+ float power[] = new float[3];
+ cdl.getPower(power);
+ assertEquals(1.7f, power[0], 1e-8);
+ assertEquals(0.5f, cdl.getSat(), 1e-8);
+ float luma[] = new float[3];
+ cdl.getSatLumaCoefs(luma);
+ assertEquals(0.2126f, luma[0], 1e-8);
+ assertEquals(0.7152f, luma[1], 1e-8);
+ assertEquals(0.0722f, luma[2], 1e-8);
+ cdl.setID("foobar123");
+ assertEquals("foobar123", cdl.getID());
+ cdl.setDescription("bar");
+ assertEquals("bar", cdl.getDescription());
+
+ //// ColorSpaceTransform ////
+ ColorSpaceTransform ct = new ColorSpaceTransform().Create();
+ ct.setSrc("foo");
+ assertEquals("foo", ct.getSrc());
+ ct.setDst("bar");
+ assertEquals("bar", ct.getDst());
+
+ //// DisplayTransform ////
+ DisplayTransform dt = new DisplayTransform().Create();
+ dt.setInputColorSpaceName("lin18");
+ assertEquals("lin18", dt.getInputColorSpaceName());
+ //public native void setLinearCC(Transform cc);
+ //public native Transform getLinearCC();
+ //public native void setColorTimingCC(Transform cc);
+ //public native Transform getColorTimingCC();
+ //public native void setChannelView(Transform transform);
+ //public native Transform getChannelView();
+ dt.setDisplay("sRGB");
+ assertEquals("sRGB", dt.getDisplay());
+ dt.setView("foobar");
+ assertEquals("foobar", dt.getView());
+ cdl.setXML(CC);
+ dt.setDisplayCC(cdl);
+ CDLTransform cdldt = (CDLTransform)dt.getDisplayCC();
+ assertEquals(CC, cdldt.getXML());
+ dt.setLooksOverride("darkgrade");
+ assertEquals("darkgrade", dt.getLooksOverride());
+ dt.setLooksOverrideEnabled(true);
+ assertEquals(true, dt.getLooksOverrideEnabled());
+
+ //// ExponentTransform ////
+ ExponentTransform et = new ExponentTransform().Create();
+ et.setValue(new float[]{0.1f, 0.2f, 0.3f, 0.4f});
+ float evals[] = new float[4];
+ et.getValue(evals);
+ assertEquals(0.3f, evals[2], 1e-8);
+
+ //// FileTransform ////
+ FileTransform ft = new FileTransform().Create();
+ ft.setSrc("foo");
+ assertEquals("foo", ft.getSrc());
+ ft.setCCCId("foobar");
+ assertEquals("foobar", ft.getCCCId());
+ ft.setInterpolation(Interpolation.INTERP_NEAREST);
+ assertEquals(Interpolation.INTERP_NEAREST, ft.getInterpolation());
+ assertEquals(15, ft.getNumFormats());
+ assertEquals("flame", ft.getFormatNameByIndex(0));
+ assertEquals("3dl", ft.getFormatExtensionByIndex(0));
+
+ //// GroupTransform ////
+ GroupTransform gt = new GroupTransform().Create();
+ gt.push_back(et);
+ gt.push_back(ft);
+ assertEquals(2, gt.size());
+ assertEquals(false, gt.empty());
+ Transform foo = gt.getTransform(0);
+ assertEquals(TransformDirection.TRANSFORM_DIR_FORWARD, foo.getDirection());
+ gt.clear();
+ assertEquals(0, gt.size());
+
+ //// LogTransform ////
+ LogTransform lt = new LogTransform().Create();
+ lt.setBase(10.f);
+ assertEquals(10.f, lt.getBase());
+
+ //// LookTransform ////
+ LookTransform lkt = new LookTransform().Create();
+ lkt.setSrc("foo");
+ assertEquals("foo", lkt.getSrc());
+ lkt.setDst("bar");
+ assertEquals("bar", lkt.getDst());
+ lkt.setLooks("bar;foo");
+ assertEquals("bar;foo", lkt.getLooks());
+
+ //// MatrixTransform ////
+ MatrixTransform mt = new MatrixTransform().Create();
+ MatrixTransform mmt = (MatrixTransform)mt.createEditableCopy();
+ mt.setValue(new float[]{0.1f, 0.2f, 0.3f, 0.4f,
+ 0.5f, 0.6f, 0.7f, 0.8f,
+ 0.9f, 1.0f, 1.1f, 1.2f,
+ 1.3f, 1.4f, 1.5f, 1.6f},
+ new float[]{0.1f, 0.2f, 0.3f, 0.4f});
+ assertEquals(false, mt.equals(mmt));
+ float m44_1[] = new float[16];
+ float offset_1[] = new float[4];
+ mt.getValue(m44_1, offset_1);
+ assertEquals(0.3f, m44_1[2]);
+ assertEquals(0.2f, offset_1[1]);
+ mt.setMatrix(new float[]{1.1f, 1.2f, 1.3f, 1.4f,
+ 1.5f, 1.6f, 1.7f, 1.8f,
+ 1.9f, 2.0f, 2.1f, 2.2f,
+ 2.3f, 2.4f, 2.5f, 2.6f});
+ float m44_2[] = new float[16];
+ mt.getMatrix(m44_2);
+ assertEquals(1.3f, m44_2[2]);
+ mt.setOffset(new float[]{1.1f, 1.2f, 1.3f, 1.4f});
+ float offset_2[] = new float[4];
+ mt.getOffset(offset_2);
+ assertEquals(1.4f, offset_2[3]);
+ mt.Fit(m44_2, offset_2,
+ new float[]{0.1f, 0.1f, 0.1f, 0.1f},
+ new float[]{0.9f, 0.9f, 0.9f, 0.9f},
+ new float[]{0.0f, 0.0f, 0.0f, 0.0f},
+ new float[]{1.1f, 1.1f, 1.1f, 1.1f});
+ float m44_3[] = new float[16];
+ mt.getMatrix(m44_3);
+ assertEquals(1.3f, m44_3[2]);
+ mt.Identity(m44_3, offset_2);
+ assertEquals(0.f, m44_3[1]);
+ mt.Sat(m44_2, offset_2, 0.5f, new float[]{0.2126f, 0.7152f, 0.0722f});
+ assertEquals(0.3576f, m44_2[1]);
+ mt.Scale(m44_2, offset_2, new float[]{0.9f, 0.8f, 0.7f, 1.f});
+ assertEquals(0.9f, m44_2[0]);
+ mt.View(m44_2, null, new int[]{1, 1, 1, 0}, new float[]{0.2126f, 0.7152f, 0.0722f});
+ assertEquals(0.0722f, m44_2[2]);
+
+ //// TruelightTransform ////
+ TruelightTransform tt = new TruelightTransform().Create();
+ tt.setConfigRoot("/some/path");
+ assertEquals("/some/path", tt.getConfigRoot());
+ tt.setProfile("profileA");
+ assertEquals("profileA", tt.getProfile());
+ tt.setCamera("incam");
+ assertEquals("incam", tt.getCamera());
+ tt.setInputDisplay("dellmon");
+ assertEquals("dellmon", tt.getInputDisplay());
+ tt.setRecorder("blah");
+ assertEquals("blah", tt.getRecorder());
+ tt.setPrint("kodasomething");
+ assertEquals("kodasomething", tt.getPrint());
+ tt.setLamp("foobar");
+ assertEquals("foobar", tt.getLamp());
+ tt.setOutputCamera("somecam");
+ assertEquals("somecam", tt.getOutputCamera());
+ tt.setDisplay("sRGB");
+ assertEquals("sRGB", tt.getDisplay());
+ tt.setCubeInput("log");
+ assertEquals("log", tt.getCubeInput());
+
+ try {
+ } catch (Exception e) { System.out.println(e); }
+
+ }
+
+} \ No newline at end of file
diff --git a/src/jniglue/tests/org/OpenColorIO/test.cc b/src/jniglue/tests/org/OpenColorIO/test.cc
new file mode 100644
index 0000000..121bf42
--- /dev/null
+++ b/src/jniglue/tests/org/OpenColorIO/test.cc
@@ -0,0 +1,11 @@
+<ColorCorrection id="foo">
+ <SOPNode>
+ <Description>this is a descipt</Description>
+ <Slope>1.1 1.2 1.3</Slope>
+ <Offset>2.1 2.2 2.3</Offset>
+ <Power>3.1 3.2 3.3</Power>
+ </SOPNode>
+ <SatNode>
+ <Saturation>0.7</Saturation>
+ </SatNode>
+</ColorCorrection> \ No newline at end of file