3 #include "../abstracttrack.h" 10 void OverallTests::checkFlacTestfile1()
13 const auto tracks = m_fileInfo.
tracks();
14 CPPUNIT_ASSERT(tracks.size() == 1);
15 for (
const auto &track : tracks) {
18 CPPUNIT_ASSERT(track->channelCount() == 2);
19 CPPUNIT_ASSERT(track->samplingFrequency() == 44100);
20 CPPUNIT_ASSERT(track->bitsPerSample() == 16);
21 CPPUNIT_ASSERT(track->duration().minutes() == 4);
23 const auto tags = m_fileInfo.
tags();
24 switch (m_tagStatus) {
27 CPPUNIT_ASSERT(tags.size() == 1);
30 CPPUNIT_ASSERT(tags.front()->value(
KnownField::Album).toString() ==
"Don't Go Away (Apple Lossless)");
31 CPPUNIT_ASSERT(tags.front()->value(
KnownField::Genre).toString() ==
"Alternative & Punk");
41 checkOggTestMetaData();
44 CPPUNIT_ASSERT_EQUAL(0_st, tags.size());
47 CPPUNIT_ASSERT(m_diag.
level() <= DiagLevel::Information);
54 void OverallTests::checkFlacTestfile2()
57 const auto tracks = m_fileInfo.
tracks();
58 CPPUNIT_ASSERT(tracks.size() == 1);
59 for (
const auto &track : tracks) {
62 CPPUNIT_ASSERT(track->channelCount() == 2);
63 CPPUNIT_ASSERT(track->samplingFrequency() == 44100);
64 CPPUNIT_ASSERT(track->bitsPerSample() == 16);
65 CPPUNIT_ASSERT(track->duration().minutes() == 4);
67 const auto tags = m_fileInfo.
tags();
68 switch (m_tagStatus) {
70 CPPUNIT_ASSERT(tags.size() == 1);
73 checkOggTestMetaData();
76 CPPUNIT_ASSERT_EQUAL(0_st, tags.size());
81 bool gotMessageAboutMissingVorbisComment =
false;
82 for (
const auto &msg : m_diag) {
83 if (msg.level() == DiagLevel::Critical) {
84 CPPUNIT_ASSERT_EQUAL(
"OGG page after FLAC-to-Ogg mapping header doesn't contain Vorbis comment."s, msg.message());
85 gotMessageAboutMissingVorbisComment =
true;
88 CPPUNIT_ASSERT(msg.level() <= DiagLevel::Information);
90 CPPUNIT_ASSERT(gotMessageAboutMissingVorbisComment);
92 CPPUNIT_ASSERT(m_diag.level() <= DiagLevel::Information);
101 cerr << endl <<
"FLAC parser" << endl;
104 parseFile(TestUtilities::testFilePath(
"flac/test.flac"), &OverallTests::checkFlacTestfile1);
105 parseFile(TestUtilities::testFilePath(
"flac/test.ogg"), &OverallTests::checkFlacTestfile2);
113 void OverallTests::testFlacMaking()
119 for (m_mode = 0; m_mode != 0x2; ++m_mode) {
125 list<string> testConditions;
127 testConditions.emplace_back(
"removing tag");
129 testConditions.emplace_back(
"modifying tag");
131 cerr << endl <<
"FLAC maker - testmode " << m_mode <<
": " << joinStrings(testConditions,
", ") << endl;
135 void (
OverallTests::*modifyRoutine)(void) = (m_mode &
RemoveTag) ? &OverallTests::removeAllTags : &OverallTests::setOggTestMetaData;
136 makeFile(TestUtilities::workingCopyPath(
"flac/test.flac"), modifyRoutine, &OverallTests::checkFlacTestfile1);
137 makeFile(TestUtilities::workingCopyPath(
"flac/test.ogg"), modifyRoutine, &OverallTests::checkFlacTestfile2);
void testFlacParsing()
Tests the FLAC parser via MediaFileInfo.
The OverallTests class tests reading and writing tags and parsing technical information for all suppo...