From 960a1e3bf3414a59e7bd436b3a2d63a595b34dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 3 May 2016 11:49:49 +0200 Subject: QTestLib: Disable window state restore on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For test runs we want to start with a clean slate and ignore previously saved window state. This also prevents the “previous restore failed” dialog from from showing and blocking the test run. Change-Id: I8e5b87a903cf1d937d628c2b062f917c4c37f176 Reviewed-by: Morten Johan Sørvig --- src/testlib/qtestcase.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/testlib/qtestcase.cpp') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index fe680e19aa..876c573196 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -65,6 +65,9 @@ #if defined(HAVE_XCTEST) #include #endif +#if defined Q_OS_MACOS +#include +#endif #include #include @@ -2915,6 +2918,9 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) #if defined(Q_OS_MACX) bool macNeedsActivate = qApp && (qstrcmp(qApp->metaObject()->className(), "QApplication") == 0); IOPMAssertionID powerID; + + // Don't restore saved window state for auto tests. + QTestPrivate::disableWindowRestore(); #endif #ifndef QT_NO_EXCEPTIONS try { -- cgit v1.2.3