aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/rendernode/tst_rendernode.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-20 08:28:16 +0200
committerLiang Qi <liang.qi@qt.io>2016-10-20 08:28:16 +0200
commitf5da1a9261d64fdac3b4e12082932cb473098c73 (patch)
treebf96e4940ef4f66509589cc31095cf1d8e3b3a2c /tests/auto/quick/rendernode/tst_rendernode.cpp
parent0bfcff9d9bd20f3efef6146bd1da6f263b0e24c4 (diff)
parentdd313c4c5e383827913bbc106f9d19667f2dd149 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: src/quick/items/qquickitemsmodule.cpp tests/auto/quick/rendernode/tst_rendernode.cpp Change-Id: I90582df69feb95a4e4aafb0b9793c23714654f19
Diffstat (limited to 'tests/auto/quick/rendernode/tst_rendernode.cpp')
-rw-r--r--tests/auto/quick/rendernode/tst_rendernode.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp
index e15649e62c..e0fe2c42fc 100644
--- a/tests/auto/quick/rendernode/tst_rendernode.cpp
+++ b/tests/auto/quick/rendernode/tst_rendernode.cpp
@@ -215,18 +215,18 @@ void tst_rendernode::renderOrder()
QSKIP("This test does not work at display depths < 24");
QImage fb = runTest("RenderOrder.qml");
- QQuickView v;
- int devicePixelRatio = static_cast<int>(v.devicePixelRatio());
- QCOMPARE(fb.width(), 200 * devicePixelRatio);
- QCOMPARE(fb.height(), 200 * devicePixelRatio);
+ const qreal scaleFactor = QGuiApplication::primaryScreen()->devicePixelRatio();
+ QCOMPARE(fb.width(), qRound(200 * scaleFactor));
+ QCOMPARE(fb.height(), qRound(200 * scaleFactor));
- 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));
+ QCOMPARE(fb.pixel(50 * scaleFactor, 50 * scaleFactor), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(fb.pixel(50 * scaleFactor, 150 * scaleFactor), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(fb.pixel(150 * scaleFactor, 50 * scaleFactor), qRgb(0x00, 0x00, 0xff));
QByteArray errorMessage;
- QVERIFY2(fuzzyCompareColor(fb.pixel(150 * devicePixelRatio, 150 * devicePixelRatio), qRgb(0x7f, 0x7f, 0xff), &errorMessage),
- msgColorMismatchAt(errorMessage, 150 * devicePixelRatio, 150 * devicePixelRatio).constData());
+ const qreal coordinate = 150 * scaleFactor;
+ QVERIFY2(fuzzyCompareColor(fb.pixel(coordinate, coordinate), qRgb(0x7f, 0x7f, 0xff), &errorMessage),
+ msgColorMismatchAt(errorMessage, coordinate, coordinate).constData());
}
/* The test uses a number of nested rectangles with clipping