4 #include "../abstracttrack.h" 6 #include "../vorbis/vorbiscomment.h" 11 void OverallTests::checkOggTestfile1()
14 const auto tracks = m_fileInfo.
tracks();
15 CPPUNIT_ASSERT_EQUAL(2_st, tracks.size());
16 for (
const auto &track : tracks) {
17 switch (track->id()) {
20 CPPUNIT_ASSERT_EQUAL(GeneralMediaFormat::Theora, track->format().general);
24 CPPUNIT_ASSERT_EQUAL(GeneralMediaFormat::Vorbis, track->format().general);
25 CPPUNIT_ASSERT_EQUAL(static_cast<uint16>(2), track->channelCount());
26 CPPUNIT_ASSERT_EQUAL(44100u, track->samplingFrequency());
27 CPPUNIT_ASSERT_EQUAL(4, track->duration().minutes());
30 CPPUNIT_FAIL(
"unknown track ID");
33 const auto tags = m_fileInfo.
tags();
34 switch (m_tagStatus) {
37 CPPUNIT_ASSERT_EQUAL(1_st, tags.size());
38 CPPUNIT_ASSERT_EQUAL(
"ffmpeg2theora 0.13"s, tags.front()->value(
KnownField::Encoder).toString());
43 checkOggTestMetaData();
46 CPPUNIT_ASSERT_EQUAL(0_st, tags.size());
49 CPPUNIT_ASSERT(m_diag.
level() <= DiagLevel::Information);
55 void OverallTests::checkOggTestfile2()
58 const auto tracks = m_fileInfo.
tracks();
59 CPPUNIT_ASSERT_EQUAL(1_st, tracks.size());
60 for (
const auto &track : tracks) {
61 switch (track->id()) {
64 CPPUNIT_ASSERT_EQUAL(GeneralMediaFormat::Opus, track->format().general);
65 CPPUNIT_ASSERT_EQUAL(static_cast<uint16>(2), track->channelCount());
66 CPPUNIT_ASSERT_EQUAL(48000u, track->samplingFrequency());
67 CPPUNIT_ASSERT_EQUAL(1, track->duration().minutes());
70 CPPUNIT_FAIL(
"unknown track ID");
73 const auto tags = m_fileInfo.
tags();
74 switch (m_tagStatus) {
77 CPPUNIT_ASSERT_EQUAL(1_st, tags.size());
78 CPPUNIT_ASSERT_EQUAL(
"opusenc from opus-tools 0.1.6"s, tags.front()->value(
KnownField::Encoder).toString());
81 checkOggTestMetaData();
84 CPPUNIT_ASSERT_EQUAL(0_st, tags.size());
87 CPPUNIT_ASSERT(m_diag.
level() <= DiagLevel::Information);
93 void OverallTests::checkOggTestMetaData()
96 const auto tags = m_fileInfo.
tags();
98 CPPUNIT_ASSERT_EQUAL(1_st, tags.size());
99 CPPUNIT_ASSERT(tag !=
nullptr);
109 m_preservedMetaData.pop();
112 void OverallTests::setOggTestMetaData()
133 cerr << endl <<
"OGG parser" << endl;
136 parseFile(TestUtilities::testFilePath(
"mtx-test-data/ogg/qt4dance_medium.ogg"), &OverallTests::checkOggTestfile1);
137 parseFile(TestUtilities::testFilePath(
"mtx-test-data/opus/v-opus.ogg"), &OverallTests::checkOggTestfile2);
147 void OverallTests::testOggMaking()
153 for (m_mode = 0; m_mode != 0x2; ++m_mode) {
160 list<string> testConditions;
162 testConditions.emplace_back(
"removing tag");
164 testConditions.emplace_back(
"modifying tag");
166 cerr << endl <<
"OGG maker - testmode " << m_mode <<
": " << joinStrings(testConditions,
", ") << endl;
170 void (
OverallTests::*modifyRoutine)(void) = (m_mode &
RemoveTag) ? &OverallTests::removeAllTags : &OverallTests::setOggTestMetaData;
171 makeFile(TestUtilities::workingCopyPath(
"mtx-test-data/ogg/qt4dance_medium.ogg"), modifyRoutine, &OverallTests::checkOggTestfile1);
172 makeFile(TestUtilities::workingCopyPath(
"mtx-test-data/opus/v-opus.ogg"), modifyRoutine, &OverallTests::checkOggTestfile2);
DiagLevel level() const
Returns the worst diag level present in the container.
The OverallTests class tests reading and writing tags and parsing technical information for all suppo...
void testOggParsing()
Tests the Ogg parser via MediaFileInfo.
std::string toString(TagTextEncoding encoding=TagTextEncoding::Unspecified) const
Converts the value of the current TagValue object to its equivalent std::string representation.