summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-08 17:15:55 +0200
committerLiang Qi <liang.qi@qt.io>2016-10-08 17:15:55 +0200
commit3e71810cf3153e4331fc075a73b6408adcf33654 (patch)
tree9f5fbb7a5dc2a902b380dd69a222c0f2cd6eb760 /tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
parent6feec9da93032d11a768802ac2187d9d4153b1ec (diff)
parentebd1046323615f22192055a94438bf85fc360ca3 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/network/access/qhttpnetworkconnection.cpp src/network/access/qhttpnetworkconnection_p.h Change-Id: I11f8641ef482efa8cee1b79977d19cc3182814b4
Diffstat (limited to 'tests/auto/gui/image/qpixmap/tst_qpixmap.cpp')
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index 6adfe05fb0..8dc6f901e6 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -1492,6 +1492,33 @@ void tst_QPixmap::loadAsBitmapOrPixmap()
QVERIFY(!bitmap.isNull());
QCOMPARE(bitmap.depth(), 1);
QVERIFY(bitmap.isQBitmap());
+
+ // check that a QBitmap stays a QBitmap even when loading fails:
+ ok = bitmap.load(QString());
+ QVERIFY(!ok);
+ QVERIFY(bitmap.isNull());
+ QVERIFY(bitmap.isQBitmap());
+
+ ok = bitmap.load("does not exist");
+ QVERIFY(!ok);
+ QVERIFY(bitmap.isNull());
+ QVERIFY(bitmap.isQBitmap());
+
+ ok = bitmap.load("does not exist.png");
+ QVERIFY(!ok);
+ QVERIFY(bitmap.isNull());
+ QVERIFY(bitmap.isQBitmap());
+
+ QTemporaryFile garbage;
+ QVERIFY(garbage.open());
+ const QString garbagePath = garbage.fileName();
+ garbage.write(reinterpret_cast<const char *>(&garbage), sizeof garbage);
+ garbage.close();
+
+ ok = bitmap.load(garbagePath);
+ QVERIFY(!ok);
+ QVERIFY(bitmap.isNull());
+ QVERIFY(bitmap.isQBitmap());
}
void tst_QPixmap::toImageDeepCopy()