diff options
Diffstat (limited to 'tests/auto/quick/rendernode/tst_rendernode.cpp')
-rw-r--r-- | tests/auto/quick/rendernode/tst_rendernode.cpp | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp index 90a9488047..7d1590e5f6 100644 --- a/tests/auto/quick/rendernode/tst_rendernode.cpp +++ b/tests/auto/quick/rendernode/tst_rendernode.cpp @@ -59,14 +59,13 @@ public: { QQuickView view; view.setSource(testFileUrl(fileName)); - + view.setResizeMode(QQuickView::SizeViewToRootObject); const QRect screenGeometry = view.screen()->availableGeometry(); const QSize size = view.size(); const QPoint offset = QPoint(size.width() / 2, size.height() / 2); view.setFramePosition(screenGeometry.center() - offset); view.showNormal(); QTest::qWaitForWindowExposed(&view); - return view.grabWindow(); } @@ -207,34 +206,33 @@ static inline QByteArray msgColorMismatchAt(const QByteArray &colorMsg, int x, i return colorMsg + QByteArrayLiteral(" at ") + QByteArray::number(x) +',' + QByteArray::number(y); } +/* The test draws four rects, each 100x100 and verifies + * that a rendernode which calls glClear() is stacked + * correctly. The red rectangles come under the white + * and are obscured. + */ void tst_rendernode::renderOrder() { if (QGuiApplication::primaryScreen()->depth() < 24) QSKIP("This test does not work at display depths < 24"); QImage fb = runTest("RenderOrder.qml"); - int x1 = fb.width() / 8; - int x2 = fb.width() * 3 / 8; - int x3 = fb.width() * 5 / 8; - int x4 = fb.width() * 7 / 8; - int y1 = fb.height() / 8; - int y2 = fb.height() * 3 / 8; - int y3 = fb.height() * 5 / 8; - int y4 = fb.height() * 7 / 8; + + QCOMPARE(fb.width(), 200); + QCOMPARE(fb.height(), 200); + + QCOMPARE(fb.pixel(50, 50), qRgb(0xff, 0xff, 0xff)); + QCOMPARE(fb.pixel(50, 150), qRgb(0xff, 0xff, 0xff)); + QCOMPARE(fb.pixel(150, 50), qRgb(0x00, 0x00, 0xff)); QByteArray errorMessage; - QVERIFY2(fuzzyCompareColor(fb.pixel(x1, y1), qRgb(0x7f, 0x00, 0x00), &errorMessage), - msgColorMismatchAt(errorMessage, x1, y1).constData()); - QCOMPARE(fb.pixel(x2, y2), qRgb(0xff, 0xff, 0xff)); - QCOMPARE(fb.pixel(x3, y2), qRgb(0x00, 0x00, 0xff)); - QCOMPARE(fb.pixel(x4, y1), qRgb(0x00, 0x00, 0xff)); - QCOMPARE(fb.pixel(x1, y4), qRgb(0xff, 0x00, 0x00)); - QCOMPARE(fb.pixel(x2, y3), qRgb(0xff, 0xff, 0xff)); - QVERIFY2(fuzzyCompareColor(fb.pixel(x3, y3), qRgb(0x7f, 0x7f, 0xff), &errorMessage), - msgColorMismatchAt(errorMessage, x3, y3).constData()); - QVERIFY2(fuzzyCompareColor(fb.pixel(x4, y4), qRgb(0x00, 0x00, 0x7f), &errorMessage), - msgColorMismatchAt(errorMessage, x4, y4).constData()); + QVERIFY2(fuzzyCompareColor(fb.pixel(150, 150), qRgb(0x7f, 0x7f, 0xff), &errorMessage), + msgColorMismatchAt(errorMessage, 150, 150).constData()); } +/* The test uses a number of nested rectangles with clipping + * and rotation to verify that using a render node which messes + * with the state does not break rendering that comes after it. + */ void tst_rendernode::messUpState() { if (QGuiApplication::primaryScreen()->depth() < 24) |