[3] | 1 | #include <cppunit/extensions/TestFactoryRegistry.h> |
---|
| 2 | #include <cppunit/ui/text/TestRunner.h> |
---|
| 3 | #include "OgreException.h" |
---|
| 4 | #include "OgreLogManager.h" |
---|
| 5 | #include "OgreMaterialManager.h" |
---|
| 6 | #include "OgreCompositorManager.h" |
---|
| 7 | #include "OgreHighLevelGpuProgramManager.h" |
---|
| 8 | #include "OgreGpuProgramManager.h" |
---|
| 9 | |
---|
| 10 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 |
---|
| 11 | #define WIN32_LEAN_AND_MEAN |
---|
| 12 | #include "windows.h" |
---|
| 13 | #endif |
---|
| 14 | |
---|
| 15 | int main( int argc, char **argv) |
---|
| 16 | { |
---|
| 17 | std::auto_ptr<Ogre::LogManager> logMgr(new Ogre::LogManager()); |
---|
| 18 | logMgr->createLog("OgreTest.log", true, true); |
---|
| 19 | |
---|
| 20 | bool wasSuccessful = false; |
---|
| 21 | try { |
---|
| 22 | CppUnit::TextUi::TestRunner runner; |
---|
| 23 | CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); |
---|
| 24 | runner.addTest( registry.makeTest() ); |
---|
| 25 | wasSuccessful = runner.run( "", false ); |
---|
| 26 | } |
---|
| 27 | catch( Ogre::Exception& e ) { |
---|
| 28 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 |
---|
| 29 | MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL); |
---|
| 30 | #else |
---|
| 31 | std::cerr << "An exception has occured: " << e.getFullDescription(); |
---|
| 32 | #endif |
---|
| 33 | } |
---|
| 34 | catch( ... ) { |
---|
| 35 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 |
---|
| 36 | MessageBox( NULL, "Unknown exception", "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL); |
---|
| 37 | #else |
---|
| 38 | std::cerr << "An exception has occured: " << e.getFullDescription(); |
---|
| 39 | #endif |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | // shutdown and release managers that might have been created |
---|
| 43 | delete Ogre::HighLevelGpuProgramManager::getSingletonPtr(); |
---|
| 44 | delete Ogre::GpuProgramManager::getSingletonPtr(); |
---|
| 45 | delete Ogre::CompositorManager::getSingletonPtr(); |
---|
| 46 | delete Ogre::MaterialManager::getSingletonPtr(); |
---|
| 47 | delete Ogre::ResourceGroupManager::getSingletonPtr(); |
---|
| 48 | |
---|
| 49 | return wasSuccessful ? 0 : 1; |
---|
| 50 | } |
---|