summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qmltests/data/tst_activeFocusOnPress.qml
blob: 77968f6b63703800b0f38937873d9ec7f8d04910 (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
// 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

Item {
    id: root
    width: 300
    height: 400
    TextInput {
        id: textInput
        anchors {
            top: parent.top
            left: parent.left
            right: parent.right
        }
        focus: true
        text: "foo"
    }

    TestWebEngineView {
        id: webEngineView
        activeFocusOnPress: false
        anchors {
            top: textInput.bottom
            left: parent.left
            right: parent.right
            bottom: parent.bottom
        }

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

            function test_activeFocusOnPress() {
                textInput.forceActiveFocus()
                verify(textInput.activeFocus)
                mouseClick(root, 150, 300, Qt.LeftButton)
                verify(textInput.activeFocus)
            }
        }
    }
}