diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2014-05-01 09:21:05 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-01 11:22:43 +0200 |
commit | a292bcb1438034a24e95ec08be04a76ba832d793 (patch) | |
tree | 56cda98ab747011c183d251cfae4df164e34ed19 /tests/auto/quick/qquickapplication/tst_qquickapplication.cpp | |
parent | 4e4228e0b1c01edada84d82746e3360aeffeb037 (diff) |
Update tst_qquickapplication to support OS X ApplicationState handling
This patch modifies tst_qquickapplication so that it tests correctly
against OS X's new ApplicationState handling
Task-number: QTBUG-10899
Change-Id: Iea20b0137daabe03fdddf98435dc2626e122741f
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'tests/auto/quick/qquickapplication/tst_qquickapplication.cpp')
-rw-r--r-- | tests/auto/quick/qquickapplication/tst_qquickapplication.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp index dfcef43a7e..0993d03ee4 100644 --- a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp +++ b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp @@ -60,6 +60,7 @@ private slots: void state(); void layoutDirection(); void inputMethod(); + void cleanup(); private: QQmlEngine engine; @@ -69,6 +70,14 @@ tst_qquickapplication::tst_qquickapplication() { } +void tst_qquickapplication::cleanup() +{ + if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState)) { + QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationInactive); + QTest::waitForEvents(); + } +} + void tst_qquickapplication::active() { QQmlComponent component(&engine); @@ -98,12 +107,19 @@ void tst_qquickapplication::active() QVERIFY(item->property("active").toBool()); QVERIFY(item->property("active2").toBool()); - // not active again QWindowSystemInterface::handleWindowActivated(0); +#ifdef Q_OS_OSX + // OS X has the concept of "reactivation" + QTRY_VERIFY(QGuiApplication::focusWindow() != &window); + QVERIFY(item->property("active").toBool()); + QVERIFY(item->property("active2").toBool()); +#else + // not active again QTRY_VERIFY(QGuiApplication::focusWindow() != &window); QVERIFY(!item->property("active").toBool()); QVERIFY(!item->property("active2").toBool()); +#endif } void tst_qquickapplication::state() @@ -117,6 +133,7 @@ void tst_qquickapplication::state() " target: Qt.application; " " onStateChanged: state2 = Qt.application.state; " " } " + " Component.onCompleted: state2 = Qt.application.state; " "}", QUrl::fromLocalFile("")); QQuickItem *item = qobject_cast<QQuickItem *>(component.create()); QVERIFY(item); |