aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRobin Nehls <nehls@mi.fu-berlin.de>2010-01-22 18:55:14 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-05 17:17:45 +0100
commit3a8686408b5b06e45b233c8acdf8fc23e9e5a4eb (patch)
tree9197aaee4eeb4dffa18ea5a7e4ceaaf2230195a4 /test
parentc2b751f45721e9dabe5c1dc59a536cb537aaa9b5 (diff)
downloadusdx-3a8686408b5b06e45b233c8acdf8fc23e9e5a4eb.tar.gz
usdx-3a8686408b5b06e45b233c8acdf8fc23e9e5a4eb.tar.xz
usdx-3a8686408b5b06e45b233c8acdf8fc23e9e5a4eb.zip
Added exeptiontests for songs with missing required headerfields.
Diffstat (limited to '')
-rw-r--r--test/base/songloading.cpp51
-rw-r--r--test/testdata/.testsong_correct.txt.swpbin12288 -> 0 bytes
-rwxr-xr-xtest/testdata/testsong_missing_artist.txt26
-rwxr-xr-xtest/testdata/testsong_missing_bpm.txt26
-rwxr-xr-xtest/testdata/testsong_missing_mp3.txt26
-rwxr-xr-xtest/testdata/testsong_missing_title.txt26
6 files changed, 155 insertions, 0 deletions
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);
diff --git a/test/testdata/.testsong_correct.txt.swp b/test/testdata/.testsong_correct.txt.swp
deleted file mode 100644
index 69be88a7..00000000
--- a/test/testdata/.testsong_correct.txt.swp
+++ /dev/null
Binary files differ
diff --git a/test/testdata/testsong_missing_artist.txt b/test/testdata/testsong_missing_artist.txt
new file mode 100755
index 00000000..0797c2a3
--- /dev/null
+++ b/test/testdata/testsong_missing_artist.txt
@@ -0,0 +1,26 @@
+#TITLE:Test Title
+#MP3:Test.mp3
+#BPM:42.23
+#GAP:10
+#BACKGROUND:Test[BG].jpg
+#COVER:Test[CO].jpg
+#GENRE:Test Genre
+#RELATIVE:no
+#EDITION:Test Edition
+#LANGUAGE:Cpp
+#VIDEO:Test[VD#12,3].mkv
+#VIDEOGAP:0
+#START:0
+#CREATOR:Test0r
+#YEAR:7
+#END:666
+#NOTESGAP:0
+#ENCODEING:UTF-8
+: 1 1 10 Test
+: 2 2 11 söng
+: 4 3 12 in
+- 11
+: 14 4 13 Pro
+: 18 5 14 gress
+: 23 6 15 ! ! 1 !
+E
diff --git a/test/testdata/testsong_missing_bpm.txt b/test/testdata/testsong_missing_bpm.txt
new file mode 100755
index 00000000..a9089525
--- /dev/null
+++ b/test/testdata/testsong_missing_bpm.txt
@@ -0,0 +1,26 @@
+#TITLE:Test Title
+#ARTIST:Test Ärtist
+#MP3:Test.mp3
+#GAP:10
+#BACKGROUND:Test[BG].jpg
+#COVER:Test[CO].jpg
+#GENRE:Test Genre
+#RELATIVE:no
+#EDITION:Test Edition
+#LANGUAGE:Cpp
+#VIDEO:Test[VD#12,3].mkv
+#VIDEOGAP:0
+#START:0
+#CREATOR:Test0r
+#YEAR:7
+#END:666
+#NOTESGAP:0
+#ENCODEING:UTF-8
+: 1 1 10 Test
+: 2 2 11 söng
+: 4 3 12 in
+- 11
+: 14 4 13 Pro
+: 18 5 14 gress
+: 23 6 15 ! ! 1 !
+E
diff --git a/test/testdata/testsong_missing_mp3.txt b/test/testdata/testsong_missing_mp3.txt
new file mode 100755
index 00000000..61be16fb
--- /dev/null
+++ b/test/testdata/testsong_missing_mp3.txt
@@ -0,0 +1,26 @@
+#TITLE:Test Title
+#ARTIST:Test Ärtist
+#BPM:42.23
+#GAP:10
+#BACKGROUND:Test[BG].jpg
+#COVER:Test[CO].jpg
+#GENRE:Test Genre
+#RELATIVE:no
+#EDITION:Test Edition
+#LANGUAGE:Cpp
+#VIDEO:Test[VD#12,3].mkv
+#VIDEOGAP:0
+#START:0
+#CREATOR:Test0r
+#YEAR:7
+#END:666
+#NOTESGAP:0
+#ENCODEING:UTF-8
+: 1 1 10 Test
+: 2 2 11 söng
+: 4 3 12 in
+- 11
+: 14 4 13 Pro
+: 18 5 14 gress
+: 23 6 15 ! ! 1 !
+E
diff --git a/test/testdata/testsong_missing_title.txt b/test/testdata/testsong_missing_title.txt
new file mode 100755
index 00000000..e9f8dc5c
--- /dev/null
+++ b/test/testdata/testsong_missing_title.txt
@@ -0,0 +1,26 @@
+#ARTIST:Test Ärtist
+#MP3:Test.mp3
+#BPM:42.23
+#GAP:10
+#BACKGROUND:Test[BG].jpg
+#COVER:Test[CO].jpg
+#GENRE:Test Genre
+#RELATIVE:no
+#EDITION:Test Edition
+#LANGUAGE:Cpp
+#VIDEO:Test[VD#12,3].mkv
+#VIDEOGAP:0
+#START:0
+#CREATOR:Test0r
+#YEAR:7
+#END:666
+#NOTESGAP:0
+#ENCODEING:UTF-8
+: 1 1 10 Test
+: 2 2 11 söng
+: 4 3 12 in
+- 11
+: 14 4 13 Pro
+: 18 5 14 gress
+: 23 6 15 ! ! 1 !
+E