aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2017-05-26 15:02:50 +0200
committerMitch Curtis <mitch.curtis@qt.io>2017-06-28 14:49:28 +0000
commit38df72713c4c4c5b4aae93ac5bcb92b86d380a8f (patch)
tree0c9a50ae7d6d15ac04e8a314ccfdd5c1e5a1280c /tests
parent037fe9c5c9214f682e6a91c3f8a359770488b030 (diff)
Fix tooltips to not block shortcuts
Task-number: QTBUG-60492 Change-Id: Ic1f380f44593d4a8681bff874789692d17b9edf7 Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_tooltip.qml38
1 files changed, 37 insertions, 1 deletions
diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml
index 66fb50c1..c7973c69 100644
--- a/tests/auto/controls/data/tst_tooltip.qml
+++ b/tests/auto/controls/data/tst_tooltip.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.4
+import QtQuick 2.9
import QtTest 1.0
import QtQuick.Controls 2.2
@@ -258,4 +258,40 @@ TestCase {
control.visible = true
tryCompare(control, "opacity", 1)
}
+
+ Component {
+ id: buttonAndShortcutComponent
+
+ Item {
+ property alias shortcut: shortcut
+ property alias button: button
+
+ Shortcut {
+ id: shortcut
+ sequence: "A"
+ }
+
+ Button {
+ id: button
+ text: "Just a button"
+ focusPolicy: Qt.NoFocus
+
+ ToolTip.visible: button.hovered
+ ToolTip.text: qsTr("Some helpful text")
+ }
+ }
+ }
+
+ function test_activateShortcutWhileToolTipVisible() {
+ var root = createTemporaryObject(buttonAndShortcutComponent, testCase)
+ verify(root)
+
+ mouseMove(root.button, root.button.width / 2, root.button.height / 2)
+ tryCompare(root.button.ToolTip.toolTip, "visible", true)
+
+ var shortcutActivatedSpy = signalSpy.createObject(root, { target: root.shortcut, signalName: "activated" })
+ verify(shortcutActivatedSpy.valid)
+ keyPress(Qt.Key_A)
+ compare(shortcutActivatedSpy.count, 1)
+ }
}