Mercurial > fife-parpg
diff tests/core_tests/test_imagepool.cpp @ 156:376b8afc9a18
Fixed a horrendous misconeception in the pool.
The map was sorted by pointer comparison.
Needs a bit cleanup, though.
author | phoku@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sun, 12 Oct 2008 20:30:09 +0000 |
parents | 72c25cc27d8b |
children | 64738befdf3b |
line wrap: on
line diff
--- a/tests/core_tests/test_imagepool.cpp Sun Oct 12 19:23:10 2008 +0000 +++ b/tests/core_tests/test_imagepool.cpp Sun Oct 12 20:30:09 2008 +0000 @@ -83,12 +83,14 @@ CHECK_EQUAL(0, pool.getResourceCount(RES_LOADED)); CHECK_EQUAL(0, pool.getResourceCount(RES_NON_LOADED)); - pool.addResourceFromLocation(ImageLocation(IMAGE_FILE)); + ImageLocation location(IMAGE_FILE); + pool.addResourceFromLocation(&location); CHECK_EQUAL(0, pool.getResourceCount(RES_LOADED)); CHECK_EQUAL(1, pool.getResourceCount(RES_NON_LOADED)); - ImageLocation location(SUBIMAGE_FILE); + + location = ImageLocation(SUBIMAGE_FILE); ImageLoader imgprovider(vfs.get()); - int fullImgInd = pool.addResourceFromLocation(ImageLocation(SUBIMAGE_FILE)); + int fullImgInd = pool.addResourceFromLocation(&location); CHECK_EQUAL(0, pool.getResourceCount(RES_LOADED)); CHECK_EQUAL(2, pool.getResourceCount(RES_NON_LOADED)); Image& img = pool.getImage(fullImgInd); @@ -102,7 +104,10 @@ int h = H / 12; location.setWidth(w); location.setHeight(h); - pool.addResourceFromLocation(location); + CHECK(w != 0 && h !=0); + + int subImgInd = pool.addResourceFromLocation(&location); + CHECK(fullImgInd != subImgInd); CHECK_EQUAL(1, pool.getResourceCount(RES_LOADED)); CHECK_EQUAL(2, pool.getResourceCount(RES_NON_LOADED));