blob: 089d1d96202b598081f6aee57f1ef649496d318e (
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.13
import QtTest 1.13
import Test 1.0
TestCase {
id: testCase
name: "polish-qml"
when: windowShown
Component {
id: customItemComponent
CustomItem {}
}
function test_polish() {
let item = createTemporaryObject(customItemComponent, testCase)
verify(item)
// Test item polish API.
item.polishMe()
verify(isPolishScheduled(item))
verify(item.isPolishScheduled())
verify(!item.wasUpdatePolishCalled())
verify(waitForPolish(item))
verify(item.wasUpdatePolishCalled())
// TODO: test failure conditions when https://bugreports.qt.io/browse/QTBUG-72351 is fixed
// expectFail("", "Not a valid item")
// isPolishScheduled(null)
// Test window polish API.
let window = Window.window
item.clearUpdatePolishCalled()
item.polishMe()
verify(isPolishScheduled(window))
verify(item.isPolishScheduled())
verify(!item.wasUpdatePolishCalled())
verify(waitForPolish(window))
verify(item.wasUpdatePolishCalled())
}
Component {
id: customChildItemComponent
Item {
CustomItem {}
}
}
function test_childPolish() {
let root = createTemporaryObject(customChildItemComponent, testCase)
verify(root)
let child = root.children[0]
verify(child)
// Test item polish API.
child.polishMe()
verify(isPolishScheduled(child))
verify(child.isPolishScheduled())
verify(!child.wasUpdatePolishCalled())
verify(waitForPolish(child))
verify(child.wasUpdatePolishCalled())
// TODO: test failure conditions when https://bugreports.qt.io/browse/QTBUG-72351 is fixed
// expectFail("", "Not a valid item")
// isPolishScheduled(null)
// Test window polish API.
let window = Window.window
child.clearUpdatePolishCalled()
child.polishMe()
verify(isPolishScheduled(window))
verify(child.isPolishScheduled())
verify(!child.wasUpdatePolishCalled())
verify(waitForPolish(window))
verify(child.wasUpdatePolishCalled())
}
}
|