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.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index 79dc3f311a..b9d0adcd21 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -91,6 +91,7 @@ private slots:
void convertFromImage_data();
void convertFromImage();
+ void convertFromImageShouldDetach();
void testMetrics();
@@ -343,6 +344,20 @@ void tst_QPixmap::convertFromImage()
QCOMPARE(pix, res);
}
+void tst_QPixmap::convertFromImageShouldDetach()
+{
+ const QString prefix = QFINDTESTDATA("convertFromImage");
+ QImage img1;
+ QImage img2;
+ QVERIFY(img1.load(prefix + "/task31722_0/img1.png"));
+ QVERIFY(img2.load(prefix + "/task31722_0/img2.png"));
+ QPixmap pix = QPixmap::fromImage(img1);
+ QPixmap pix1 = pix;
+ pix.convertFromImage(img2);
+ QCOMPARE(pix, QPixmap::fromImage(img2));
+ QCOMPARE(pix1, QPixmap::fromImage(img1)); // unchanged
+}
+
void tst_QPixmap::scroll_data()
{
QTest::addColumn<QImage>("input");