tests-karma.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. function runTests(testType, BABYLON, GUI, INSPECTOR) {
  2. console.log("running tests");
  3. describe(testType + ' module tests', function () {
  4. it("should have the dependencies loaded", function () {
  5. assert.isDefined(BABYLON);
  6. assert.isDefined(GUI);
  7. assert.isDefined(BABYLON.GLTF2);
  8. })
  9. var subject;
  10. /**
  11. * Create a nu engine subject before each test.
  12. */
  13. beforeEach(function () {
  14. subject = new BABYLON.NullEngine({
  15. renderHeight: 256,
  16. renderWidth: 256,
  17. textureSize: 256,
  18. deterministicLockstep: false,
  19. lockstepMaxSteps: 1
  20. });
  21. });
  22. /**
  23. * This test is more an integration test than a regular unit test but highlights how to rely
  24. * on the BABYLON.NullEngine in order to create complex test cases.
  25. */
  26. describe('#GLTF', function () {
  27. it('should load BoomBox GLTF', function (done) {
  28. mocha.timeout(10000);
  29. var scene = new BABYLON.Scene(subject);
  30. BABYLON.SceneLoader.Append("/Playground/scenes/BoomBox/", "BoomBox.gltf", scene, function () {
  31. scene.meshes.length.should.be.equal(2);
  32. scene.materials.length.should.be.equal(1);
  33. scene.multiMaterials.length.should.be.equal(0);
  34. done();
  35. });
  36. });
  37. });
  38. });
  39. }