From: Tsuda Kageyu Date: Sat, 6 Feb 2016 12:32:03 +0000 (+0900) Subject: Test if FileRef chooses a correct File type. X-Git-Tag: v1.11beta2~34 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cc2ccbc20c0cbda37ef4e397e6dbfef81f44792a;p=taglib Test if FileRef chooses a correct File type. --- diff --git a/tests/test_fileref.cpp b/tests/test_fileref.cpp index 16ae3a16..2313eb59 100644 --- a/tests/test_fileref.cpp +++ b/tests/test_fileref.cpp @@ -30,6 +30,14 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include "utils.h" #include @@ -73,6 +81,7 @@ class TestFileRef : public CppUnit::TestFixture public: + template void fileRefSave(const string &filename, const string &ext) { ScopedFileCopy copy(filename, ext); @@ -80,6 +89,7 @@ public: { FileRef f(newname.c_str()); + CPPUNIT_ASSERT(dynamic_cast(f.file())); CPPUNIT_ASSERT(!f.isNull()); f.tag()->setArtist("test artist"); f.tag()->setTitle("test title"); @@ -119,6 +129,7 @@ public: { FileStream fs(newname.c_str()); FileRef f(&fs); + CPPUNIT_ASSERT(dynamic_cast(f.file())); CPPUNIT_ASSERT(!f.isNull()); CPPUNIT_ASSERT_EQUAL(f.tag()->artist(), String("ttest artist")); CPPUNIT_ASSERT_EQUAL(f.tag()->title(), String("ytest title")); @@ -131,81 +142,77 @@ public: void testMusepack() { - fileRefSave("click", ".mpc"); + fileRefSave("click", ".mpc"); } void testASF() { - fileRefSave("silence-1", ".wma"); + fileRefSave("silence-1", ".wma"); } void testVorbis() { - fileRefSave("empty", ".ogg"); + fileRefSave("empty", ".ogg"); } void testSpeex() { - fileRefSave("empty", ".spx"); + fileRefSave("empty", ".spx"); } void testFLAC() { - fileRefSave("no-tags", ".flac"); + fileRefSave("no-tags", ".flac"); } void testMP3() { - fileRefSave("xing", ".mp3"); + fileRefSave("xing", ".mp3"); } void testTrueAudio() { - fileRefSave("empty", ".tta"); + fileRefSave("empty", ".tta"); } void testMP4_1() { - fileRefSave("has-tags", ".m4a"); + fileRefSave("has-tags", ".m4a"); } void testMP4_2() { - fileRefSave("no-tags", ".m4a"); + fileRefSave("no-tags", ".m4a"); } void testMP4_3() { - fileRefSave("no-tags", ".3g2"); + fileRefSave("no-tags", ".3g2"); } void testMP4_4() { - fileRefSave("blank_video", ".m4v"); + fileRefSave("blank_video", ".m4v"); } void testWav() { - fileRefSave("empty", ".wav"); + fileRefSave("empty", ".wav"); } void testOGA_FLAC() { - FileRef f(TEST_FILE_PATH_C("empty_flac.oga")); - CPPUNIT_ASSERT(dynamic_cast(f.file()) == NULL); - CPPUNIT_ASSERT(dynamic_cast(f.file()) != NULL); + fileRefSave("empty_flac", ".oga"); } void testOGA_Vorbis() { - FileRef f(TEST_FILE_PATH_C("empty_vorbis.oga")); - CPPUNIT_ASSERT(dynamic_cast(f.file()) != NULL); - CPPUNIT_ASSERT(dynamic_cast(f.file()) == NULL); + fileRefSave("empty_vorbis", ".oga"); } void testAPE() { - fileRefSave("mac-399", ".ape"); + fileRefSave("mac-399", ".ape"); } void testUnsupported()