Merge pull request #95 from AnalyticalGraphicsInc/fragile-tests

Rework fragile tests
This commit is contained in:
Matthew Amato 2017-07-11 11:39:07 -04:00 committed by GitHub
commit 88d1396370
3 changed files with 30 additions and 705 deletions

View File

@ -1,492 +0,0 @@
{
"accessors": {
"accessor_0": {
"bufferView": "bufferView_vertex",
"byteOffset": 0,
"byteStride": 0,
"componentType": 5126,
"count": 24,
"min": [
-1,
-1,
-6
],
"max": [
1,
1,
-4
],
"type": "VEC3"
},
"accessor_1": {
"bufferView": "bufferView_vertex",
"byteOffset": 288,
"byteStride": 0,
"componentType": 5126,
"count": 24,
"min": [
-1,
-1,
-1
],
"max": [
1,
1,
1
],
"type": "VEC3"
},
"accessor_2": {
"bufferView": "bufferView_vertex",
"byteOffset": 576,
"byteStride": 0,
"componentType": 5126,
"count": 24,
"min": [
0,
0
],
"max": [
1,
1
],
"type": "VEC2"
},
"accessor_3": {
"bufferView": "bufferView_index",
"byteOffset": 0,
"byteStride": 0,
"componentType": 5123,
"count": 18,
"min": [
0
],
"max": [
11
],
"type": "SCALAR"
},
"accessor_4": {
"bufferView": "bufferView_index",
"byteOffset": 36,
"byteStride": 0,
"componentType": 5123,
"count": 18,
"min": [
12
],
"max": [
23
],
"type": "SCALAR"
},
"accessor_5": {
"bufferView": "bufferView_vertex",
"byteOffset": 768,
"byteStride": 0,
"componentType": 5126,
"count": 24,
"min": [
4,
-1,
-1
],
"max": [
6,
1,
1
],
"type": "VEC3"
},
"accessor_6": {
"bufferView": "bufferView_vertex",
"byteOffset": 1056,
"byteStride": 0,
"componentType": 5126,
"count": 24,
"min": [
-1,
-1,
-1
],
"max": [
1,
1,
1
],
"type": "VEC3"
},
"accessor_7": {
"bufferView": "bufferView_vertex",
"byteOffset": 1344,
"byteStride": 0,
"componentType": 5126,
"count": 24,
"min": [
0,
0
],
"max": [
1,
1
],
"type": "VEC2"
},
"accessor_8": {
"bufferView": "bufferView_index",
"byteOffset": 72,
"byteStride": 0,
"componentType": 5123,
"count": 18,
"min": [
0
],
"max": [
11
],
"type": "SCALAR"
},
"accessor_9": {
"bufferView": "bufferView_index",
"byteOffset": 108,
"byteStride": 0,
"componentType": 5123,
"count": 18,
"min": [
12
],
"max": [
23
],
"type": "SCALAR"
},
"accessor_10": {
"bufferView": "bufferView_vertex",
"byteOffset": 1536,
"byteStride": 0,
"componentType": 5126,
"count": 24,
"min": [
-1,
-1,
-1
],
"max": [
1,
1,
1
],
"type": "VEC3"
},
"accessor_11": {
"bufferView": "bufferView_vertex",
"byteOffset": 1824,
"byteStride": 0,
"componentType": 5126,
"count": 24,
"min": [
-1,
-1,
-1
],
"max": [
1,
1,
1
],
"type": "VEC3"
},
"accessor_12": {
"bufferView": "bufferView_vertex",
"byteOffset": 2112,
"byteStride": 0,
"componentType": 5126,
"count": 24,
"min": [
0,
0
],
"max": [
1,
1
],
"type": "VEC2"
},
"accessor_13": {
"bufferView": "bufferView_index",
"byteOffset": 144,
"byteStride": 0,
"componentType": 5123,
"count": 18,
"min": [
0
],
"max": [
11
],
"type": "SCALAR"
},
"accessor_14": {
"bufferView": "bufferView_index",
"byteOffset": 180,
"byteStride": 0,
"componentType": 5123,
"count": 18,
"min": [
12
],
"max": [
23
],
"type": "SCALAR"
}
},
"asset": {
"generator": "obj2gltf",
"profile": {
"api": "WebGL",
"version": "1.0"
},
"version": "1.0"
},
"buffers": {
"buffer": {
"byteLength": 2520,
"uri": "data:application/octet-stream;base64,AACAvwAAgL8AAIDAAACAvwAAgD8AAIDAAACAvwAAgD8AAMDAAACAvwAAgL8AAMDAAACAvwAAgL8AAMDAAACAvwAAgD8AAMDAAACAPwAAgD8AAMDAAACAPwAAgL8AAMDAAACAPwAAgL8AAMDAAACAPwAAgD8AAMDAAACAPwAAgD8AAIDAAACAPwAAgL8AAIDAAACAPwAAgL8AAIDAAACAPwAAgD8AAIDAAACAvwAAgD8AAIDAAACAvwAAgL8AAIDAAACAvwAAgL8AAMDAAACAPwAAgL8AAMDAAACAPwAAgL8AAIDAAACAvwA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AAAAAACAvwAAAAAAAAAAAACAvwAAAAAAAAAAAACAvwAAAAAAAAAAAAAAAAAAAAAAAIC/AAAAAAAAAAAAAIC/AAAAAAAAAAAAAIC/AAAAAAAAAAAAAIC/AACAPwAAAAAAAAAAAACAPwAAAAAAAAAAAACAPwAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAgL8AAAAAAAAAAAAAgL8AAAAAAAAAAAAAgL8AAAAAAAAAAAAAgL8AAAAAAAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAAAgD8AAIA/AACAPwAAgD8AAAAAAAAAAAAAAAAAAAAAAACAPwAAgD8AAIA/AACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AACAPwAAgD8AAIA/AAAAAAAAAAAAAAAAAAAAAAAAgD8AAIA/AACAPwAAgD8AAAAAAAAAAAAAAAAAAAAAAACAPwAAgD8AAIA/AACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AACAPwAAgD8AAIA/AAAAAAAAAAAAAAAAAAABAAIAAAACAAMABAAFAAYABAAGAAcACAAJAAoACAAKAAsADAANAA4ADAAOAA8AEAARABIAEAASABMAFAAVABYAFAAWABcAAAABAAIAAAACAAMABAAFAAYABAAGAAcACAAJAAoACAAKAAsADAANAA4ADAAOAA8AEAARABIAEAASABMAFAAVABYAFAAWABcAAAABAAIAAAACAAMABAAFAAYABAAGAAcACAAJAAoACAAKAAsADAANAA4ADAAOAA8AEAARABIAEAASABMAFAAVABYAFAAWABcA"
}
},
"bufferViews": {
"bufferView_vertex": {
"buffer": "buffer",
"byteLength": 2304,
"byteOffset": 0,
"target": 34962
},
"bufferView_index": {
"buffer": "buffer",
"byteLength": 216,
"byteOffset": 2304,
"target": 34963
}
},
"extensionsUsed": [
"KHR_materials_common"
],
"images": {},
"materials": {
"Blue": {
"extensions": {
"KHR_materials_common": {
"technique": "PHONG",
"transparent": false,
"doubleSided": false,
"values": {
"ambient": [
0,
0,
0,
1
],
"diffuse": [
0,
0,
0.64,
1
],
"emission": [
0,
0,
0,
1
],
"specular": [
0.5,
0.5,
0.5,
1
],
"shininess": 96.078431,
"transparency": 1,
"transparent": false,
"doubleSided": false
}
}
}
},
"Green": {
"extensions": {
"KHR_materials_common": {
"technique": "PHONG",
"transparent": false,
"doubleSided": false,
"values": {
"ambient": [
0,
0,
0,
1
],
"diffuse": [
0,
0.64,
0,
1
],
"emission": [
0,
0,
0,
1
],
"specular": [
0.5,
0.5,
0.5,
1
],
"shininess": 96.078431,
"transparency": 1,
"transparent": false,
"doubleSided": false
}
}
}
},
"Red": {
"extensions": {
"KHR_materials_common": {
"technique": "PHONG",
"transparent": false,
"doubleSided": false,
"values": {
"ambient": [
0,
0,
0,
1
],
"diffuse": [
0.64,
0,
0,
1
],
"emission": [
0,
0,
0,
1
],
"specular": [
0.5,
0.5,
0.5,
1
],
"shininess": 96.078431,
"transparency": 1,
"transparent": false,
"doubleSided": false
}
}
}
}
},
"meshes": {
"CubeBlue_CubeBlue_Blue": {
"name": "CubeBlue_CubeBlue_Blue",
"primitives": [
{
"attributes": {
"POSITION": "accessor_0",
"NORMAL": "accessor_1",
"TEXCOORD_0": "accessor_2"
},
"indices": "accessor_3",
"material": "Blue",
"mode": 4
},
{
"attributes": {
"POSITION": "accessor_0",
"NORMAL": "accessor_1",
"TEXCOORD_0": "accessor_2"
},
"indices": "accessor_4",
"material": "Green",
"mode": 4
}
]
},
"CubeGreen_CubeGreen_Green": {
"name": "CubeGreen_CubeGreen_Green",
"primitives": [
{
"attributes": {
"POSITION": "accessor_5",
"NORMAL": "accessor_6",
"TEXCOORD_0": "accessor_7"
},
"indices": "accessor_8",
"material": "Green",
"mode": 4
},
{
"attributes": {
"POSITION": "accessor_5",
"NORMAL": "accessor_6",
"TEXCOORD_0": "accessor_7"
},
"indices": "accessor_9",
"material": "Red",
"mode": 4
}
]
},
"CubeRed_CubeRed_Red": {
"name": "CubeRed_CubeRed_Red",
"primitives": [
{
"attributes": {
"POSITION": "accessor_10",
"NORMAL": "accessor_11",
"TEXCOORD_0": "accessor_12"
},
"indices": "accessor_13",
"material": "Red",
"mode": 4
},
{
"attributes": {
"POSITION": "accessor_10",
"NORMAL": "accessor_11",
"TEXCOORD_0": "accessor_12"
},
"indices": "accessor_14",
"material": "Blue",
"mode": 4
}
]
}
},
"nodes": {
"Cube": {
"name": "Cube",
"meshes": [
"CubeBlue_CubeBlue_Blue",
"CubeGreen_CubeGreen_Green",
"CubeRed_CubeRed_Red"
]
}
},
"samplers": {},
"scene": "scene",
"scenes": {
"scene": {
"nodes": [
"Cube"
]
}
},
"textures": {}
}

