summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-04-05 21:12:52 +0200
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-04-10 18:45:27 +0000
commitc7cbf216999cd833cae667b8c6fbfa65d33e8efd (patch)
tree4477267028e833a03a03d7c5b0ab3adcf7896bb7 /tests
parent4840ec7c68476c95d2d762ed5591f5e0b71ae3e3 (diff)
QPixmapCache: make sure to not overflow cache limit
The cost for the pixmap cache was calculated in bytes but setCacheLimit() takes the size in kilobytes. This lead to the situation that all values above 2097152 overflowed and disabled the caching completely. Fix it by calculating the cost in kilobytes as it is done in QGLContext. Task-number: QTBUG-45293 Change-Id: Ib8dc2360c8f3201ce0b615a04c38b5ccaa8fc6cf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp
index 8a2a35f86c..158530428d 100644
--- a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp
@@ -92,6 +92,9 @@ void tst_QPixmapCache::cacheLimit()
// it was between 2048 and 10240 last time I looked at it
QVERIFY(originalCacheLimit >= 1024 && originalCacheLimit <= 20480);
+ QPixmapCache::setCacheLimit(std::numeric_limits<int>::max());
+ QCOMPARE(QPixmapCache::cacheLimit(), std::numeric_limits<int>::max());
+
QPixmapCache::setCacheLimit(100);
QCOMPARE(QPixmapCache::cacheLimit(), 100);