From a392ea673a486be04bebe0e04d291ffeecccb253 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 13 Nov 2024 13:44:41 -0500 Subject: [PATCH] update to help tests pass --- src/webgldrawer.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/webgldrawer.js b/src/webgldrawer.js index 7e9de15a..8b071d4c 100644 --- a/src/webgldrawer.js +++ b/src/webgldrawer.js @@ -111,7 +111,7 @@ this.context = this._outputContext; // API required by tests this._requiresCanvasDrawerFallback = false; - this._doRenderingTest(); + setTimeout(() => this._doRenderingTest(), 0); // defer this to the next event loop for tests } // Public API required by all Drawer implementations @@ -1335,6 +1335,10 @@ * @returns */ _doRenderingTest(){ + // Don't do the test if this drawer has already been destroyed + if( this._destroyed ){ + return; + } // Avoid infinite call stack by only testing once if( testing ){ return; @@ -1362,7 +1366,7 @@ testing = false; // Clean up the test viewer when the main viewer is destroyed (if it hasn't been already) - testViewer.addOnceHandler('before-destroy', () => { + this.viewer.addOnceHandler('before-destroy', () => { testViewer.destroy(); if(div.parentNode){ div.parentNode.removeChild(div);