aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/rendernode/tst_rendernode.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-07-03 11:38:22 +0200
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2016-07-04 14:34:12 +0000
commit123481f94e98f340aa1a19cbf0760dc22620889f (patch)
tree5e1ea3fda8eedc0a52b63bc3726790dbea1f164d /tests/auto/quick/rendernode/tst_rendernode.cpp
parent672716db6e17b79c86075e4d79afe76bc0c5a23e (diff)
Fix tst_rendernode to work with hidpi
Change-Id: Id2a7f20933533f69fa43eefc2338205b82a27ccd Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'tests/auto/quick/rendernode/tst_rendernode.cpp')
-rw-r--r--tests/auto/quick/rendernode/tst_rendernode.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp
index 313e5ac196..e15649e62c 100644
--- a/tests/auto/quick/rendernode/tst_rendernode.cpp
+++ b/tests/auto/quick/rendernode/tst_rendernode.cpp
@@ -215,16 +215,18 @@ void tst_rendernode::renderOrder()
QSKIP("This test does not work at display depths < 24");
QImage fb = runTest("RenderOrder.qml");
- QCOMPARE(fb.width(), 200);
- QCOMPARE(fb.height(), 200);
+ QQuickView v;
+ int devicePixelRatio = static_cast<int>(v.devicePixelRatio());
+ QCOMPARE(fb.width(), 200 * devicePixelRatio);
+ QCOMPARE(fb.height(), 200 * devicePixelRatio);
- 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));
+ QCOMPARE(fb.pixel(50 * devicePixelRatio, 50 * devicePixelRatio), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(fb.pixel(50 * devicePixelRatio, 150 * devicePixelRatio), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(fb.pixel(150 * devicePixelRatio, 50 * devicePixelRatio), qRgb(0x00, 0x00, 0xff));
QByteArray errorMessage;
- QVERIFY2(fuzzyCompareColor(fb.pixel(150, 150), qRgb(0x7f, 0x7f, 0xff), &errorMessage),
- msgColorMismatchAt(errorMessage, 150, 150).constData());
+ QVERIFY2(fuzzyCompareColor(fb.pixel(150 * devicePixelRatio, 150 * devicePixelRatio), qRgb(0x7f, 0x7f, 0xff), &errorMessage),
+ msgColorMismatchAt(errorMessage, 150 * devicePixelRatio, 150 * devicePixelRatio).constData());
}
/* The test uses a number of nested rectangles with clipping