View File

@ -1,178 +0,0 @@
{
"accessors": {
"accessor_0": {
"bufferView": "bufferView_vertex",
"byteOffset": 0,
"byteStride": 0,
"componentType": 5126,
"count": 24,
"min": [
-1,
-1,
-1
],
"max": [
1,
1,
1
],
"type": "VEC3"
},
"accessor_1": {
"bufferView": "bufferView_vertex",
"byteOffset": 288,
"byteStride": 0,
"componentType": 5126,
"count": 24,
"min": [
-1,
-1,
-1
],
"max": [
1,
1,
1
],
"type": "VEC3"
},
"accessor_2": {
"bufferView": "bufferView_vertex",
"byteOffset": 576,
"byteStride": 0,
"componentType": 5126,
"count": 24,
"min": [
0,
0
],
"max": [
1,
1
],
"type": "VEC2"
},
"accessor_3": {
"bufferView": "bufferView_index",
"byteOffset": 0,
"byteStride": 0,
"componentType": 5123,
"count": 36,
"min": [
0
],
"max": [
23
],
"type": "SCALAR"
}
},
"asset": {
"generator": "obj2gltf",
"profile": {
"api": "WebGL",
"version": "1.0"
},
"version": "1.0"
},
"buffers": {
"buffer": {
"byteLength": 840,
"uri": "data:application/octet-stream;base64,AACAvwAAgL8AAIA/AACAvwAAgD8AAIA/AACAvwAAgD8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgD8AAIC/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"byteOffset": 0,
"target": 34962
},
"bufferView_index": {
"buffer": "buffer",
"byteLength": 72,
"byteOffset": 768,
"target": 34963
}
},
"extensionsUsed": [
"KHR_materials_common"
],
"images": {},
"materials": {
"Material": {
"extensions": {
"KHR_materials_common": {
"technique": "PHONG",
"transparent": false,
"doubleSided": false,
"values": {
"ambient": [
0,
0,
0,
1
],
"diffuse": [
0.64,
0.64,
0.64,
1
],
"emission": [
0,
0,
0,
1
],
"specular": [
0.5,
0.5,
0.5,
1
],
"shininess": 96.078431,
"transparency": 1,
"transparent": false,
"doubleSided": false
}
}
}
}
},
"meshes": {
"Cube-Mesh": {
"name": "Cube-Mesh",
"primitives": [
{
"attributes": {
"POSITION": "accessor_0",
"NORMAL": "accessor_1",
"TEXCOORD_0": "accessor_2"
},
"indices": "accessor_3",
"material": "Material",
"mode": 4
}
]
}
},
"nodes": {
"Cube": {
"name": "Cube",
"meshes": [
"Cube-Mesh"
]
}
},
"samplers": {},
"scene": "scene",
"scenes": {
"scene": {
"nodes": [
"Cube"
]
}
},
"textures": {}
}

