diff --git a/test/testfiles/obj/rectangle_with_texture.mtl b/test/testfiles/obj/rectangle_with_texture.mtl new file mode 100644 index 0000000..a6f4d35 --- /dev/null +++ b/test/testfiles/obj/rectangle_with_texture.mtl @@ -0,0 +1,5 @@ +newmtl Material +Ka 0.000000 0.000000 0.000000 +Kd 1.000000 1.000000 1.000000 +Ks 0.000000 0.000000 0.000000 +map_Kd texture.png diff --git a/test/testfiles/obj/rectangle_with_texture.obj b/test/testfiles/obj/rectangle_with_texture.obj new file mode 100644 index 0000000..9cf04e6 --- /dev/null +++ b/test/testfiles/obj/rectangle_with_texture.obj @@ -0,0 +1,15 @@ +mtllib rectangle_with_texture.mtl + +v 0.0 0.0 0.0 +v 1.0 0.0 0.0 +v 1.0 1.0 0.0 +v 0.0 1.0 0.0 +vn 0.0 0.0 1.0 +vt 0.0 0.0 +vt 1.0 0.0 +vt 1.0 1.0 +vt 0.0 1.0 + +o Mesh +usemtl Material +f 1/1/1 2/2/1 3/3/1 4/4/1 diff --git a/test/testfiles/obj/texture.png b/test/testfiles/obj/texture.png new file mode 100644 index 0000000..29ce540 Binary files /dev/null and b/test/testfiles/obj/texture.png differ diff --git a/test/tests/importerobj_test.js b/test/tests/importerobj_test.js index 03cbce4..69715aa 100644 --- a/test/tests/importerobj_test.js +++ b/test/tests/importerobj_test.js @@ -374,6 +374,36 @@ describe ('Obj Importer', function() { }); }); + it ('rectangle_with_texture.obj', function () { + var model = testFiles.ImportObjFile ('rectangle_with_texture.obj'); + assert (OV.CheckModel (model)); + assert.deepStrictEqual (testUtils.ModelToObject (model), { + name : '', + materials : [ + { name : 'Material' } + ], + meshes : [ + { + name : 'Mesh', + triangles : [ + { + vertices : [0, 0, 0, 1, 0, 0, 1, 1, 0], + normals : [0, 0, 1, 0, 0, 1, 0, 0, 1], + uvs : [0, 0, 1, 0, 1, 1], + mat : 0 + }, + { + vertices : [0, 0, 0, 1, 1, 0, 0, 1, 0], + normals : [0, 0, 1, 0, 0, 1, 0, 0, 1], + uvs : [0, 0, 1, 1, 0, 1], + mat : 0 + } + ] + } + ] + }); + }); + it ('cube_with_materials.obj', function () { var model = testFiles.ImportObjFile ('cube_with_materials.obj'); assert (OV.CheckModel (model));