summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/image/qimage/tst_qimage.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-02 01:00:25 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-02 01:00:26 +0200
commitffe9c395dc5a8a3f1dfdd820557d0eadeca24f22 (patch)
treefc823fb5afd857be67fa86af8d019f8d9fa024e6 /tests/auto/gui/image/qimage/tst_qimage.cpp
parent69beb5f5a04bbb5b7fd64e69d1a655c0f5d956cb (diff)
parent011794130c8e4bb64dbc3c8c9b50849b278cdda3 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'tests/auto/gui/image/qimage/tst_qimage.cpp')
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 302180586e..4d41b5e873 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -3284,11 +3284,46 @@ void tst_QImage::metadataPassthrough()
QCOMPARE(mirrored.dotsPerMeterY(), a.dotsPerMeterY());
QCOMPARE(mirrored.devicePixelRatio(), a.devicePixelRatio());
+ QTransform t;
+ t.rotate(90);
+ QImage rotated = a.transformed(t);
+ QCOMPARE(rotated.text(QStringLiteral("Test")), a.text(QStringLiteral("Test")));
+ QCOMPARE(rotated.dotsPerMeterX(), a.dotsPerMeterX());
+ QCOMPARE(rotated.dotsPerMeterY(), a.dotsPerMeterY());
+ QCOMPARE(rotated.devicePixelRatio(), a.devicePixelRatio());
+
QImage swapped = a.rgbSwapped();
QCOMPARE(swapped.text(QStringLiteral("Test")), a.text(QStringLiteral("Test")));
QCOMPARE(swapped.dotsPerMeterX(), a.dotsPerMeterX());
QCOMPARE(swapped.dotsPerMeterY(), a.dotsPerMeterY());
QCOMPARE(swapped.devicePixelRatio(), a.devicePixelRatio());
+
+ QImage converted = a.convertToFormat(QImage::Format_RGB32);
+ QCOMPARE(converted.text(QStringLiteral("Test")), a.text(QStringLiteral("Test")));
+ QCOMPARE(converted.dotsPerMeterX(), a.dotsPerMeterX());
+ QCOMPARE(converted.dotsPerMeterY(), a.dotsPerMeterY());
+ QCOMPARE(converted.devicePixelRatio(), a.devicePixelRatio());
+
+ QImage copied = a.copy(0, 0, a.width() / 2, a.height() / 2);
+ QCOMPARE(copied.text(QStringLiteral("Test")), a.text(QStringLiteral("Test")));
+ QCOMPARE(copied.dotsPerMeterX(), a.dotsPerMeterX());
+ QCOMPARE(copied.dotsPerMeterY(), a.dotsPerMeterY());
+ QCOMPARE(copied.devicePixelRatio(), a.devicePixelRatio());
+
+ QImage alphaMask = a.createAlphaMask();
+ QCOMPARE(alphaMask.dotsPerMeterX(), a.dotsPerMeterX());
+ QCOMPARE(alphaMask.dotsPerMeterY(), a.dotsPerMeterY());
+ QCOMPARE(alphaMask.devicePixelRatio(), a.devicePixelRatio());
+
+ QImage heuristicMask = a.createHeuristicMask();
+ QCOMPARE(heuristicMask.dotsPerMeterX(), a.dotsPerMeterX());
+ QCOMPARE(heuristicMask.dotsPerMeterY(), a.dotsPerMeterY());
+ QCOMPARE(heuristicMask.devicePixelRatio(), a.devicePixelRatio());
+
+ QImage maskFromColor = a.createMaskFromColor(qRgb(0, 0, 0));
+ QCOMPARE(maskFromColor.dotsPerMeterX(), a.dotsPerMeterX());
+ QCOMPARE(maskFromColor.dotsPerMeterY(), a.dotsPerMeterY());
+ QCOMPARE(maskFromColor.devicePixelRatio(), a.devicePixelRatio());
}
void tst_QImage::pixelColor()