tests-karma.js 1.7 KB

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