2017-05-20 23:37:33 +02:00
|
|
|
#ifndef TAGPARSER_OVERALL_TESTS_H
|
|
|
|
#define TAGPARSER_OVERALL_TESTS_H
|
|
|
|
|
2018-03-06 21:01:43 +01:00
|
|
|
#include "./helper.h"
|
|
|
|
|
2018-03-05 17:49:29 +01:00
|
|
|
#include "../diagnostics.h"
|
2018-03-07 01:17:50 +01:00
|
|
|
#include "../mediafileinfo.h"
|
2018-03-05 17:49:29 +01:00
|
|
|
#include "../progressfeedback.h"
|
2018-03-07 01:17:50 +01:00
|
|
|
#include "../tagvalue.h"
|
2017-05-20 21:15:48 +02:00
|
|
|
|
2018-07-09 16:00:59 +02:00
|
|
|
#include <c++utilities/chrono/datetime.h>
|
|
|
|
#include <c++utilities/chrono/format.h>
|
2017-05-20 21:15:48 +02:00
|
|
|
#include <c++utilities/conversion/stringconversion.h>
|
2017-08-17 18:40:34 +02:00
|
|
|
#include <c++utilities/tests/testutils.h>
|
2019-06-10 22:49:11 +02:00
|
|
|
using namespace CppUtilities;
|
2017-05-20 21:15:48 +02:00
|
|
|
|
|
|
|
#include <cppunit/TestFixture.h>
|
2018-03-07 01:17:50 +01:00
|
|
|
#include <cppunit/extensions/HelperMacros.h>
|
2017-05-20 21:15:48 +02:00
|
|
|
|
|
|
|
#include <queue>
|
2018-03-07 01:17:50 +01:00
|
|
|
#include <string>
|
2017-05-20 21:15:48 +02:00
|
|
|
|
|
|
|
using namespace std;
|
2019-06-10 22:49:11 +02:00
|
|
|
using namespace CppUtilities::Literals;
|
2018-03-06 23:09:15 +01:00
|
|
|
using namespace TagParser;
|
2017-05-20 21:15:48 +02:00
|
|
|
using namespace CPPUNIT_NS;
|
|
|
|
|
2018-03-07 01:17:50 +01:00
|
|
|
enum class TagStatus { Original, TestMetaDataPresent, Removed };
|
2017-05-20 21:15:48 +02:00
|
|
|
|
|
|
|
namespace SimpleTestFlags {
|
2018-03-07 01:17:50 +01:00
|
|
|
enum TestFlag {
|
2017-05-20 21:15:48 +02:00
|
|
|
RemoveTag = 0x1,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief The OverallTests class tests reading and writing tags and parsing technical information
|
|
|
|
* for all supported container/tag formats.
|
|
|
|
*/
|
2018-03-07 01:17:50 +01:00
|
|
|
class OverallTests : public TestFixture {
|
2017-05-20 21:15:48 +02:00
|
|
|
CPPUNIT_TEST_SUITE(OverallTests);
|
|
|
|
CPPUNIT_TEST(testMp4Parsing);
|
|
|
|
CPPUNIT_TEST(testMp3Parsing);
|
|
|
|
CPPUNIT_TEST(testOggParsing);
|
|
|
|
CPPUNIT_TEST(testFlacParsing);
|
|
|
|
CPPUNIT_TEST(testMkvParsing);
|
|
|
|
CPPUNIT_TEST(testMp4Making);
|
|
|
|
CPPUNIT_TEST(testMp3Making);
|
|
|
|
CPPUNIT_TEST(testOggMaking);
|
|
|
|
CPPUNIT_TEST(testFlacMaking);
|
|
|
|
CPPUNIT_TEST(testMkvMakingWithDifferentSettings);
|
|
|
|
CPPUNIT_TEST(testMkvMakingNestedTags);
|
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
|
|
|
|
public:
|
2018-03-05 17:49:29 +01:00
|
|
|
OverallTests();
|
|
|
|
|
2019-12-15 19:44:07 +01:00
|
|
|
void setUp() override;
|
|
|
|
void tearDown() override;
|
2017-05-20 21:15:48 +02:00
|
|
|
|
|
|
|
private:
|
2018-03-07 01:17:50 +01:00
|
|
|
void parseFile(const string &path, void (OverallTests::*checkRoutine)(void));
|
|
|
|
void makeFile(const string &path, void (OverallTests::*modifyRoutine)(void), void (OverallTests::*checkRoutine)(void));
|
2017-05-20 21:15:48 +02:00
|
|
|
|
|
|
|
void checkMkvTestfile1();
|
|
|
|
void checkMkvTestfile2();
|
|
|
|
void checkMkvTestfile3();
|
|
|
|
void checkMkvTestfile4();
|
|
|
|
void checkMkvTestfile5();
|
|
|
|
void checkMkvTestfile6();
|
|
|
|
void checkMkvTestfile7();
|
|
|
|
void checkMkvTestfile8();
|
|
|
|
void checkMkvTestfileHandbrakeChapters();
|
|
|
|
void checkMkvTestfileNestedTags();
|
|
|
|
void checkMkvTestMetaData();
|
2017-05-23 00:52:56 +02:00
|
|
|
void checkMkvConstraints();
|
2017-05-20 21:15:48 +02:00
|
|
|
|
|
|
|
void checkMp4Testfile1();
|
|
|
|
void checkMp4Testfile2();
|
|
|
|
void checkMp4Testfile3();
|
|
|
|
void checkMp4Testfile4();
|
|
|
|
void checkMp4Testfile5();
|
2017-05-28 20:55:29 +02:00
|
|
|
void checkMp4Testfile6();
|
2018-07-09 16:00:59 +02:00
|
|
|
void checkMp4Testfile7();
|
2017-05-20 21:15:48 +02:00
|
|
|
void checkMp4TestMetaData();
|
2017-05-23 00:52:56 +02:00
|
|
|
void checkMp4Constraints();
|
2017-05-20 21:15:48 +02:00
|
|
|
|
|
|
|
void checkMp3Testfile1();
|
2018-07-01 02:04:29 +02:00
|
|
|
void checkMp3Testfile2();
|
2017-05-20 21:15:48 +02:00
|
|
|
void checkMp3TestMetaData();
|
|
|
|
void checkMp3PaddingConstraints();
|
|
|
|
|
|
|
|
void checkOggTestfile1();
|
|
|
|
void checkOggTestfile2();
|
|
|
|
void checkOggTestMetaData();
|
|
|
|
|
|
|
|
void checkFlacTestfile1();
|
|
|
|
void checkFlacTestfile2();
|
|
|
|
|
|
|
|
void setMkvTestMetaData();
|
|
|
|
void setMp4TestMetaData();
|
2018-07-01 23:06:36 +02:00
|
|
|
void setMp3TestMetaData1();
|
|
|
|
void setMp3TestMetaData2();
|
2017-05-20 21:15:48 +02:00
|
|
|
void setOggTestMetaData();
|
|
|
|
void removeAllTags();
|
|
|
|
void noop();
|
2017-06-06 23:26:20 +02:00
|
|
|
void alterMp4Tracks();
|
2017-05-28 20:55:29 +02:00
|
|
|
void removeSecondTrack();
|
2017-05-20 21:15:48 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
void testMkvParsing();
|
|
|
|
void testMp4Parsing();
|
|
|
|
void testMp3Parsing();
|
|
|
|
void testOggParsing();
|
|
|
|
void testFlacParsing();
|
|
|
|
void testMkvMakingWithDifferentSettings();
|
|
|
|
void testMkvMakingNestedTags();
|
|
|
|
void testMp4Making();
|
|
|
|
void testMp3Making();
|
|
|
|
void testOggMaking();
|
|
|
|
void testFlacMaking();
|
|
|
|
|
|
|
|
private:
|
|
|
|
MediaFileInfo m_fileInfo;
|
2017-05-28 20:55:29 +02:00
|
|
|
MediaFileInfo m_additionalFileInfo;
|
2018-03-05 17:49:29 +01:00
|
|
|
Diagnostics m_diag;
|
|
|
|
AbortableProgressFeedback m_progress;
|
2017-05-20 21:15:48 +02:00
|
|
|
TagValue m_testTitle;
|
|
|
|
TagValue m_testComment;
|
2019-06-01 23:01:53 +02:00
|
|
|
TagValue m_testCommentWithoutDescription;
|
2017-05-20 21:15:48 +02:00
|
|
|
TagValue m_testAlbum;
|
|
|
|
TagValue m_testPartNumber;
|
|
|
|
TagValue m_testTotalParts;
|
|
|
|
TagValue m_testPosition;
|
|
|
|
string m_testCover;
|
|
|
|
queue<TagValue> m_preservedMetaData;
|
|
|
|
TagStatus m_tagStatus;
|
2019-03-13 19:06:42 +01:00
|
|
|
std::uint16_t m_mode;
|
2017-05-23 00:52:56 +02:00
|
|
|
ElementPosition m_expectedTagPos;
|
|
|
|
ElementPosition m_expectedIndexPos;
|
2017-05-20 21:15:48 +02:00
|
|
|
};
|
2017-05-20 23:37:33 +02:00
|
|
|
|
|
|
|
#endif // TAGPARSER_OVERALL_TESTS_H
|