diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-07-17 15:06:22 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-07-17 16:35:42 +0200 |
commit | b2603b76655ac819e43c063bb6f16bc95f358083 (patch) | |
tree | 0fbe2c367ebfffdb70e9e3f21a7cf408bafd9626 /tests/auto/widgets/kernel/qaction | |
parent | 99b94aadf875c822afb6c2580e43355ac392ac92 (diff) | |
parent | 756266d01560157b7274e466b9ffc1b0e2ef9a1f (diff) |
Merge remote-tracking branch 'origin/5.5' into HEAD
Conflicts:
src/plugins/platforms/windows/qwindowsopengltester.cpp
Change-Id: Ia7abeba9395ccf84e2fa81b91a5725a86dedb9fe
Diffstat (limited to 'tests/auto/widgets/kernel/qaction')
-rw-r--r-- | tests/auto/widgets/kernel/qaction/tst_qaction.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index be1fed2be3..897128d40e 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp @@ -69,6 +69,7 @@ private slots: void task200823_tooltip(); void task229128TriggeredSignalWithoutActiongroup(); void task229128TriggeredSignalWhenInActiongroup(); + void repeat(); private: int m_lastEventType; @@ -380,5 +381,42 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup() QCOMPARE(actionSpy.count(), 1); } +void tst_QAction::repeat() +{ + QWidget *wid = m_tstWidget; + QAction act(wid); + wid->addAction(&act); + act.setShortcut(QKeySequence(Qt::Key_F)); + QSignalSpy spy(&act, SIGNAL(triggered())); + + act.setAutoRepeat(true); + QTest::keyPress(wid, Qt::Key_F); + QTest::keyRelease(wid, Qt::Key_F); + QCOMPARE(spy.count(), 1); + + spy.clear(); + QTest::keyPress(wid, Qt::Key_F); + // repeat event + QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::keyRelease(wid, Qt::Key_F); + QCOMPARE(spy.count(), 3); + + spy.clear(); + act.setAutoRepeat(false); + QTest::keyPress(wid, Qt::Key_F); + QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::keyRelease(wid, Qt::Key_F); + QCOMPARE(spy.count(), 1); + + spy.clear(); + act.setAutoRepeat(true); + QTest::keyPress(wid, Qt::Key_F); + QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::keyRelease(wid, Qt::Key_F); + QCOMPARE(spy.count(), 2); +} + QTEST_MAIN(tst_QAction) #include "tst_qaction.moc" |