diff tests/core_tests/test_imagepool.cpp @ 148:72c25cc27d8b

For your convenience pools now have a function called purgeLoadedResources exposed to python which will delete all loaded resources that have a ref count of zero. You can use this after closing a map or something alike. It may however impact performance, as the next map may very well reload the same resources. Just be aware of that. :-)
author phoku@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 11 Oct 2008 06:05:11 +0000
parents 35f6cfea565e
children 376b8afc9a18
line wrap: on
line diff
--- a/tests/core_tests/test_imagepool.cpp	Thu Oct 09 13:36:13 2008 +0000
+++ b/tests/core_tests/test_imagepool.cpp	Sat Oct 11 06:05:11 2008 +0000
@@ -125,7 +125,12 @@
 	}
 	CHECK_EQUAL(3, pool.getResourceCount(RES_LOADED));
 	CHECK_EQUAL(0, pool.getResourceCount(RES_NON_LOADED));
-	pool.clear();
+
+	CHECK_EQUAL(3, pool.purgeLoadedResources() );
+
+	CHECK_EQUAL(0, pool.getResourceCount(RES_LOADED));
+	CHECK_EQUAL(3, pool.getResourceCount(RES_NON_LOADED));
+	pool.reset();
 	CHECK_EQUAL(0, pool.getResourceCount(RES_LOADED));
 	CHECK_EQUAL(0, pool.getResourceCount(RES_NON_LOADED));
 }