tests-karma.js 1.6 KB

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