summaryrefslogtreecommitdiff
path: root/tests/auto/qml/resources/tst_resource.qml
blob: 271c92686703789626d5c41d8b18afb328c42117 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick 2.11
import QtTest 1.0
import QtApplicationManager.SystemUI 2.0
import widgets 1.0

TestCase {
    id: testCase
    when: windowShown
    name: "ResourceTest"

    RedRect {}
    MagentaRect {}

    SignalSpy {
        id: runStateChangedSpy
        target: ApplicationManager
        signalName: "applicationRunStateChanged"
    }

    SignalSpy {
        id: windowPropertyChangedSpy
        target: WindowManager
        signalName: "windowPropertyChanged"
    }

    function test_basic_data() {
        return [ { tag: "app1" },
                 { tag: "app2" } ];
    }

    function test_basic(data) {
        wait(1200 * AmTest.timeoutFactor);    // wait for quicklaunch

        var app = ApplicationManager.application(data.tag);
        windowPropertyChangedSpy.clear();

        app.start();
        while (app.runState !== ApplicationObject.Running)
            runStateChangedSpy.wait(3000 * AmTest.timeoutFactor);

        if (data.tag === "app2") {
            windowPropertyChangedSpy.wait(2000 * AmTest.timeoutFactor);
            compare(windowPropertyChangedSpy.count, 1);
            compare(windowPropertyChangedSpy.signalArguments[0][0].windowProperty("meaning"), 42);
        }

        app.stop();
        while (app.runState !== ApplicationObject.NotRunning)
            runStateChangedSpy.wait(3000 * AmTest.timeoutFactor);
    }
}