From 222775d21e6cfecf43aa1763d34e453a7dc260f1 Mon Sep 17 00:00:00 2001 From: Pierre Lepers Date: Thu, 28 Mar 2024 15:56:45 +0100 Subject: [PATCH] bump to 0.2.1 add test for scene parsing --- package.json | 2 +- test/scene_test.ts | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 test/scene_test.ts diff --git a/package.json b/package.json index b7531a3..a5be06a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nanogl-gltf", - "version": "0.2.0", + "version": "0.2.1", "description": "gltf loader", "scripts": { "test": "karma start", diff --git a/test/scene_test.ts b/test/scene_test.ts new file mode 100644 index 0000000..ed0705a --- /dev/null +++ b/test/scene_test.ts @@ -0,0 +1,46 @@ +import expect from 'expect.js'; +import Gltf from '../src/Gltf'; +import WebGltfIO from '../src/io/web'; +import GltfTypes from '../src/types/GltfTypes'; + + +describe("Animation Sampler", function () { + + let gltf :Gltf; + + before(function () { + return WebGltfIO.loadGltf('samples/other/khronos/lights.gltf').then( res=>gltf=res ) + }); + + + + describe("scene access", function () { + + it("with getElement", function () { + expect( gltf.getElement( GltfTypes.SCENE, 0 ) ).to.be.ok() + }) + + it("with scenes", function () { + expect( gltf.scenes.length ).to.be(1) + }) + + }) + + describe("scene is ok", function () { + + + it("scene name is set", function () { + expect( gltf.scenes[0].name ).to.be("scene") + }); + + it("scene has 3 nodes", function () { + expect( gltf.scenes[0].nodes.length ).to.be(3) + }); + + it("scene second node is ok", function () { + expect( gltf.scenes[0].nodes[1].name ).to.be("directional_light") + }); + + }); + +});