tests-karma.js 1.6 KB

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