From 08e083e682d92290e36e4fb09abaf0318575dd41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 8 Sep 2017 18:42:25 +0200 Subject: Ensure result of all QTest::qWaitFor are verified The qWaitFor functions themselves can not trigger a test failure, as that will not result in the test function exiting early, so every single call to qWaitFor needs to be wrapped in a QVERIFY. Change-Id: Id15a1549f31d06cdbf788e1d84ea431c28636ec8 Reviewed-by: Thiago Macieira --- src/testlib/qtestsystem.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/testlib/qtestsystem.h') diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h index 687219c521..ceab7d86f5 100644 --- a/src/testlib/qtestsystem.h +++ b/src/testlib/qtestsystem.h @@ -110,7 +110,7 @@ namespace QTest } #ifdef QT_GUI_LIB - inline static bool qWaitForWindowActive(QWindow *window, int timeout = 5000) + Q_REQUIRED_RESULT inline static bool qWaitForWindowActive(QWindow *window, int timeout = 5000) { bool becameActive = qWaitFor([&]() { return window->isActive(); }, timeout); @@ -131,21 +131,21 @@ namespace QTest return window->isActive(); } - inline static bool qWaitForWindowExposed(QWindow *window, int timeout = 5000) + Q_REQUIRED_RESULT inline static bool qWaitForWindowExposed(QWindow *window, int timeout = 5000) { return qWaitFor([&]() { return window->isExposed(); }, timeout); } #endif #ifdef QT_WIDGETS_LIB - inline static bool qWaitForWindowActive(QWidget *widget, int timeout = 5000) + Q_REQUIRED_RESULT inline static bool qWaitForWindowActive(QWidget *widget, int timeout = 5000) { if (QWindow *window = widget->window()->windowHandle()) return qWaitForWindowActive(window, timeout); return false; } - inline static bool qWaitForWindowExposed(QWidget *widget, int timeout = 5000) + Q_REQUIRED_RESULT inline static bool qWaitForWindowExposed(QWidget *widget, int timeout = 5000) { if (QWindow *window = widget->window()->windowHandle()) return qWaitForWindowExposed(window, timeout); @@ -155,7 +155,8 @@ namespace QTest #if QT_DEPRECATED_SINCE(5, 0) # ifdef QT_WIDGETS_LIB - QT_DEPRECATED inline static bool qWaitForWindowShown(QWidget *widget, int timeout = 5000) + + QT_DEPRECATED Q_REQUIRED_RESULT inline static bool qWaitForWindowShown(QWidget *widget, int timeout = 5000) { return qWaitForWindowExposed(widget, timeout); } -- cgit v1.2.3