diff options
Diffstat (limited to 'tests/auto/qpixmap/tst_qpixmap.cpp')
-rw-r--r-- | tests/auto/qpixmap/tst_qpixmap.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 51e6cf5..419518a1 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -129,10 +129,7 @@ private slots: void isNull(); void task_246446(); -#ifdef Q_WS_QWS void convertFromImageNoDetach(); -#endif - void convertFromImageDetach(); #if defined(Q_WS_WIN) @@ -185,6 +182,8 @@ private slots: void preserveDepth(); void splash_crash(); + void toImageDeepCopy(); + void loadAsBitmapOrPixmap(); }; @@ -911,11 +910,13 @@ void tst_QPixmap::isNull() } } -#ifdef Q_WS_QWS void tst_QPixmap::convertFromImageNoDetach() { + QPixmap randomPixmap(10, 10); + if (randomPixmap.pixmapData()->classId() != QPixmapData::RasterClass) + QSKIP("Test only valid for raster pixmaps", SkipAll); + //first get the screen format - QPixmap randomPixmap(10,10); QImage::Format screenFormat = randomPixmap.toImage().format(); QVERIFY(screenFormat != QImage::Format_Invalid); @@ -930,7 +931,6 @@ void tst_QPixmap::convertFromImageNoDetach() const QImage constCopy = copy; QVERIFY(constOrig.bits() == constCopy.bits()); } -#endif //Q_WS_QWS void tst_QPixmap::convertFromImageDetach() { @@ -1751,6 +1751,21 @@ void tst_QPixmap::loadAsBitmapOrPixmap() QVERIFY(bitmap.isQBitmap()); } +void tst_QPixmap::toImageDeepCopy() +{ + QPixmap pixmap(64, 64); + pixmap.fill(Qt::white); + + QPainter painter(&pixmap); + QImage first = pixmap.toImage(); + + painter.setBrush(Qt::black); + painter.drawEllipse(pixmap.rect()); + + QImage second = pixmap.toImage(); + + QVERIFY(first != second); +} QTEST_MAIN(tst_QPixmap) |