1 #include <cppunit/extensions/HelperMacros.h>
9 using namespace TagLib
;
11 class TestFileRef
: public CppUnit::TestFixture
13 CPPUNIT_TEST_SUITE(TestFileRef
);
14 CPPUNIT_TEST(testMusepack
);
15 CPPUNIT_TEST(testVorbis
);
16 CPPUNIT_TEST(testSpeex
);
17 CPPUNIT_TEST(testFLAC
);
18 CPPUNIT_TEST(testMP3
);
19 CPPUNIT_TEST(testTrueAudio
);
20 CPPUNIT_TEST_SUITE_END();
24 void fileRefSave(const string
&filename
, const string
&ext
)
26 string newname
= copyFile(filename
, ext
);
28 FileRef
*f
= new FileRef(newname
.c_str());
29 CPPUNIT_ASSERT(!f
->isNull());
30 f
->tag()->setArtist("test artist");
31 f
->tag()->setTitle("test title");
32 f
->tag()->setGenre("Test!");
33 f
->tag()->setAlbum("albummmm");
34 f
->tag()->setTrack(5);
35 f
->tag()->setYear(2020);
39 f
= new FileRef(newname
.c_str());
40 CPPUNIT_ASSERT(!f
->isNull());
41 CPPUNIT_ASSERT_EQUAL(f
->tag()->artist(), String("test artist"));
42 CPPUNIT_ASSERT_EQUAL(f
->tag()->title(), String("test title"));
43 CPPUNIT_ASSERT_EQUAL(f
->tag()->genre(), String("Test!"));
44 CPPUNIT_ASSERT_EQUAL(f
->tag()->album(), String("albummmm"));
45 CPPUNIT_ASSERT_EQUAL(f
->tag()->track(), TagLib::uint(5));
46 CPPUNIT_ASSERT_EQUAL(f
->tag()->year(), TagLib::uint(2020));
47 f
->tag()->setArtist("ttest artist");
48 f
->tag()->setTitle("ytest title");
49 f
->tag()->setGenre("uTest!");
50 f
->tag()->setAlbum("ialbummmm");
51 f
->tag()->setTrack(7);
52 f
->tag()->setYear(2080);
56 f
= new FileRef(newname
.c_str());
57 CPPUNIT_ASSERT(!f
->isNull());
58 CPPUNIT_ASSERT_EQUAL(f
->tag()->artist(), String("ttest artist"));
59 CPPUNIT_ASSERT_EQUAL(f
->tag()->title(), String("ytest title"));
60 CPPUNIT_ASSERT_EQUAL(f
->tag()->genre(), String("uTest!"));
61 CPPUNIT_ASSERT_EQUAL(f
->tag()->album(), String("ialbummmm"));
62 CPPUNIT_ASSERT_EQUAL(f
->tag()->track(), TagLib::uint(7));
63 CPPUNIT_ASSERT_EQUAL(f
->tag()->year(), TagLib::uint(2080));
71 fileRefSave("click", ".mpc");
76 fileRefSave("empty", ".ogg");
81 fileRefSave("empty", ".spx");
86 fileRefSave("no-tags", ".flac");
91 fileRefSave("xing", ".mp3");
96 fileRefSave("empty", ".tta");
101 CPPUNIT_TEST_SUITE_REGISTRATION(TestFileRef
);