summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-04-20 19:23:14 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2018-04-20 20:06:18 +0000
commit100ebf1c97dec1fcfea29d790c07993d071cbb3f (patch)
treeb1f12ddf8834ba77f2143344008b0e9f673cdda1 /tests/auto
parentf35f282c4f0ef11dc35bc9120852ff9e77f85297 (diff)
parent6f45fda50b6dbb0704a71a15f38d44027b4b1816 (diff)
Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/gui/kernel/qwindow/BLACKLIST3
-rw-r--r--tests/auto/widgets/kernel/qaction/tst_qaction.cpp37
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST
index e55bf77403..cd1cb99c3c 100644
--- a/tests/auto/gui/kernel/qwindow/BLACKLIST
+++ b/tests/auto/gui/kernel/qwindow/BLACKLIST
@@ -23,3 +23,6 @@ osx-10.12 ci
[testInputEvents]
rhel-7.4
+[isActive]
+# QTBUG-67768
+ubuntu
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
index ddf9ccb416..3d68e42baf 100644
--- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
+++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
@@ -67,6 +67,7 @@ private slots:
void keysequence(); // QTBUG-53381
void disableShortcutsWithBlockedWidgets_data();
void disableShortcutsWithBlockedWidgets();
+ void shortcutFromKeyEvent(); // QTBUG-48325
private:
int m_lastEventType;
@@ -509,5 +510,41 @@ void tst_QAction::disableShortcutsWithBlockedWidgets()
QCOMPARE(spy.count(), 0);
}
+class ShortcutOverrideWidget : public QWidget
+{
+public:
+ ShortcutOverrideWidget(QWidget *parent = 0) : QWidget(parent), shortcutOverrideCount(0) {}
+ int shortcutOverrideCount;
+protected:
+ bool event(QEvent *e)
+ {
+ if (e->type() == QEvent::ShortcutOverride)
+ ++shortcutOverrideCount;
+ return QWidget::event(e);
+ }
+};
+
+// Test that a key press event sent with sendEvent() still gets handled as a possible
+// ShortcutOverride event first before passing it on as a normal KeyEvent.
+void tst_QAction::shortcutFromKeyEvent()
+{
+ ShortcutOverrideWidget testWidget;
+ QAction action;
+ action.setShortcut(Qt::Key_1);
+ testWidget.addAction(&action);
+ testWidget.show();
+ QSignalSpy spy(&action, &QAction::triggered);
+ QVERIFY(spy.isValid());
+ QVERIFY(QTest::qWaitForWindowActive(&testWidget));
+ QCOMPARE(testWidget.shortcutOverrideCount, 0);
+
+ // Don't use the QTest::keyPress approach as this will take the
+ // shortcut route for us
+ QKeyEvent e(QEvent::KeyPress, Qt::Key_1, Qt::NoModifier);
+ QApplication::sendEvent(&testWidget, &e);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(testWidget.shortcutOverrideCount, 1);
+}
+
QTEST_MAIN(tst_QAction)
#include "tst_qaction.moc"