summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-05-24 16:27:08 +0200
committerLiang Qi <liang.qi@qt.io>2018-05-24 16:29:14 +0200
commitf82e5085169876e0ec7c1b744d021b068c281cfe (patch)
treea870e1f68ce62818a0793c4c78a67971e841e676 /tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
parentf74d4fb1dacc682e2e6f4a44e4240f642a2c3b70 (diff)
parentee47999333dde1d38b73d04e142e05f06f8c56ed (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: mkspecs/features/qt_common.prf src/corelib/tools/qstring.cpp src/plugins/platforms/windows/qwindowsmousehandler.cpp src/widgets/widgets/qmainwindowlayout_p.h Change-Id: I5df613008f6336f69b257d08e49a133d033a9d65
Diffstat (limited to 'tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp')
-rw-r--r--tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp b/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
index c0f33b9c79..2e5d24cd26 100644
--- a/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
+++ b/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
@@ -167,6 +167,12 @@ void tst_QCommandLinkButton::onReleased()
void tst_QCommandLinkButton::setAutoRepeat()
{
+ // Give the last tests time to finish - i.e., wait for the window close and
+ // deactivate to avoid a race condition here. We can't add this to the end
+ // of the defaultAndAutoDefault test, since any failure in that test will
+ // return out of that function.
+ QTest::qWait(1000);
+
// If this changes, this test must be completely revised.
QVERIFY( !testWidget->isCheckable() );
@@ -421,8 +427,7 @@ void tst_QCommandLinkButton::defaultAndAutoDefault()
QVERIFY(dialog.isVisible());
QObject::connect(&button1, SIGNAL(clicked()), &dialog, SLOT(hide()));
- QKeyEvent event(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
- QApplication::sendEvent(&dialog, &event);
+ QTest::keyClick(&dialog, Qt::Key_Return);
QVERIFY(!dialog.isVisible());
}
@@ -462,8 +467,7 @@ void tst_QCommandLinkButton::defaultAndAutoDefault()
QVERIFY(dialog.isVisible());
QObject::connect(&button1, SIGNAL(clicked()), &dialog, SLOT(hide()));
- QKeyEvent event(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
- QApplication::sendEvent(&dialog, &event);
+ QTest::keyClick(&dialog, Qt::Key_Return);
QVERIFY(!dialog.isVisible());
}
@@ -478,8 +482,7 @@ void tst_QCommandLinkButton::defaultAndAutoDefault()
// No default button is set, and button2 is the first autoDefault button
// that is next in the tab order
QObject::connect(&button2, SIGNAL(clicked()), &dialog, SLOT(hide()));
- QKeyEvent event(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
- QApplication::sendEvent(&dialog, &event);
+ QTest::keyClick(&dialog, Qt::Key_Return);
QVERIFY(!dialog.isVisible());
// Reparenting