View File

@ -1,22 +1,17 @@
'use strict';
var Cesium = require('cesium');
var fsExtra = require('fs-extra');
var path = require('path');
var Promise = require('bluebird');
var obj2gltf = require('../../lib/obj2gltf');
var createGltf = require('../../lib/createGltf');
var loadImage = require('../../lib/loadImage');
var loadObj = require('../../lib/loadObj');
var Material = require('../../lib/Material');
var writeUris = require('../../lib/writeUris');
var clone = Cesium.clone;
var WebGLConstants = Cesium.WebGLConstants;
var boxObjUrl = 'specs/data/box/box.obj';
var groupObjUrl = 'specs/data/box-objects-groups-materials/box-objects-groups-materials.obj';
var boxGltfUrl = 'specs/data/box/box.gltf';
var groupGltfUrl = 'specs/data/box-objects-groups-materials/box-objects-groups-materials.gltf';
var diffuseTextureUrl = 'specs/data/box-textured/cesium.png';
var transparentDiffuseTextureUrl = 'specs/data/box-complex-material/diffuse.png';
@ -28,8 +23,6 @@ describe('createGltf', function() {
var boxObjData;
var duplicateBoxObjData;
var groupObjData;
var boxGltf;
var groupGltf;
var diffuseTexture;
var transparentDiffuseTexture;
@ -47,14 +40,6 @@ describe('createGltf', function() {
.then(function(data) {
groupObjData = data;
}),
fsExtra.readJson(boxGltfUrl)
.then(function(gltf) {
boxGltf = gltf;
}),
fsExtra.readJson(groupGltfUrl)
.then(function(gltf) {
groupGltf = gltf;
}),
loadImage(diffuseTextureUrl, defaultOptions)
.then(function(image) {
diffuseTexture = image;
@ -66,20 +51,31 @@ describe('createGltf', function() {
]).then(done);
});
it('simple gltf', function(done) {
it('simple gltf', function() {
var gltf = createGltf(boxObjData, defaultOptions);
expect(writeUris(gltf, boxGltfUrl, path.dirname(boxGltfUrl), defaultOptions)
.then(function() {
expect(gltf).toEqual(boxGltf);
}), done).toResolve();
expect(Object.keys(gltf.materials).length).toBe(1);
expect(Object.keys(gltf.nodes).length).toBe(1);
expect(Object.keys(gltf.meshes).length).toBe(1);
var primitives = gltf.meshes['Cube-Mesh'].primitives;
var primitive = primitives[0];
var attributes = primitive.attributes;
var positionAccessor = gltf.accessors[attributes.POSITION];
var normalAccessor = gltf.accessors[attributes.NORMAL];
var uvAccessor = gltf.accessors[attributes.TEXCOORD_0];
var indexAccessor = gltf.accessors[primitive.indices];
expect(primitives.length).toBe(1);
expect(positionAccessor.count).toBe(24);
expect(normalAccessor.count).toBe(24);
expect(uvAccessor.count).toBe(24);
expect(indexAccessor.count).toBe(36);
});
it('multiple nodes, meshes, and primitives', function(done) {
it('multiple nodes, meshes, and primitives', function() {
var gltf = createGltf(groupObjData, defaultOptions);
expect(writeUris(gltf, groupGltfUrl, path.dirname(groupGltfUrl), defaultOptions)
.then(function() {
expect(gltf).toEqual(groupGltf);
expect(Object.keys(gltf.materials).length).toBe(3);
expect(Object.keys(gltf.nodes).length).toBe(1);
expect(Object.keys(gltf.meshes).length).toBe(3);
@ -91,7 +87,6 @@ describe('createGltf', function() {
expect(mesh.primitives.length).toBe(2);
}
}
}), done).toResolve();
});
it('sets default material values', function() {