Mercurial > fife-parpg
comparison tests/core_tests/test_imagepool.cpp @ 85:35f6cfea565e
Fixed the unit tests so they will now compile and link with msvc2005. There are still a couple more changes needed to run them correctly.
author | vtchill@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 19 Jul 2008 04:56:28 +0000 |
parents | 90005975cdbb |
children | 72c25cc27d8b |
comparison
equal
deleted
inserted
replaced
84:a19c4ca20d97 | 85:35f6cfea565e |
---|---|
59 struct environment { | 59 struct environment { |
60 boost::shared_ptr<TimeManager> timemanager; | 60 boost::shared_ptr<TimeManager> timemanager; |
61 boost::shared_ptr<VFS> vfs; | 61 boost::shared_ptr<VFS> vfs; |
62 | 62 |
63 environment() | 63 environment() |
64 : timemanager(new TimeManager()) { | 64 : timemanager(new TimeManager()), vfs(new VFS()) { |
65 if (SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_TIMER) < 0) { | 65 if (SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_TIMER) < 0) { |
66 throw SDLException(SDL_GetError()); | 66 throw SDLException(SDL_GetError()); |
67 } | 67 } |
68 } | 68 } |
69 }; | 69 }; |
70 | 70 |
71 TEST(test_image_pool) | 71 TEST_FIXTURE(environment, test_image_pool) |
72 { | 72 { |
73 environment env; | |
74 RenderBackendSDL renderbackend; | 73 RenderBackendSDL renderbackend; |
75 | 74 |
76 boost::scoped_ptr<VFS> vfs(new VFS()); | |
77 vfs->addSource(new VFSDirectory(vfs.get())); | 75 vfs->addSource(new VFSDirectory(vfs.get())); |
78 | 76 |
79 renderbackend.init(); | 77 renderbackend.init(); |
80 renderbackend.createMainScreen(800, 600, 0, false); | 78 renderbackend.createMainScreen(800, 600, 0, false, "FIFE", ""); |
81 ImagePool pool; | 79 ImagePool pool; |
82 pool.addResourceLoader(new SubImageLoader()); | 80 pool.addResourceLoader(new SubImageLoader()); |
83 pool.addResourceLoader(new ImageLoader(vfs.get())); | 81 pool.addResourceLoader(new ImageLoader(vfs.get())); |
84 | 82 |
85 CHECK_EQUAL(0, pool.getResourceCount(RES_LOADED)); | 83 CHECK_EQUAL(0, pool.getResourceCount(RES_LOADED)); |
130 pool.clear(); | 128 pool.clear(); |
131 CHECK_EQUAL(0, pool.getResourceCount(RES_LOADED)); | 129 CHECK_EQUAL(0, pool.getResourceCount(RES_LOADED)); |
132 CHECK_EQUAL(0, pool.getResourceCount(RES_NON_LOADED)); | 130 CHECK_EQUAL(0, pool.getResourceCount(RES_NON_LOADED)); |
133 } | 131 } |
134 | 132 |
135 int main() { | 133 // need this here because SDL redefines |
134 // main to SDL_main in SDL_main.h | |
135 #ifdef main | |
136 #undef main | |
137 #endif | |
138 | |
139 int main() | |
140 { | |
136 return UnitTest::RunAllTests(); | 141 return UnitTest::RunAllTests(); |
137 } | 142 } |
143 | |
144 |