From fea706df68e57c77c8f7e9f4e4d2bb19544dea73 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 7 Jun 2023 17:34:59 +0200 Subject: [PATCH] tst_QPixmapCache: QVERIFY a failed replace() Between the find() == 0 obfuscation (since fixed) and this unchecked replace(), it took me way too much time to figure out what was going on: the key passed has been invalidated by the setCacheLimit(0). Now that we QVERIFY that the replace() _fails_, it's much easier to backtrack and figure out why it does so and why, consequently, the following find() is also expected to fail. As a drive-by, reorder two lines so the grouping becomes clearer (blocks now both headed by setCacheLimit()). Change-Id: I434b65fc13c3fed6512036efeb98d738eeb2a13d Reviewed-by: Volker Hilsheimer (cherry picked from commit 0e96dd3464bc2e03d66ebb574a7a5352942ffdb2) --- tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp index 84b48317686..b215e127cea 100644 --- a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp +++ b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp @@ -112,9 +112,9 @@ void tst_QPixmapCache::setCacheLimit() QPixmapCache::setCacheLimit(0); QVERIFY(!QPixmapCache::find(key, p1)); - p1 = new QPixmap(2, 3); QPixmapCache::setCacheLimit(1000); - QPixmapCache::replace(key, *p1); + p1 = new QPixmap(2, 3); + QVERIFY(!QPixmapCache::replace(key, *p1)); QVERIFY(!QPixmapCache::find(key, p1)); delete p1;