summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@gmail.com>2014-09-17 14:49:08 +0200
committerLaszlo Agocs <laszlo.agocs@digia.com>2014-10-20 10:11:25 +0200
commitc231694949cfcf43952ea23539c3f10f670b5fe5 (patch)
treed7c14e1021ced940a923fccc80d7382d1e53db95 /tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
parentbcda685be97a26cafd73145c0ab7560ba4438d52 (diff)
Fix QOpenGLWindow tests when devicePixelRatio != 1
Change-Id: I83d71de8b9d735cd649a6c514e41a9ff23625005 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp')
-rw-r--r--tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
index 7f571fba89..02e00afe50 100644
--- a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
+++ b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
@@ -116,8 +116,8 @@ void tst_QOpenGLWindow::basic()
QVERIFY(w.paintCount >= 1);
// Check that something has been drawn;
- QCOMPARE(w.img.size(), w.size());
- QVERIFY(w.img.pixel(5, 5) == qRgb(255, 0, 0));
+ QCOMPARE(w.img.size(), w.size() * w.devicePixelRatio());
+ QVERIFY(w.img.pixel(QPoint(5, 5) * w.devicePixelRatio()) == qRgb(255, 0, 0));
// Check that the viewport was properly set.
w.makeCurrent();
@@ -168,9 +168,9 @@ void tst_QOpenGLWindow::painter()
w.show();
QTest::qWaitForWindowExposed(&w);
- QCOMPARE(w.img.size(), w.size());
- QVERIFY(w.img.pixel(5, 5) == qRgb(0, 0, 255));
- QVERIFY(w.img.pixel(200, 5) == qRgb(255, 0, 0));
+ QCOMPARE(w.img.size(), w.size() * w.devicePixelRatio());
+ QVERIFY(w.img.pixel(QPoint(5, 5) * w.devicePixelRatio()) == qRgb(0, 0, 255));
+ QVERIFY(w.img.pixel(QPoint(200, 5) * w.devicePixelRatio()) == qRgb(255, 0, 0));
}
class PartialPainterWindow : public QOpenGLWindow
@@ -222,10 +222,10 @@ void tst_QOpenGLWindow::partial()
// Now since the painting went to an extra framebuffer, all the rects should
// be present since everything is preserved between the frames.
QImage img = w.grabFramebuffer();
- QCOMPARE(img.size(), w.size());
- QCOMPARE(img.pixel(5, 5), qRgb(0, 0, 255));
- QCOMPARE(img.pixel(15, 5), qRgb(0, 255, 0));
- QCOMPARE(img.pixel(25, 5), qRgb(0, 0, 255));
+ QCOMPARE(img.size(), w.size() * w.devicePixelRatio());
+ QCOMPARE(img.pixel(QPoint(5, 5) * w.devicePixelRatio()), qRgb(0, 0, 255));
+ QCOMPARE(img.pixel(QPoint(15, 5) * w.devicePixelRatio()), qRgb(0, 255, 0));
+ QCOMPARE(img.pixel(QPoint(25, 5) * w.devicePixelRatio()), qRgb(0, 0, 255));
}
class PaintUnderOverWindow : public QOpenGLWindow