aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-23 13:35:38 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2015-04-23 13:35:38 +0000
commit25b99c8f488c55d5a55874eacfb16b0d1b285cb0 (patch)
tree8eaf2f4467c29b08de192f180f0a51a8276b71e6 /tests/auto/quick
parent2dbf8e01035f3979b32d82590a362a56d2429ea1 (diff)
parent07782f48f4318a7261f1b0ddcd686b19ec812e36 (diff)
Merge "Merge remote-tracking branch 'origin/5.5' into dev" into refs/staging/dev
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/qquickapplication/tst_qquickapplication.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp
index e78427df3b..7df020405f 100644
--- a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp
+++ b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp
@@ -134,31 +134,30 @@ void tst_qquickapplication::state()
QQuickWindow window;
item->setParentItem(window.contentItem());
- // initial state should be ApplicationInactive
- QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationInactive);
- QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationInactive);
-
// If the platform plugin has the ApplicationState capability, state changes originate from it
// as a result of a system event. We therefore have to simulate these events here.
if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState)) {
+ // Flush pending events, in case the platform have already queued real application state events
+ QWindowSystemInterface::flushWindowSystemEvents();
+
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationActive);
- QTest::waitForEvents();
+ QWindowSystemInterface::flushWindowSystemEvents();
QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationActive);
QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationActive);
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationInactive);
- QTest::waitForEvents();
+ QWindowSystemInterface::flushWindowSystemEvents();
QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationInactive);
QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationInactive);
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationSuspended);
- QTest::waitForEvents();
+ QWindowSystemInterface::flushWindowSystemEvents();
QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationSuspended);
QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationSuspended);
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationHidden);
- QTest::waitForEvents();
+ QWindowSystemInterface::flushWindowSystemEvents();
QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationHidden);
QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationHidden);