diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-10-24 20:44:17 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-26 23:53:38 +0200 |
commit | 8d6500560eb5f7f72588d9d01e663a04af592e99 (patch) | |
tree | 1d839947b6bf6bc5ae73167eec6bfa5c127e07bc /tests/auto/quick/rendernode/tst_rendernode.cpp | |
parent | 6041de9ad7ec9407507ea0e77f3588039db28634 (diff) |
Fix rendernode bug and enable rendernode test.
The bug in the renderer was that the viewport was set before
we called the render node, leaving us with the viewport
set by the render node as opposed to the viewport of the
renderer.
The render node API is a crude and intrusive hack which was added for
webkit back in the day. With the introduction of webengine it becomes
less relevant, but it should still work.
Change-Id: I66a1e3047e018ad6c0bb28044851e9fc65da59cc
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
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) |