mirror of https://github.com/CesiumGS/obj2gltf.git
Added test
This commit is contained in:
parent
485645e0b9
commit
6849149520
|
@ -0,0 +1,12 @@
|
||||||
|
# Blender MTL File: 'None'
|
||||||
|
# Material Count: 1
|
||||||
|
|
||||||
|
newmtl Material
|
||||||
|
Ns 96.078431
|
||||||
|
Ka 0.100000 0.000000 0.000000
|
||||||
|
Kd 0.640000 0.640000 0.640000
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.000000 0.000000 0.100000
|
||||||
|
Ni 1.000000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
|
@ -0,0 +1,46 @@
|
||||||
|
# Blender v2.78 (sub 0) OBJ File: ''
|
||||||
|
# www.blender.org
|
||||||
|
mtllib box-mixed-attributes.mtl
|
||||||
|
o Cube
|
||||||
|
v -1.000000 -1.000000 1.000000
|
||||||
|
v -1.000000 1.000000 1.000000
|
||||||
|
v -1.000000 -1.000000 -1.000000
|
||||||
|
v -1.000000 1.000000 -1.000000
|
||||||
|
v 1.000000 -1.000000 1.000000
|
||||||
|
v 1.000000 1.000000 1.000000
|
||||||
|
v 1.000000 -1.000000 -1.000000
|
||||||
|
v 1.000000 1.000000 -1.000000
|
||||||
|
vt 0.0000 0.0000
|
||||||
|
vt 1.0000 0.0000
|
||||||
|
vt 1.0000 1.0000
|
||||||
|
vt 0.0000 1.0000
|
||||||
|
vt 0.0000 0.0000
|
||||||
|
vt 1.0000 0.0000
|
||||||
|
vt 1.0000 1.0000
|
||||||
|
vt 0.0000 1.0000
|
||||||
|
vt 0.0000 0.0000
|
||||||
|
vt 1.0000 0.0000
|
||||||
|
vt 1.0000 1.0000
|
||||||
|
vt 0.0000 1.0000
|
||||||
|
vt 0.0000 0.0000
|
||||||
|
vt 1.0000 0.0000
|
||||||
|
vt 1.0000 1.0000
|
||||||
|
vt 0.0000 1.0000
|
||||||
|
vt 1.0000 0.0000
|
||||||
|
vt 1.0000 1.0000
|
||||||
|
vt 0.0000 0.0000
|
||||||
|
vt 0.0000 1.0000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||||
|
f 3 4 8 7
|
||||||
|
f 7/9/3 8/10/3 6/11/3 5/12/3
|
||||||
|
f 5/13/4 6/14/4 2/15/4 1/16/4
|
||||||
|
f 3//5 7//5 5//5 1//5
|
||||||
|
f 8/19 4/6 2/15 6/20
|
|
@ -32,6 +32,7 @@ var objMissingTextureUrl = 'specs/data/box-missing-texture/box-missing-texture.o
|
||||||
var objSubdirectoriesUrl = 'specs/data/box-subdirectories/box-textured.obj';
|
var objSubdirectoriesUrl = 'specs/data/box-subdirectories/box-textured.obj';
|
||||||
var objWindowsPathsUrl = 'specs/data/box-windows-paths/box-windows-paths.obj';
|
var objWindowsPathsUrl = 'specs/data/box-windows-paths/box-windows-paths.obj';
|
||||||
var objComplexMaterialUrl = 'specs/data/box-complex-material/box-complex-material.obj';
|
var objComplexMaterialUrl = 'specs/data/box-complex-material/box-complex-material.obj';
|
||||||
|
var objMixedAttributesUrl = 'specs/data/box-mixed-attributes/box-mixed-attributes.obj';
|
||||||
var objInvalidContentsUrl = 'specs/data/box/box.mtl';
|
var objInvalidContentsUrl = 'specs/data/box/box.mtl';
|
||||||
var objInvalidUrl = 'invalid.obj';
|
var objInvalidUrl = 'invalid.obj';
|
||||||
|
|
||||||
|
@ -409,6 +410,14 @@ describe('loadObj', function() {
|
||||||
}), done).toResolve();
|
}), done).toResolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('discards faces that don\'t use the same attributes as other faces in the primitive', function(done) {
|
||||||
|
expect(loadObj(objMixedAttributesUrl, defaultOptions)
|
||||||
|
.then(function(data) {
|
||||||
|
var primitive = getPrimitives(data)[0];
|
||||||
|
expect(primitive.indices.length).toBe(18); // 3 faces removed
|
||||||
|
}), done).toResolve();
|
||||||
|
});
|
||||||
|
|
||||||
it('throws when file has invalid contents', function(done) {
|
it('throws when file has invalid contents', function(done) {
|
||||||
expect(loadObj(objInvalidContentsUrl, defaultOptions), done).toRejectWith(RuntimeError);
|
expect(loadObj(objInvalidContentsUrl, defaultOptions), done).toRejectWith(RuntimeError);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue