aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2020-06-05 10:28:16 +0200
committerMitch Curtis <mitch.curtis@qt.io>2020-06-18 12:13:32 +0200
commitf66d6116b0fb84982b004e282bea9bfcfbc1f950 (patch)
tree503cd8da12d156310f5673999b5f9df746d7e394
parent428cce1a9494eca8683ab8f2181a60588f8c9a39 (diff)
QQuickApplicationHelper: don't use QTest macros outside test functions
This has no effect. Task-number: QTBUG-66320 Change-Id: Ie6efb26243178c4044ac0bc721c21ad89769c982 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 969a724352dfe3250efb871c70f9482d7b780165) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--tests/auto/cursor/tst_cursor.cpp1
-rw-r--r--tests/auto/qquickdrawer/tst_qquickdrawer.cpp18
-rw-r--r--tests/auto/qquickmaterialstyleconf/tst_qquickmaterialstyleconf.cpp2
-rw-r--r--tests/auto/qquickmenu/tst_qquickmenu.cpp27
-rw-r--r--tests/auto/qquickpopup/tst_qquickpopup.cpp24
-rw-r--r--tests/auto/qquickuniversalstyleconf/tst_qquickuniversalstyleconf.cpp1
-rw-r--r--tests/auto/shared/visualtestutil.h35
7 files changed, 103 insertions, 5 deletions
diff --git a/tests/auto/cursor/tst_cursor.cpp b/tests/auto/cursor/tst_cursor.cpp
index 2491a972..ed5db5b1 100644
--- a/tests/auto/cursor/tst_cursor.cpp
+++ b/tests/auto/cursor/tst_cursor.cpp
@@ -182,6 +182,7 @@ void tst_cursor::scrollBar()
// Ensure that the mouse cursor has the correct shape when over a scrollbar
// which is itself over a text area with IBeamCursor.
QQuickApplicationHelper helper(this, QStringLiteral("scrollbar.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
diff --git a/tests/auto/qquickdrawer/tst_qquickdrawer.cpp b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp
index 4cf0dabe..005c5ee4 100644
--- a/tests/auto/qquickdrawer/tst_qquickdrawer.cpp
+++ b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp
@@ -180,6 +180,7 @@ void tst_QQuickDrawer::visible()
{
QFETCH(QString, source);
QQuickApplicationHelper helper(this, source);
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -220,6 +221,7 @@ void tst_QQuickDrawer::visible()
void tst_QQuickDrawer::state()
{
QQuickApplicationHelper helper(this, "applicationwindow.qml");
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -340,6 +342,7 @@ void tst_QQuickDrawer::position()
QFETCH(qreal, position);
QQuickApplicationHelper helper(this, QStringLiteral("applicationwindow.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
@@ -387,6 +390,7 @@ void tst_QQuickDrawer::dragMargin()
QFETCH(qreal, dragFromRight);
QQuickApplicationHelper helper(this, QStringLiteral("applicationwindow.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
@@ -433,6 +437,7 @@ static QRectF geometry(const QQuickItem *item)
void tst_QQuickDrawer::reposition()
{
QQuickApplicationHelper helper(this, QStringLiteral("reposition.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
@@ -491,6 +496,7 @@ void tst_QQuickDrawer::reposition()
void tst_QQuickDrawer::header()
{
QQuickApplicationHelper helper(this, QStringLiteral("header.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
@@ -545,6 +551,7 @@ void tst_QQuickDrawer::hover()
QFETCH(bool, modal);
QQuickApplicationHelper helper(this, source);
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
window->requestActivate();
@@ -626,6 +633,7 @@ void tst_QQuickDrawer::wheel()
QFETCH(bool, modal);
QQuickApplicationHelper helper(this, source);
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -688,6 +696,7 @@ void tst_QQuickDrawer::wheel()
void tst_QQuickDrawer::multiple()
{
QQuickApplicationHelper helper(this, QStringLiteral("multiple.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -832,6 +841,7 @@ void tst_QQuickDrawer::touch()
QFETCH(QPoint, to);
QQuickApplicationHelper helper(this, source);
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -866,6 +876,7 @@ void tst_QQuickDrawer::touch()
void tst_QQuickDrawer::multiTouch()
{
QQuickApplicationHelper helper(this, QStringLiteral("multiTouch.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -979,6 +990,7 @@ void tst_QQuickDrawer::multiTouch()
void tst_QQuickDrawer::grabber()
{
QQuickApplicationHelper helper(this, QStringLiteral("grabber.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -1023,6 +1035,7 @@ void tst_QQuickDrawer::interactive()
{
QFETCH(QString, source);
QQuickApplicationHelper helper(this, source);
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -1085,6 +1098,7 @@ void tst_QQuickDrawer::flickable()
QFETCH(QPoint, to);
QQuickApplicationHelper helper(this, QStringLiteral("flickable.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -1141,6 +1155,7 @@ void tst_QQuickDrawer::dragOverModalShadow()
QFETCH(bool, mouse);
QQuickApplicationHelper helper(this, QStringLiteral("dragOverModalShadow.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -1197,6 +1212,7 @@ void tst_QQuickDrawer::nonModal()
QFETCH(bool, mouse);
QQuickApplicationHelper helper(this, QStringLiteral("window.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -1280,6 +1296,7 @@ void tst_QQuickDrawer::slider()
QFETCH(int, delta);
QQuickApplicationHelper helper(this, QStringLiteral("slider.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -1323,6 +1340,7 @@ void tst_QQuickDrawer::slider()
void tst_QQuickDrawer::topEdgeScreenEdge()
{
QQuickApplicationHelper helper(this, QStringLiteral("topEdgeScreenEdge.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
diff --git a/tests/auto/qquickmaterialstyleconf/tst_qquickmaterialstyleconf.cpp b/tests/auto/qquickmaterialstyleconf/tst_qquickmaterialstyleconf.cpp
index 72136445..7612b99b 100644
--- a/tests/auto/qquickmaterialstyleconf/tst_qquickmaterialstyleconf.cpp
+++ b/tests/auto/qquickmaterialstyleconf/tst_qquickmaterialstyleconf.cpp
@@ -57,6 +57,7 @@ private slots:
void tst_qquickmaterialstyleconf::conf()
{
QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QFont customFont;
customFont.setFamily("Courier");
@@ -101,6 +102,7 @@ void tst_qquickmaterialstyleconf::variants()
qputenv("QT_QUICK_CONTROLS_CONF", confPath);
QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
diff --git a/tests/auto/qquickmenu/tst_qquickmenu.cpp b/tests/auto/qquickmenu/tst_qquickmenu.cpp
index 22aece0c..fcec17bb 100644
--- a/tests/auto/qquickmenu/tst_qquickmenu.cpp
+++ b/tests/auto/qquickmenu/tst_qquickmenu.cpp
@@ -106,6 +106,7 @@ private slots:
void tst_QQuickMenu::defaults()
{
QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickMenu *emptyMenu = helper.appWindow->property("emptyMenu").value<QQuickMenu*>();
QCOMPARE(emptyMenu->isVisible(), false);
@@ -117,6 +118,7 @@ void tst_QQuickMenu::defaults()
void tst_QQuickMenu::count()
{
QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickMenu *menu = helper.window->property("emptyMenu").value<QQuickMenu*>();
QVERIFY(menu);
@@ -149,6 +151,7 @@ void tst_QQuickMenu::mouse()
QSKIP("Mouse hovering not functional on offscreen/minimal platforms");
QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
centerOnScreen(window);
@@ -244,6 +247,7 @@ void tst_QQuickMenu::mouse()
void tst_QQuickMenu::pressAndHold()
{
QQuickApplicationHelper helper(this, QLatin1String("pressAndHold.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -268,6 +272,7 @@ void tst_QQuickMenu::contextMenuKeyboard()
QSKIP("This platform only allows tab focus for text controls");
QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
centerOnScreen(window);
@@ -451,6 +456,7 @@ void tst_QQuickMenu::disabledMenuItemKeyNavigation()
QSKIP("This platform only allows tab focus for text controls");
QQuickApplicationHelper helper(this, QLatin1String("disabledMenuItemKeyNavigation.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
centerOnScreen(window);
@@ -515,6 +521,7 @@ void tst_QQuickMenu::mnemonics()
#endif
QQuickApplicationHelper helper(this, QLatin1String("mnemonics.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -562,6 +569,7 @@ void tst_QQuickMenu::menuButton()
QSKIP("This platform only allows tab focus for text controls");
QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
@@ -588,6 +596,7 @@ void tst_QQuickMenu::menuButton()
void tst_QQuickMenu::addItem()
{
QQuickApplicationHelper helper(this, QLatin1String("addItem.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -609,6 +618,7 @@ void tst_QQuickMenu::addItem()
void tst_QQuickMenu::menuSeparator()
{
QQuickApplicationHelper helper(this, QLatin1String("menuSeparator.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
centerOnScreen(window);
moveMouseAway(window);
@@ -686,6 +696,7 @@ void tst_QQuickMenu::menuSeparator()
void tst_QQuickMenu::repeater()
{
QQuickApplicationHelper helper(this, QLatin1String("repeater.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -730,6 +741,7 @@ void tst_QQuickMenu::repeater()
void tst_QQuickMenu::order()
{
QQuickApplicationHelper helper(this, QLatin1String("order.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -751,6 +763,7 @@ void tst_QQuickMenu::order()
void tst_QQuickMenu::popup()
{
QQuickApplicationHelper helper(this, QLatin1String("popup.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
centerOnScreen(window);
moveMouseAway(window);
@@ -907,6 +920,7 @@ void tst_QQuickMenu::popup()
void tst_QQuickMenu::actions()
{
QQuickApplicationHelper helper(this, QLatin1String("actions.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -975,6 +989,7 @@ void tst_QQuickMenu::actions()
void tst_QQuickMenu::removeTakeItem()
{
QQuickApplicationHelper helper(this, QLatin1String("removeTakeItem.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -1038,6 +1053,7 @@ void tst_QQuickMenu::subMenuMouse()
QFETCH(bool, cascade);
QQuickApplicationHelper helper(this, QLatin1String("subMenus.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
centerOnScreen(window);
moveMouseAway(window);
@@ -1144,6 +1160,7 @@ void tst_QQuickMenu::subMenuDisabledMouse()
QFETCH(bool, cascade);
QQuickApplicationHelper helper(this, QLatin1String("subMenuDisabled.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
centerOnScreen(window);
moveMouseAway(window);
@@ -1206,6 +1223,7 @@ void tst_QQuickMenu::subMenuKeyboard()
QFETCH(bool, mirrored);
QQuickApplicationHelper helper(this, QLatin1String("subMenus.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
centerOnScreen(window);
moveMouseAway(window);
@@ -1328,6 +1346,7 @@ void tst_QQuickMenu::subMenuDisabledKeyboard()
QFETCH(bool, mirrored);
QQuickApplicationHelper helper(this, QLatin1String("subMenuDisabled.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
centerOnScreen(window);
moveMouseAway(window);
@@ -1404,6 +1423,7 @@ void tst_QQuickMenu::subMenuPosition()
QFETCH(qreal, overlap);
QQuickApplicationHelper helper(this, QLatin1String("subMenus.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
// Ensure that the default size of the window fits three menus side by side.
@@ -1525,6 +1545,7 @@ void tst_QQuickMenu::subMenuPosition()
void tst_QQuickMenu::addRemoveSubMenus()
{
QQuickApplicationHelper helper(this, QLatin1String("subMenus.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -1596,6 +1617,7 @@ void tst_QQuickMenu::scrollable()
QFETCH(QString, qmlFilePath);
QQuickApplicationHelper helper(this, qmlFilePath);
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -1635,6 +1657,7 @@ void tst_QQuickMenu::disableWhenTriggered()
QFETCH(int, subMenuItemIndex);
QQuickApplicationHelper helper(this, QLatin1String("disableWhenTriggered.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -1690,6 +1713,7 @@ void tst_QQuickMenu::menuItemWidth()
QFETCH(bool, mirrored);
QQuickApplicationHelper helper(this, QLatin1String("menuItemWidths.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -1718,6 +1742,7 @@ void tst_QQuickMenu::menuItemWidthAfterMenuWidthChanged()
QFETCH(bool, mirrored);
QQuickApplicationHelper helper(this, QLatin1String("menuItemWidths.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -1762,6 +1787,7 @@ void tst_QQuickMenu::menuItemWidthAfterImplicitWidthChanged()
QFETCH(bool, mirrored);
QQuickApplicationHelper helper(this, QLatin1String("menuItemWidths.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -1792,6 +1818,7 @@ void tst_QQuickMenu::menuItemWidthAfterImplicitWidthChanged()
void tst_QQuickMenu::menuItemWidthAfterRetranslate()
{
QQuickApplicationHelper helper(this, QLatin1String("menuItemWidths.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp
index 0b7d14bd..a1765ead 100644
--- a/tests/auto/qquickpopup/tst_qquickpopup.cpp
+++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp
@@ -114,6 +114,7 @@ void tst_QQuickPopup::visible()
{
QFETCH(QString, source);
QQuickApplicationHelper helper(this, source);
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -147,6 +148,7 @@ void tst_QQuickPopup::visible()
void tst_QQuickPopup::state()
{
QQuickApplicationHelper helper(this, "applicationwindow.qml");
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -208,6 +210,7 @@ void tst_QQuickPopup::overlay()
QFETCH(bool, dim);
QQuickApplicationHelper helper(this, source);
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -370,6 +373,7 @@ void tst_QQuickPopup::zOrder()
{
QFETCH(QString, source);
QQuickApplicationHelper helper(this, source);
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -479,6 +483,7 @@ void tst_QQuickPopup::closePolicy()
QFETCH(QQuickPopup::ClosePolicy, closePolicy);
QQuickApplicationHelper helper(this, source);
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -563,6 +568,7 @@ void tst_QQuickPopup::activeFocusOnClose1()
// Test that a popup that never sets focus: true (e.g. ToolTip) doesn't affect
// the active focus item when it closes.
QQuickApplicationHelper helper(this, QStringLiteral("activeFocusOnClose1.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
window->requestActivate();
@@ -606,6 +612,7 @@ void tst_QQuickPopup::activeFocusOnClose2()
// calling forceActiveFocus() on another item) before it closes doesn't
// affect the active focus item when it closes.
QQuickApplicationHelper helper(this, QStringLiteral("activeFocusOnClose2.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
window->requestActivate();
@@ -642,6 +649,7 @@ void tst_QQuickPopup::activeFocusOnClose3()
// Test that a closing popup that had focus doesn't steal focus from
// another popup that the focus was transferred to.
QQuickApplicationHelper helper(this, QStringLiteral("activeFocusOnClose3.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
window->requestActivate();
@@ -673,6 +681,7 @@ void tst_QQuickPopup::activeFocusOnClosingSeveralPopups()
{
// Test that active focus isn't lost when multiple popup closing simultaneously
QQuickApplicationHelper helper(this, QStringLiteral("activeFocusOnClosingSeveralPopups.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
window->requestActivate();
@@ -734,6 +743,7 @@ void tst_QQuickPopup::hover()
QFETCH(bool, modal);
QQuickApplicationHelper helper(this, source);
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
window->requestActivate();
@@ -808,6 +818,7 @@ void tst_QQuickPopup::wheel()
QFETCH(bool, modal);
QQuickApplicationHelper helper(this, source);
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -878,6 +889,7 @@ void tst_QQuickPopup::parentDestroyed()
void tst_QQuickPopup::nested()
{
QQuickApplicationHelper helper(this, QStringLiteral("nested.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -905,6 +917,7 @@ void tst_QQuickPopup::nested()
void tst_QQuickPopup::grabber()
{
QQuickApplicationHelper helper(this, QStringLiteral("grabber.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -957,6 +970,7 @@ void tst_QQuickPopup::cursorShape()
// Ensure that the mouse cursor has the correct shape when over a popup
// which is itself over an item with a different shape.
QQuickApplicationHelper helper(this, QStringLiteral("cursor.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
centerOnScreen(window);
moveMouseAway(window);
@@ -1014,6 +1028,7 @@ void tst_QQuickPopup::closeOnEscapeWithNestedPopups()
// Tests the scenario in the Gallery example, where there are nested popups that should
// close in the correct order when the Escape key is pressed.
QQuickApplicationHelper helper(this, QStringLiteral("closeOnEscapeWithNestedPopups.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickApplicationWindow *window = helper.appWindow;
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -1077,6 +1092,7 @@ void tst_QQuickPopup::closeOnEscapeWithNestedPopups()
void tst_QQuickPopup::closeOnEscapeWithVisiblePopup()
{
QQuickApplicationHelper helper(this, QStringLiteral("closeOnEscapeWithVisiblePopup.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -1127,6 +1143,7 @@ void tst_QQuickPopup::orientation()
QFETCH(QPointF, position);
QQuickApplicationHelper helper(this, "orientation.qml");
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->reportContentOrientationChange(orientation);
@@ -1166,6 +1183,7 @@ void tst_QQuickPopup::qquickview()
void tst_QQuickPopup::disabledPalette()
{
QQuickApplicationHelper helper(this, "disabledPalette.qml");
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -1203,6 +1221,7 @@ void tst_QQuickPopup::disabledPalette()
void tst_QQuickPopup::disabledParentPalette()
{
QQuickApplicationHelper helper(this, "disabledPalette.qml");
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -1249,6 +1268,7 @@ void tst_QQuickPopup::disabledParentPalette()
void tst_QQuickPopup::countChanged()
{
QQuickApplicationHelper helper(this, "countChanged.qml");
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -1266,6 +1286,7 @@ void tst_QQuickPopup::countChanged()
void tst_QQuickPopup::toolTipCrashOnClose()
{
QQuickApplicationHelper helper(this, "toolTipCrashOnClose.qml");
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -1286,6 +1307,7 @@ void tst_QQuickPopup::toolTipCrashOnClose()
void tst_QQuickPopup::setOverlayParentToNull()
{
QQuickApplicationHelper helper(this, "toolTipCrashOnClose.qml");
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -1309,6 +1331,7 @@ void tst_QQuickPopup::tabFence()
QSKIP("This platform only allows tab focus for text controls");
QQuickApplicationHelper helper(this, "tabFence.qml");
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
window->show();
@@ -1362,6 +1385,7 @@ void tst_QQuickPopup::tabFence()
void tst_QQuickPopup::invisibleToolTipOpen()
{
QQuickApplicationHelper helper(this, "invisibleToolTipOpen.qml");
+ QVERIFY2(helper.ready, helper.failureMessage());
QQuickWindow *window = helper.window;
centerOnScreen(window);
diff --git a/tests/auto/qquickuniversalstyleconf/tst_qquickuniversalstyleconf.cpp b/tests/auto/qquickuniversalstyleconf/tst_qquickuniversalstyleconf.cpp
index 51cc5883..08eae67c 100644
--- a/tests/auto/qquickuniversalstyleconf/tst_qquickuniversalstyleconf.cpp
+++ b/tests/auto/qquickuniversalstyleconf/tst_qquickuniversalstyleconf.cpp
@@ -54,6 +54,7 @@ private slots:
void tst_qquickuniversalstyleconf::conf()
{
QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
QFont customFont;
customFont.setFamily("Courier");
diff --git a/tests/auto/shared/visualtestutil.h b/tests/auto/shared/visualtestutil.h
index d5e651c5..ce737b1b 100644
--- a/tests/auto/shared/visualtestutil.h
+++ b/tests/auto/shared/visualtestutil.h
@@ -122,19 +122,44 @@ namespace QQuickVisualTestUtil
component.loadUrl(testCase->testFileUrl(testFilePath));
QObject *rootObject = component.create();
cleanup.reset(rootObject);
- QVERIFY2(rootObject, qPrintable(QString::fromLatin1("Failed to create window: %1").arg(component.errorString())));
+ if (!rootObject) {
+ errorMessage = QString::fromUtf8("Failed to create window: %1").arg(component.errorString()).toUtf8();
+ return;
+ }
window = qobject_cast<QQuickWindow*>(rootObject);
appWindow = qobject_cast<QQuickApplicationWindow*>(rootObject);
- QVERIFY(window);
- QVERIFY(!window->isVisible());
+ if (!window) {
+ errorMessage = QString::fromUtf8("Root object must be a QQuickWindow subclass").toUtf8();
+ return;
+ }
+
+ if (window->isVisible()) {
+ errorMessage = QString::fromUtf8("Expected window not to be visible, but it is").toUtf8();
+ return;
+ }
+
+ ready = true;
+ }
+
+ // Return a C-style string instead of QString because that's what QTest uses for error messages,
+ // so it saves code at the calling site.
+ inline const char *failureMessage() const
+ {
+ return errorMessage.constData();
}
QQmlEngine engine;
QQmlComponent component;
QScopedPointer<QObject> cleanup;
- QQuickApplicationWindow *appWindow;
- QQuickWindow *window;
+ QQuickApplicationWindow *appWindow = nullptr;
+ QQuickWindow *window = nullptr;
+
+ bool ready = false;
+ // Store as a byte array so that we can return its raw data safely;
+ // using qPrintable() in failureMessage() will construct a throwaway QByteArray
+ // that is destroyed before the function returns.
+ QByteArray errorMessage;
};
void addTestRowForEachControl(QQmlEngine *engine, const QString &sourcePath, const QString &targetPath, const QStringList &skiplist = QStringList());