summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtest_gui.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtest_gui.h')
-rw-r--r--src/testlib/qtest_gui.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h
index e5101e6955..d1efde54b1 100644
--- a/src/testlib/qtest_gui.h
+++ b/src/testlib/qtest_gui.h
@@ -162,6 +162,14 @@ inline bool qCompare(QImage const &t1, QImage const &t2,
}
if (t1Null && t2Null)
return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line);
+ if (!qFuzzyCompare(t1.devicePixelRatioF(), t2.devicePixelRatioF())) {
+ qsnprintf(msg, 1024, "Compared QImages differ in device pixel ratio.\n"
+ " Actual (%s): %g\n"
+ " Expected (%s): %g",
+ actual, t1.devicePixelRatioF(),
+ expected, t2.devicePixelRatioF());
+ return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
+ }
if (t1.width() != t2.width() || t1.height() != t2.height()) {
qsnprintf(msg, 1024, "Compared QImages differ in size.\n"
" Actual (%s): %dx%d\n"
@@ -196,6 +204,14 @@ inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, c
}
if (t1Null && t2Null)
return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line);
+ if (!qFuzzyCompare(t1.devicePixelRatioF(), t2.devicePixelRatioF())) {
+ qsnprintf(msg, 1024, "Compared QPixmaps differ in device pixel ratio.\n"
+ " Actual (%s): %g\n"
+ " Expected (%s): %g",
+ actual, t1.devicePixelRatioF(),
+ expected, t2.devicePixelRatioF());
+ return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
+ }
if (t1.width() != t2.width() || t1.height() != t2.height()) {
qsnprintf(msg, 1024, "Compared QPixmaps differ in size.\n"
" Actual (%s): %dx%d\n"