From 62d25e4d4f02a53da25b9f14cc9e0244d6655312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 12 Feb 2013 12:58:08 +0100 Subject: Fixed QPixmapCache associating path with wrong QPixmap. QPixmap::load() would not detach, so multiple paths could get associated with the same QPixmap, causing the wrong pixmap to be shown. Task-number: QTBUG-29639 Change-Id: I064dd6a9611b5996853bec9fb20b6224a0adcf62 Reviewed-by: aavit --- tests/auto/gui/image/qpixmap/tst_qpixmap.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/auto/gui/image/qpixmap') diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index 0e86a425f3..f5298a1690 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -166,6 +166,7 @@ private slots: void loadAsBitmapOrPixmap(); void scaled_QTBUG19157(); + void detachOnLoad_QTBUG29639(); }; static bool lenientCompare(const QPixmap &actual, const QPixmap &expected) @@ -1488,5 +1489,19 @@ void tst_QPixmap::scaled_QTBUG19157() QVERIFY(!foo.isNull()); } +void tst_QPixmap::detachOnLoad_QTBUG29639() +{ + const QString prefix = QFINDTESTDATA("convertFromImage"); + + QPixmap a; + a.load(prefix + "/task31722_0/img1.png"); + a.load(prefix + "/task31722_0/img2.png"); + + QPixmap b; + b.load(prefix + "/task31722_0/img1.png"); + + QVERIFY(a.toImage() != b.toImage()); +} + QTEST_MAIN(tst_QPixmap) #include "tst_qpixmap.moc" -- cgit v1.2.3