summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@theqtcompany.com>2016-05-03 11:49:49 +0200
committerTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-08-18 08:46:25 +0000
commit960a1e3bf3414a59e7bd436b3a2d63a595b34dc8 (patch)
treefb952d93349ab6ff4b6b10ef4190a430888f4a0f /src/testlib/qtestcase.cpp
parent748aa6b06462804a9671997302df292ae9788d5c (diff)
QTestLib: Disable window state restore on macOS
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 <morten.sorvig@qt.io>
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r--src/testlib/qtestcase.cpp6
1 files changed, 6 insertions, 0 deletions
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 <QtTest/private/qxctestlogger_p.h>
#endif
+#if defined Q_OS_MACOS
+#include <QtTest/private/qtestutil_macos_p.h>
+#endif
#include <numeric>
#include <algorithm>
@@ -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 {