summaryrefslogtreecommitdiffstats
path: root/tests/manual/wasm/qtloader/tst_qtloader.js
blob: 39e0d128075b168f48a617e71ea70ed6133ba219 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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();
})();