summaryrefslogtreecommitdiffstats
path: root/tests/auto/qcontiguouscache
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@nokia.com>2010-02-12 08:15:10 (GMT)
committerZeno Albisser <zeno.albisser@nokia.com>2010-02-15 12:17:08 (GMT)
commit81dae1c0f37ed0b9e4ec6bc1febad273391f518e (patch)
tree84ac8cf3769258c3e4964aef0769b99344fb85f1 /tests/auto/qcontiguouscache
parent6c16e4ddd2f5397095ab892872b24bb717ee9147 (diff)
downloadQt-81dae1c0f37ed0b9e4ec6bc1febad273391f518e.zip
Qt-81dae1c0f37ed0b9e4ec6bc1febad273391f518e.tar.gz
Qt-81dae1c0f37ed0b9e4ec6bc1febad273391f518e.tar.bz2
Fix for using QContiguousCache with default constructor or capacity=0
Reviewed-by: Peter Hartmann
Diffstat (limited to 'tests/auto/qcontiguouscache')
-rw-r--r--tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp
index 5a23274..f64e815 100644
--- a/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp
+++ b/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp
@@ -71,6 +71,8 @@ private slots:
void contiguousCacheBenchmark();
void setCapacity();
+
+ void zeroCapacity();
};
QTEST_MAIN(tst_QContiguousCache)
@@ -476,4 +478,14 @@ void tst_QContiguousCache::setCapacity()
}
}
+void tst_QContiguousCache::zeroCapacity()
+{
+ QContiguousCache<int> contiguousCache;
+ QCOMPARE(contiguousCache.capacity(),0);
+ contiguousCache.setCapacity(10);
+ QCOMPARE(contiguousCache.capacity(),10);
+ contiguousCache.setCapacity(0);
+ QCOMPARE(contiguousCache.capacity(),0);
+}
+
#include "tst_qcontiguouscache.moc"