aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickapplication
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-04-16 12:29:42 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-04-16 12:33:27 +0200
commit9c8edb91f2c6c7de8228e018dbd1ae7a656b3097 (patch)
tree717b1df74793af50bd6daaa6775b923a74b05063 /tests/auto/quick/qquickapplication
parent5870667929ac5f45805b1e1e656fec81b9b22337 (diff)
parent2b3c2339616680537145a9cc2e7567575add1abb (diff)
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts: tests/auto/qml/debugger/qv4profilerservice/qv4profilerservice.pro tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro Change-Id: I76d87e3df97ebdba902ca3d7488c1582eca2a83c
Diffstat (limited to 'tests/auto/quick/qquickapplication')
-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);