Skip to content

Commit ab2c59b

Browse files
authored
Merge pull request opencv#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
1 parent c6b60e2 commit ab2c59b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

modules/js/test/tests.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,17 @@
4949
postRun: [] ,
5050
onRuntimeInitialized: function() {
5151
console.log("Emscripten runtime is ready, launching QUnit tests...");
52-
//console.log(cv.getBuildInformation());
53-
QUnit.start();
52+
if (window.cv instanceof Promise) {
53+
window.cv.then((target) => {
54+
window.cv = target;
55+
//console.log(cv.getBuildInformation());
56+
QUnit.start();
57+
})
58+
} else {
59+
// for backward compatible
60+
// console.log(cv.getBuildInformation());
61+
QUnit.start();
62+
}
5463
},
5564
print: (function() {
5665
var element = document.getElementById('output');

0 commit comments

Comments
 (0)