aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-10-01 13:07:31 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-10-02 12:48:59 +0000
commitbfaa08a335f21e6fdf533969779f806883fe27b0 (patch)
tree2f6ff3425b6ae74670a46922c51a7cb779508693 /tests
parenteb7bf1825ede649ae35ebec91ef430686ae2c70a (diff)
Fix QQuickToolTip's delay and visibility
The imperative open() and close() methods used to be the only ways to open and close popups, but the visible-property was later made writable to allow declarative visibility bindings. Since then, it is no longer sufficient for QQuickToolTip to overshadow open() and close() in QML, because setting the visible-property would bypass these overshadowed method. There was a bit of duplicate code between setVisible(), open(), and close(). This change moves the logic to one place by changing open() and close() to call setVisible(). Furthermore, setVisible() has been made virtual to make it possible for QQuickToolTip to apply its delay properly. QQuickToolTip needs to control the delay and timeout timers before the effective visibility is applied on the popup. Task-number: QTBUG-55572 Change-Id: I5a109157f9ec5d0db145e710426665a9a8d7e870 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_tooltip.qml25
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml
index 82ad01f1..c78a7770 100644
--- a/tests/auto/controls/data/tst_tooltip.qml
+++ b/tests/auto/controls/data/tst_tooltip.qml
@@ -156,8 +156,10 @@ TestCase {
function test_delay_data() {
return [
- {tag: "0", delay: 0},
- {tag: "100", delay: 100},
+ {tag: "imperative:0", delay: 0, imperative: true},
+ {tag: "imperative:100", delay: 100, imperative: true},
+ {tag: "declarative:0", delay: 0, imperative: false},
+ {tag: "declarative:100", delay: 100, imperative: false}
]
}
@@ -165,18 +167,31 @@ TestCase {
var control = toolTip.createObject(testCase, {delay: data.delay})
compare(control.visible, false)
- control.open()
+ if (data.imperative)
+ control.open()
+ else
+ control.visible = true
compare(control.visible, data.delay <= 0)
tryCompare(control, "visible", true)
control.destroy()
}
- function test_timeout() {
+ function test_timeout_data() {
+ return [
+ {tag: "imperative", imperative: true},
+ {tag: "declarative", imperative: false}
+ ]
+ }
+
+ function test_timeout(data) {
var control = toolTip.createObject(testCase, {timeout: 100})
compare(control.visible, false)
- control.open()
+ if (data.imperative)
+ control.open()
+ else
+ control.visible = true
compare(control.visible, true)
tryCompare(control, "visible", false)