summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qmltests/data/tst_titleChanged.qml
blob: 66a7c115f79a55d023e4428b3dfc556e1cc10192 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

import QtQuick
import QtTest
import QtWebEngine

TestWebEngineView {
    id: webEngineView
    width: 400
    height: 300


    SignalSpy {
        id: spyTitle
        target: webEngineView
        signalName: "titleChanged"
    }


    TestCase {
        name: "WebEngineViewTitleChangedSignal"

        function test_titleFirstLoad() {
            compare(spyTitle.count, 0)

            var testUrl = Qt.resolvedUrl("test3.html")
            webEngineView.url = testUrl
            spyTitle.wait()
            if (webEngineView.title == "test3.html") {
                // This title may be emitted during loading
                spyTitle.clear()
                spyTitle.wait()
            }
            compare(webEngineView.title, "Test page 3")
            spyTitle.clear()
            spyTitle.wait()
            compare(webEngineView.title, "New Title")
        }
    }
}