aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_tooltip.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-08-17 19:30:25 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-08-19 14:39:39 +0000
commit449a655fd7c1b049ea2cc57033987a2556aadcd8 (patch)
tree5cc169fd4171b4e4580baa7dd4644a9e7b87a411 /tests/auto/controls/data/tst_tooltip.qml
parent62646977131f0bd591d9a0dc077f44386f10ad17 (diff)
Fix attached ToolTip properties
The attached properties should apply to the shared/global tooltip instance only when the shared tooltip is visible for the attachee item. Task-number: QTBUG-55347 Change-Id: Ia822f2d1de62d2d6dfb28519817edce674d8c2b8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_tooltip.qml')
-rw-r--r--tests/auto/controls/data/tst_tooltip.qml25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml
index fb9ffdc3..04064fa1 100644
--- a/tests/auto/controls/data/tst_tooltip.qml
+++ b/tests/auto/controls/data/tst_tooltip.qml
@@ -118,6 +118,11 @@ TestCase {
var spy2 = signalSpy.createObject(item2, {target: item2.ToolTip, signalName: data.signalName})
verify(spy2.valid)
+ var sharedTip = ToolTip.toolTip
+ var sharedSpy = signalSpy.createObject(testCase, {target: sharedTip, signalName: data.signalName})
+ verify(sharedSpy.valid)
+
+ // change attached properties while the shared tooltip is not visible
item1.ToolTip[data.property] = data.setValue
compare(item1.ToolTip[data.property], data.setValue)
compare(spy1.count, 1)
@@ -125,6 +130,26 @@ TestCase {
compare(spy2.count, 0)
compare(item2.ToolTip[data.property], data.defaultValue)
+ // the shared tooltip is not visible for item1, so the attached
+ // property change should therefore not apply to the shared instance
+ compare(sharedSpy.count, 0)
+ compare(sharedTip[data.property], data.defaultValue)
+
+ // show the shared tooltip for item2
+ item2.ToolTip.visible = true
+ verify(item2.ToolTip.visible)
+ verify(sharedTip.visible)
+
+ // change attached properties while the shared tooltip is visible
+ item2.ToolTip[data.property] = data.setValue
+ compare(item2.ToolTip[data.property], data.setValue)
+ compare(spy2.count, 1)
+
+ // the shared tooltip is visible for item2, so the attached
+ // property change should apply to the shared instance
+ compare(sharedSpy.count, 1)
+ compare(sharedTip[data.property], data.setValue)
+
item1.destroy()
item2.destroy()
}