aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-06-29 14:20:19 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-06-29 16:17:11 +0000
commit97fe98a269d0f05ba4ced62946af4ab5e7b3c624 (patch)
tree4c14be62343b93072f718dc31a7975035f2578ac /tests
parent1be2cab39eb1dfc26891942e29f934700b46ab4e (diff)
QQuickAbstractButton: fix shortcut handling part 2
Make sure to trigger the associated action if a button is activated via its shortcut. Change-Id: I73899a5540285c7c2b11a2481a9621ec6e83c6b8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_abstractbutton.qml14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_abstractbutton.qml b/tests/auto/controls/data/tst_abstractbutton.qml
index 9118c221..7579d410 100644
--- a/tests/auto/controls/data/tst_abstractbutton.qml
+++ b/tests/auto/controls/data/tst_abstractbutton.qml
@@ -71,6 +71,11 @@ TestCase {
}
Component {
+ id: action
+ Action { }
+ }
+
+ Component {
id: signalSpy
SignalSpy { }
}
@@ -332,6 +337,15 @@ TestCase {
keyClick(Qt.Key_H, Qt.AltModifier)
compare(clickSpy.count, 4)
+ control.action = action.createObject(control, {text: "&Action"})
+
+ var actionSpy = signalSpy.createObject(control, {target: control.action, signalName: "triggered"})
+ verify(actionSpy.valid)
+
+ keyClick(Qt.Key_A, Qt.AltModifier)
+ compare(actionSpy.count, 1)
+ compare(clickSpy.count, 5)
+
// ungrab on destruction (don't crash)
control.Component.onDestruction.connect(function() { control = null })
control.destroy()