Added a unit test

This commit is contained in:
Sean Lilley 2016-07-11 12:27:15 -04:00
parent 29fa71fe2b
commit ddd99ea33d
5 changed files with 381 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,13 @@
# Blender MTL File: 'BoxTextured.blend'
# Material Count: 1
newmtl Textured
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd CesiumLogoFlat.png

View File

@ -0,0 +1,46 @@
# Blender v2.77 (sub 0) OBJ File: 'BoxTextured.blend'
# www.blender.org
mtllib BoxTextured.mtl
o Cube_Cube.001
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 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.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 Textured
s off
f 2/1/1 4/2/1 3/3/1 1/4/1
f 4/5/2 8/6/2 7/7/2 3/8/2
f 8/9/3 6/10/3 5/11/3 7/12/3
f 6/13/4 2/14/4 1/15/4 5/16/4
f 1/17/5 3/18/5 7/7/5 5/16/5
f 6/13/6 8/6/6 4/19/6 2/20/6

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

20
specs/lib/convertSpec.js Normal file
View File

@ -0,0 +1,20 @@
'use strict';
var fs = require('fs');
var path = require('path');
var convert = require('../../lib/convert');
var objFile = './specs/data/BoxTextured/BoxTextured.obj';
var gltfFile = './specs/data/BoxTextured/BoxTextured.gltf';
describe('convert', function() {
it('converts an obj to gltf', function(done) {
var spy = spyOn(fs, 'writeFile').and.callFake(function(file, data, callback) {
callback();
});
convert(objFile, gltfFile, {}, function() {
expect(path.normalize(spy.calls.first().args[0])).toEqual(path.normalize(gltfFile));
done();
});
});
});