diff options
Diffstat (limited to 'tests/manual/wasm/qtloader')
-rw-r--r-- | tests/manual/wasm/qtloader/tst_qtloader.html | 19 | ||||
-rw-r--r-- | tests/manual/wasm/qtloader/tst_qtloader.js | 42 |
2 files changed, 61 insertions, 0 deletions
diff --git a/tests/manual/wasm/qtloader/tst_qtloader.html b/tests/manual/wasm/qtloader/tst_qtloader.html new file mode 100644 index 0000000000..c85bccc68d --- /dev/null +++ b/tests/manual/wasm/qtloader/tst_qtloader.html @@ -0,0 +1,19 @@ +<!-- +Copyright (C) 2022 The Qt Company Ltd. +SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +--> + +<!doctype html> +<html> + +<head> + <meta charset="utf-8"> + <title>Qt Loader tests</title> + <script type="text/javascript" src="https://sinonjs.org/releases/sinon-14.0.0.js" + integrity="sha384-z8J4N1s2hPDn6ClmFXDQkKD/e738VOWcR8JmhztPRa+PgezxQupgZu3LzoBO4Jw8" + crossorigin="anonymous"></script> + <script src="/src/plugins/platforms/wasm/qtloader.js"></script> + <script src="tst_qtloader.js" type="module" defer></script> +</head> +<body></body> +</html> diff --git a/tests/manual/wasm/qtloader/tst_qtloader.js b/tests/manual/wasm/qtloader/tst_qtloader.js new file mode 100644 index 0000000000..39e0d12807 --- /dev/null +++ b/tests/manual/wasm/qtloader/tst_qtloader.js @@ -0,0 +1,42 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import { TestRunner } from '../shared/testrunner.js'; + +class QtLoaderTests +{ + async beforeEach() { sinon.stub(window, 'alert'); } + + async afterEach() { sinon.restore(); } + + async sampleTestCase() + { + await new Promise(resolve => + { + window.alert(); + sinon.assert.calledOnce(window.alert); + window.setTimeout(resolve, 4000); + }); + } + + async sampleTestCase2() + { + await new Promise(resolve => + { + window.alert(); + sinon.assert.calledOnce(window.alert); + window.setTimeout(resolve, 1000); + }); + } + + async constructQtLoader() + { + new QtLoader({}); + } +} + +(async () => +{ + const runner = new TestRunner(new QtLoaderTests()); + await runner.runAll(); +})(); |