summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qtestsupport_gui.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-16 01:01:07 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-16 01:01:07 +0200
commite3f5912747af1d46178886a0c5eaaddaf6d1a23b (patch)
treeabeb1e975369eb62deb8b10f04b3bf82e82f7103 /src/gui/kernel/qtestsupport_gui.cpp
parent5f160a3699d80d1736f691ad9ef774eb6aa28079 (diff)
parent06ca5c49e7fb6dd23eab3a02de404c82e03bc5db (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'src/gui/kernel/qtestsupport_gui.cpp')
-rw-r--r--src/gui/kernel/qtestsupport_gui.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/kernel/qtestsupport_gui.cpp b/src/gui/kernel/qtestsupport_gui.cpp
index 7aad4d8c7d..79da26f2ca 100644
--- a/src/gui/kernel/qtestsupport_gui.cpp
+++ b/src/gui/kernel/qtestsupport_gui.cpp
@@ -37,10 +37,15 @@
**
****************************************************************************/
+#include <private/qguiapplication_p.h>
+
+#include <qpa/qplatformintegration.h>
+
#include "qtestsupport_gui.h"
#include "qwindow.h"
#include <QtCore/qtestsupport_core.h>
+#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
@@ -55,6 +60,14 @@ QT_BEGIN_NAMESPACE
*/
Q_GUI_EXPORT bool QTest::qWaitForWindowActive(QWindow *window, int timeout)
{
+ if (Q_UNLIKELY(!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))) {
+ qWarning() << "qWaitForWindowActive was called on a platform that doesn't support window"
+ << "activation. This means there is an error in the test and it should either"
+ << "check for the WindowActivation platform capability before calling"
+ << "qWaitForWindowActivate, use qWaitForWindowExposed instead, or skip the test."
+ << "Falling back to qWaitForWindowExposed.";
+ return qWaitForWindowExposed(window, timeout);
+ }
return QTest::qWaitFor([&]() { return window->isActive(); }, timeout);
}