diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-12-14 10:20:06 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-12-20 07:15:17 +0000 |
commit | bffc040f8014b361992cd92671e559c1c2abd633 (patch) | |
tree | a5c75e487291bd6af0fb817c64fcef896579b391 /tests/auto/quick/scenegraph | |
parent | 3124b03276398f68dd8f3afe18866cfb6ec8a035 (diff) |
Tests: Un-crash image comparison tests
When (naively) running the tests with High-DPI scaling active, the
test would assert on mismatching image sizes caused by the scaling.
Add an error message parameter to
QQuickVisualTestUtil::compareImages() for use with QVERIFY2, return
false instead of asserting on format/size mismatches and adapt the
usages. Remove duplicate code in tst_qquickwindow.
Change-Id: I76564f4125798fa1e065a0202b686bc7f5ec5680
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/quick/scenegraph')
-rw-r--r-- | tests/auto/quick/scenegraph/tst_scenegraph.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp index 2479450287..063358c795 100644 --- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp +++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp @@ -264,6 +264,7 @@ void tst_SceneGraph::manyWindows() const int COUNT = 4; QImage baseLine; + QString errorMessage; for (int i=0; i<COUNT; ++i) { views << createView(file, parent.data(), (i % 2) * 100, (i / 2) * 100, 100, 100); } @@ -275,7 +276,8 @@ void tst_SceneGraph::manyWindows() baseLine = content; QVERIFY(containsSomethingOtherThanWhite(baseLine)); } else { - QVERIFY(compareImages(content, baseLine)); + QVERIFY2(compareImages(content, baseLine, &errorMessage), + qPrintable(errorMessage)); } } @@ -284,7 +286,8 @@ void tst_SceneGraph::manyWindows() QQuickView *last = createView(file, parent.data(), 100, 100, 100, 100); QVERIFY(QTest::qWaitForWindowExposed(last)); views << last; - QVERIFY(compareImages(baseLine, last->grabWindow())); + QVERIFY2(compareImages(baseLine, last->grabWindow(), &errorMessage), + qPrintable(errorMessage)); // Wipe and recreate all qDeleteAll(views); @@ -297,7 +300,8 @@ void tst_SceneGraph::manyWindows() QQuickView *view = views.at(i); QVERIFY(QTest::qWaitForWindowExposed(view)); QImage content = view->grabWindow(); - QVERIFY(compareImages(content, baseLine)); + QVERIFY2(compareImages(content, baseLine, &errorMessage), + qPrintable(errorMessage)); } } |