From ab2c59b80e6d44e21688de2c4f980f7edab75e32 Mon Sep 17 00:00:00 2001 From: Meng Wang Date: Sun, 31 May 2020 01:33:17 +0800 Subject: [PATCH] Merge pull request #17403 from wangmengHB:master Fix Test Case: in latest version, window.cv is a promise instance that makes most test case failed. * Fix Browser Test Case: In latest version, window.cv is a promise instance In latest version of opencv.js, window.cv is promise instance. So that most of the test cases is run failed. This commit is to fix browser test case. * Add comment for backward compatible Add comments for backward compatible --- modules/js/test/tests.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/js/test/tests.html b/modules/js/test/tests.html index dd644f0569..39205b6db6 100644 --- a/modules/js/test/tests.html +++ b/modules/js/test/tests.html @@ -49,8 +49,17 @@ postRun: [] , onRuntimeInitialized: function() { console.log("Emscripten runtime is ready, launching QUnit tests..."); - //console.log(cv.getBuildInformation()); - QUnit.start(); + if (window.cv instanceof Promise) { + window.cv.then((target) => { + window.cv = target; + //console.log(cv.getBuildInformation()); + QUnit.start(); + }) + } else { + // for backward compatible + // console.log(cv.getBuildInformation()); + QUnit.start(); + } }, print: (function() { var element = document.getElementById('output');