浏览代码

memory checks

David Catuhe 7 年之前
父节点
当前提交
70db9c4f8f
共有 2 个文件被更改,包括 20 次插入10 次删除
  1. 6 0
      tests/memoryChecks/index.js
  2. 14 10
      tests/validation/validation.js

+ 6 - 0
tests/memoryChecks/index.js

@@ -1,5 +1,6 @@
 BABYLONDEVTOOLS.Loader.require('../validation/validation.js')
 .load(function() {
+    var needInit = false;
     document.getElementById("run").addEventListener("click", function() {
         // Loading tests
         var xhr = new XMLHttpRequest();
@@ -14,6 +15,10 @@ BABYLONDEVTOOLS.Loader.require('../validation/validation.js')
                 // Run tests
                 var index = 0;
 
+                if (needInit) {
+                    init();
+                }
+
                 var title = document.getElementById("sceneName").value.toLowerCase();
                 for (var index = 0; index < config.tests.length; index++) {
                     if (config.tests[index].title.toLowerCase() === title) {
@@ -23,6 +28,7 @@ BABYLONDEVTOOLS.Loader.require('../validation/validation.js')
 
                 runTest(index, function() {
                     BABYLON.Engine.LastCreatedEngine.dispose();
+                    needInit = true;
                 });
             }
         }, false);

+ 14 - 10
tests/validation/validation.js

@@ -309,13 +309,17 @@ function runTest(index, done) {
     }
 }
 
-BABYLON.SceneLoader.ShowLoadingScreen = false;
-BABYLON.Database.IDBStorageEnabled = false;
-BABYLON.SceneLoader.ForceFullSceneLoadingForIncremental = true;
-BABYLON.DracoCompression.DecoderUrl = BABYLON.Tools.GetFolderPath(document.location.href) + "../../dist/preview%20release/draco_decoder.js";
-
-canvas = document.createElement("canvas");
-canvas.className = "renderCanvas";
-document.body.appendChild(canvas);
-engine = new BABYLON.Engine(canvas, false);
-engine.setDitheringState(false);
+function init() {
+    BABYLON.SceneLoader.ShowLoadingScreen = false;
+    BABYLON.SceneLoader.ForceFullSceneLoadingForIncremental = true;
+    BABYLON.DracoCompression.DecoderUrl = BABYLON.Tools.GetFolderPath(document.location.href) + "../../dist/preview%20release/draco_decoder.js";
+
+    canvas = document.createElement("canvas");
+    canvas.className = "renderCanvas";
+    document.body.appendChild(canvas);
+    engine = new BABYLON.Engine(canvas, false);
+    engine.enableOfflineSupport = false;
+    engine.setDitheringState(false);
+}
+
+init();