diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2010-01-20 08:29:08 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2010-01-20 09:41:49 (GMT) |
commit | 8721d060a67a01ac891cab9d3d17aacf7373bcf0 (patch) | |
tree | ea6158b84dd0f96de1c8fc2695f7a436e20daf7d /tests/auto/qpixmap | |
parent | 7127f5ba2cc5729cfa12f5705e2dcfdcb99e1b91 (diff) | |
download | Qt-8721d060a67a01ac891cab9d3d17aacf7373bcf0.zip Qt-8721d060a67a01ac891cab9d3d17aacf7373bcf0.tar.gz Qt-8721d060a67a01ac891cab9d3d17aacf7373bcf0.tar.bz2 |
Fixed QBitmap::load to load into bitmap format again.
Task: http://bugreports.qt.nokia.com/browse/QTBUG-7468
Reviewed-by: Trond
Diffstat (limited to 'tests/auto/qpixmap')
-rw-r--r-- | tests/auto/qpixmap/tst_qpixmap.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 0164c9d..0d60ed0 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -171,6 +171,8 @@ private slots: void preserveDepth(); void splash_crash(); + + void loadAsBitmapOrPixmap(); }; static bool lenientCompare(const QPixmap &actual, const QPixmap &expected) @@ -1510,5 +1512,41 @@ void tst_QPixmap::preserveDepth() QCOMPARE(depth, source.depth()); } +void tst_QPixmap::loadAsBitmapOrPixmap() +{ + QImage tmp(10, 10, QImage::Format_RGB32); + tmp.save("tmp.png"); + + bool ok; + + // Check that we can load the pixmap as a pixmap and that it then turns into a pixmap + QPixmap pixmap("tmp.png"); + QVERIFY(!pixmap.isNull()); + QVERIFY(pixmap.depth() > 1); + QVERIFY(!pixmap.isQBitmap()); + + pixmap = QPixmap(); + ok = pixmap.load("tmp.png"); + QVERIFY(ok); + QVERIFY(!pixmap.isNull()); + QVERIFY(pixmap.depth() > 1); + QVERIFY(!pixmap.isQBitmap()); + + // The do the same check for bitmaps.. + QBitmap bitmap("tmp.png"); + QVERIFY(!bitmap.isNull()); + QVERIFY(bitmap.depth() == 1); + QVERIFY(bitmap.isQBitmap()); + + bitmap = QBitmap(); + ok = bitmap.load("tmp.png"); + QVERIFY(ok); + QVERIFY(!bitmap.isNull()); + QVERIFY(bitmap.depth() == 1); + QVERIFY(bitmap.isQBitmap()); +} + + + QTEST_MAIN(tst_QPixmap) #include "tst_qpixmap.moc" |