summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/image/qpixmap/tst_qpixmap.cpp')
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index 9a338ad55a..4d31d80246 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -121,6 +121,7 @@ private slots:
void copy();
void deepCopyPreservesDpr();
+ void dprPassthrough();
void depthOfNullObjects();
void transformed();
@@ -1169,6 +1170,39 @@ void tst_QPixmap::deepCopyPreservesDpr()
QCOMPARE(dest.devicePixelRatio(), dpr);
}
+void tst_QPixmap::dprPassthrough()
+{
+ const qreal dpr = 2;
+ QPixmap src(32, 32);
+ src.setDevicePixelRatio(dpr);
+ src.fill(Qt::transparent);
+ QCOMPARE(src.devicePixelRatio(), dpr);
+
+ QImage img = src.toImage();
+ QCOMPARE(img.devicePixelRatio(), dpr);
+
+ QPixmap pm(1, 1);
+ pm.convertFromImage(img);
+ QCOMPARE(pm.devicePixelRatio(), dpr);
+
+ QBitmap heuristicMask = src.createHeuristicMask();
+ QCOMPARE(heuristicMask.devicePixelRatio(), dpr);
+
+ QBitmap maskFromColor = src.createMaskFromColor(Qt::white);
+ QCOMPARE(maskFromColor.devicePixelRatio(), dpr);
+
+ QBitmap mask = src.mask();
+ QCOMPARE(mask.devicePixelRatio(), dpr);
+
+ QPixmap scaled = src.scaled(16, 16);
+ QCOMPARE(scaled.devicePixelRatio(), dpr);
+
+ QTransform t;
+ t.rotate(90);
+ QPixmap transformed = src.transformed(t);
+ QCOMPARE(transformed.devicePixelRatio(), dpr);
+}
+
void tst_QPixmap::depthOfNullObjects()
{
QBitmap b1;