From 3a8686408b5b06e45b233c8acdf8fc23e9e5a4eb Mon Sep 17 00:00:00 2001 From: Robin Nehls Date: Fri, 22 Jan 2010 18:55:14 +0100 Subject: Added exeptiontests for songs with missing required headerfields. --- test/base/songloading.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'test/base/songloading.cpp') diff --git a/test/base/songloading.cpp b/test/base/songloading.cpp index 8c17d64a..b0eae877 100644 --- a/test/base/songloading.cpp +++ b/test/base/songloading.cpp @@ -35,6 +35,10 @@ namespace usdx class SongloadingTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(SongloadingTest); CPPUNIT_TEST(testSongloadingTxtHeader); + CPPUNIT_TEST_EXCEPTION(testSongloadingTxtMissingHeaderFieldArtist, MissingSongTagException); + CPPUNIT_TEST_EXCEPTION(testSongloadingTxtMissingHeaderFieldTitle, MissingSongTagException); + CPPUNIT_TEST_EXCEPTION(testSongloadingTxtMissingHeaderFieldMp3, MissingSongTagException); + CPPUNIT_TEST_EXCEPTION(testSongloadingTxtMissingHeaderFieldBpm, MissingSongTagException); CPPUNIT_TEST_SUITE_END(); private: @@ -82,6 +86,53 @@ namespace usdx delete song; } + + void testSongloadingTxtMissingHeaderFieldArtist() + { + // disable logging to avoid logmsgs when the exeption + // is thrown + using namespace log4cxx; + Logger::getRootLogger()->setLevel(Level::getOff()); + + Songloader::get_instance()-> + load_header("testdata/testsong_missing_artist.txt"); + } + + void testSongloadingTxtMissingHeaderFieldTitle() + { + // disable logging to avoid logmsgs when the exeption + // is thrown + using namespace log4cxx; + Logger::getRootLogger()->setLevel(Level::getOff()); + + Songloader::get_instance()-> + load_header("testdata/testsong_missing_title.txt"); + } + + void testSongloadingTxtMissingHeaderFieldMp3() + { + // disable logging to avoid logmsgs when the exeption + // is thrown + using namespace log4cxx; + Logger::getRootLogger()->setLevel(Level::getOff()); + + Songloader::get_instance()-> + load_header("testdata/testsong_missing_mp3.txt"); + + } + + void testSongloadingTxtMissingHeaderFieldBpm() + { + // disable logging to avoid logmsgs when the exeption + // is thrown + using namespace log4cxx; + Logger::getRootLogger()->setLevel(Level::getOff()); + + Songloader::get_instance()-> + load_header("testdata/testsong_missing_bpm.txt"); + } + + }; CPPUNIT_TEST_SUITE_REGISTRATION(SongloadingTest); -- cgit v1.2.3