diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2011-11-29 04:52:52 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-05 17:17:50 +0100 |
commit | 53bd23d0e679746b78d0bcf9234e7b99983e6071 (patch) | |
tree | 51dd89aba98e57c026046fdfbe25ba72aab974a6 /test/base | |
parent | a9c3f18ebc1dbb1de5c7c9d1585347ed25cc2b52 (diff) | |
download | usdx-53bd23d0e679746b78d0bcf9234e7b99983e6071.tar.gz usdx-53bd23d0e679746b78d0bcf9234e7b99983e6071.tar.xz usdx-53bd23d0e679746b78d0bcf9234e7b99983e6071.zip |
ported from log4cxx to log4cpp
log4cxx depends on Apache Portable Runtime Utility Library, so we
switch to log4cpp with nearly the same features but with no
dependencies for easier porting to other platforms
Diffstat (limited to 'test/base')
-rw-r--r-- | test/base/image.cpp | 23 | ||||
-rw-r--r-- | test/base/songloading.cpp | 23 |
2 files changed, 23 insertions, 23 deletions
diff --git a/test/base/image.cpp b/test/base/image.cpp index 50fb50b0..e9e9d3d4 100644 --- a/test/base/image.cpp +++ b/test/base/image.cpp @@ -28,7 +28,7 @@ #include <exception> #include <cppunit/extensions/HelperMacros.h> -#include <log4cxx/logger.h> +#include <log4cpp/Category.hh> #include <SDL/SDL.h> @@ -43,7 +43,7 @@ namespace usdx CPPUNIT_TEST_EXCEPTION(testNotAnImage, usdx::ImageLoadException); CPPUNIT_TEST_SUITE_END(); private: - static log4cxx::LoggerPtr log; + static log4cpp::Category& log; public: void setUp() { @@ -57,7 +57,8 @@ namespace usdx { Image img("./testdata/test.bmp"); const SDL_Surface *surface = img.get_surface(); - LOG4CXX_DEBUG(log, "test.bmp: w = " << surface->w << "; h = " << surface->h); + log << log4cpp::Priority::DEBUG << "test.bmp: " << + "w = " << surface->w << "; h = " << surface->h; CPPUNIT_ASSERT(40 == surface->w); CPPUNIT_ASSERT(30 == surface->h); } @@ -66,7 +67,8 @@ namespace usdx { Image img("./testdata/test.jpg"); const SDL_Surface *surface = img.get_surface(); - LOG4CXX_DEBUG(log, "test.jpg: w = " << surface->w << "; h = " << surface->h); + log << log4cpp::Priority::DEBUG << "test.jpg: " << + "w = " << surface->w << "; h = " << surface->h; CPPUNIT_ASSERT(40 == surface->w); CPPUNIT_ASSERT(30 == surface->h); } @@ -75,7 +77,8 @@ namespace usdx { Image img("./testdata/test.png"); const SDL_Surface *surface = img.get_surface(); - LOG4CXX_DEBUG(log, "test.png: w = " << surface->w << "; h = " << surface->h); + log << log4cpp::Priority::DEBUG << "test.png: " << + "w = " << surface->w << "; h = " << surface->h; CPPUNIT_ASSERT(40 == surface->w); CPPUNIT_ASSERT(30 == surface->h); } @@ -84,7 +87,8 @@ namespace usdx { Image img("./testdata/test.gif"); const SDL_Surface *surface = img.get_surface(); - LOG4CXX_DEBUG(log, "test.gif: w = " << surface->w << "; h = " << surface->h); + log << log4cpp::Priority::DEBUG << "test.gif: " << + "w = " << surface->w << "; h = " << surface->h; CPPUNIT_ASSERT(40 == surface->w); CPPUNIT_ASSERT(30 == surface->h); } @@ -93,12 +97,13 @@ namespace usdx { Image img("./testdata/testsong_correct.txt"); const SDL_Surface *surface = img.get_surface(); - LOG4CXX_DEBUG(log, "testsong_correct.txt: w = " << surface->w << "; h = " << surface->h); + log << log4cpp::Priority::DEBUG << "testsong_correct.txt: " << + "w = " << surface->w << "; h = " << surface->h; } }; - log4cxx::LoggerPtr ImageTest::log = - log4cxx::Logger::getLogger("test.usdx.base.image"); + log4cpp::Category& ImageTest::log = + log4cpp::Category::getInstance("test.usdx.base.image"); CPPUNIT_TEST_SUITE_REGISTRATION(ImageTest); }; diff --git a/test/base/songloading.cpp b/test/base/songloading.cpp index ddb2756f..94690cc3 100644 --- a/test/base/songloading.cpp +++ b/test/base/songloading.cpp @@ -28,7 +28,8 @@ #include <cppunit/extensions/HelperMacros.h> #include "song.hpp" #include "songloading/songloader.hpp" -#include <log4cxx/logger.h> +#include <log4cpp/Category.hh> +#include <log4cpp/Priority.hh> namespace usdx { @@ -42,21 +43,19 @@ namespace usdx CPPUNIT_TEST_SUITE_END(); private: - int oldLogLevel; + log4cpp::Priority::Value oldLogLevel; public: void setUp() { // save old loglevel in case we want to disable logging - using namespace log4cxx; - oldLogLevel = Logger::getRootLogger()->getEffectiveLevel()->toInt(); + oldLogLevel = log4cpp::Category::getRoot().getPriority(); } void tearDown() { // set old loglevel in case we did disable logging - using namespace log4cxx; - Logger::getRootLogger()->setLevel(Level::toLevel(oldLogLevel)); + log4cpp::Category::getRoot().setPriority(oldLogLevel); } void testSongloadingTxtHeader() @@ -93,8 +92,7 @@ namespace usdx { // disable logging to avoid logmsgs when the exeption // is thrown - using namespace log4cxx; - Logger::getRootLogger()->setLevel(Level::getOff()); + log4cpp::Category::getRoot().setPriority(log4cpp::Priority::EMERG); Songloader::get_instance()-> load_header("testdata/testsong_missing_artist.txt"); @@ -104,8 +102,7 @@ namespace usdx { // disable logging to avoid logmsgs when the exeption // is thrown - using namespace log4cxx; - Logger::getRootLogger()->setLevel(Level::getOff()); + log4cpp::Category::getRoot().setPriority(log4cpp::Priority::EMERG); Songloader::get_instance()-> load_header("testdata/testsong_missing_title.txt"); @@ -115,8 +112,7 @@ namespace usdx { // disable logging to avoid logmsgs when the exeption // is thrown - using namespace log4cxx; - Logger::getRootLogger()->setLevel(Level::getOff()); + log4cpp::Category::getRoot().setPriority(log4cpp::Priority::EMERG); Songloader::get_instance()-> load_header("testdata/testsong_missing_mp3.txt"); @@ -127,8 +123,7 @@ namespace usdx { // disable logging to avoid logmsgs when the exeption // is thrown - using namespace log4cxx; - Logger::getRootLogger()->setLevel(Level::getOff()); + log4cpp::Category::getRoot().setPriority(log4cpp::Priority::EMERG); Songloader::get_instance()-> load_header("testdata/testsong_missing_bpm.txt"); |