summaryrefslogtreecommitdiffstats
path: root/o3d/tests
diff options
context:
space:
mode:
authorgman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-04 22:07:49 +0000
committergman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-04 22:07:49 +0000
commitc54a6ad63d5636174ed6f50637b81602cbf92f10 (patch)
treed50d4f74d68c5e71dc5186be9408ac07d5913d05 /o3d/tests
parentc3bf65f5b6c64414996c80cbec80ade3bb6a68f3 (diff)
downloadchromium_src-c54a6ad63d5636174ed6f50637b81602cbf92f10.zip
chromium_src-c54a6ad63d5636174ed6f50637b81602cbf92f10.tar.gz
chromium_src-c54a6ad63d5636174ed6f50637b81602cbf92f10.tar.bz2
Adding a no-binary path to the o3dConverter
and deserializer. This CL still creates a o3dtgz file, it's just that buffers, skins and curves are stored in JSON instead of binary. I'm not sure how useful this is but it seemed like a possible short cut to testing out some stuff. Another CL will add some flag so there is no gzipped tar file, just the json. Review URL: http://codereview.chromium.org/189003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25523 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/tests')
-rw-r--r--o3d/tests/selenium/tests/serialization-test.html117
1 files changed, 117 insertions, 0 deletions
diff --git a/o3d/tests/selenium/tests/serialization-test.html b/o3d/tests/selenium/tests/serialization-test.html
index b62d757..1f822ad 100644
--- a/o3d/tests/selenium/tests/serialization-test.html
+++ b/o3d/tests/selenium/tests/serialization-test.html
@@ -929,6 +929,45 @@ g_suite.testShouldSetVertexBufferData = function() {
g_test.assertEquals(12, field.size);
};
+g_suite.testShouldSetVertexBufferDataNotBinary = function() {
+ var json = {
+ version: o3djs.serialization.supportedVersion,
+ objects: {
+ 'o3d.VertexBuffer': [
+ {
+ custom: {
+ fieldData: [
+ {
+ id: 55,
+ type: "o3d.FloatField",
+ numComponents: 1,
+ data: [1.25,-3]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ };
+
+ var pack = g_client.createPack();
+ var deserializer = o3djs.serialization.createDeserializer(pack, json);
+ deserializer.run();
+
+ g_test.assertEquals(1, pack.objects.length);
+ var buffer = pack.objects[0];
+ g_test.assertEquals(2, buffer.numElements);
+ g_test.assertEquals(1, buffer.fields.length);
+ var field = buffer.fields[0];
+ g_test.assertEquals('o3d.FloatField', field.className);
+ g_test.assertEquals(1, field.numComponents);
+ g_test.assertEquals(4, field.size);
+ var data = field.getAt(0, 2);
+ g_test.assertEquals(1.25, data[0]);
+ g_test.assertEquals(-3, data[1]);
+
+};
+
g_suite.testShouldSetDestinationBufferData = function() {
var json = {
version: o3djs.serialization.supportedVersion,
@@ -1050,6 +1089,46 @@ g_suite.testShouldSetCurveWithKeys = function() {
g_test.assertEquals(14, keys.length);
};
+g_suite.testShouldSetCurveWithKeysNotBinary = function() {
+ var json = {
+ version: o3djs.serialization.supportedVersion,
+ objects: {
+ 'o3d.Curve': [
+ {
+ custom: {
+ keys: [
+ [1,1,2],
+ [2,3,4],
+ [3,5,8,6,7,9,10]
+ ]
+ }
+ }
+ ]
+ }
+ };
+
+ var pack = g_client.createPack();
+ var deserializer = o3djs.serialization.createDeserializer(pack, json);
+ deserializer.run();
+ g_test.assertEquals(1, pack.objects.length);
+ var curve = pack.objects[0];
+ var keys = curve.keys;
+ g_test.assertEquals(3, keys.length);
+ g_test.assertEquals('o3d.StepCurveKey', keys[0].className);
+ g_test.assertEquals('o3d.LinearCurveKey', keys[1].className);
+ g_test.assertEquals('o3d.BezierCurveKey', keys[2].className);
+ g_test.assertEquals(1, keys[0].input);
+ g_test.assertEquals(2, keys[0].output);
+ g_test.assertEquals(3, keys[1].input);
+ g_test.assertEquals(4, keys[1].output);
+ g_test.assertEquals(5, keys[2].input);
+ g_test.assertEquals(8, keys[2].output);
+ g_test.assertEquals(6, keys[2].inTangent[0]);
+ g_test.assertEquals(7, keys[2].inTangent[1]);
+ g_test.assertEquals(9, keys[2].outTangent[0]);
+ g_test.assertEquals(10, keys[2].outTangent[1]);
+};
+
g_suite.testShouldSetSkinEvalStreams = function() {
var json = {
version: o3djs.serialization.supportedVersion,
@@ -1359,6 +1438,44 @@ g_suite.testShouldSetSkinData = function() {
g_test.assertArrayEquals([2, 1], skin.influences[0]);
};
+g_suite.testShouldSetSkinDataNotBinary = function() {
+ var json = {
+ version: o3djs.serialization.supportedVersion,
+ objects: {
+ 'o3d.Skin': [
+ {
+ properties: {
+ influences: [[1, 2],[2, 3, 4, 5]],
+ inverseBindPoseMatrices: [
+ [[1, 2, 3, 4],
+ [5, 6, 7, 8],
+ [9, 10, 11, 12],
+ [13, 14, 15, 16]],
+ [[1, 2, 3, 4],
+ [5, 6, 7, 8.5],
+ [9, 10, 11, 12],
+ [13, 14, 15, 1]]]
+ }
+ }
+ ]
+ }
+ };
+
+ var pack = g_client.createPack();
+ var deserializer = o3djs.serialization.createDeserializer(pack, json);
+ deserializer.run();
+
+ g_test.assertEquals(1, pack.objects.length);
+ var skin = pack.objects[0];
+ g_test.assertEquals(2, skin.influences.length);
+ g_test.assertEquals(2, skin.influences[0].length);
+ g_test.assertEquals(4, skin.influences[1][2]);
+ g_test.assertArrayEquals([1, 2], skin.influences[0]);
+ g_test.assertArrayEquals([2, 3, 4, 5], skin.influences[1]);
+ g_test.assertEquals(2, skin.inverseBindPoseMatrices.length);
+ g_test.assertEquals(8.5, skin.inverseBindPoseMatrices[1][1][3]);
+};
+
g_suite.testExceptionIfEffectShaderCannotBeFound = function() {
var json = {
version: o3djs.serialization.supportedVersion,