1 #include "SayonaraTest.h"
2 
3 #include "Utils/Tagging/Tagging.h"
4 #include "Utils/Tagging/TaggingLyrics.h"
5 #include "Utils/FileUtils.h"
6 #include "Utils/MetaData/MetaData.h"
7 #include "AbstractTaggingTest.h"
8 
9 class LyricsTest : public AbstractTaggingTest
10 {
11 	Q_OBJECT
12 
13 public:
LyricsTest()14 	LyricsTest() :
15 		AbstractTaggingTest("LyricsTest")
16 	{}
17 
18 	~LyricsTest() override = default;
19 
20 private:
21 	void run_test(const QString& filename) override;
22 
23 private slots:
24 	void id3_test();
25 	void xiph_test();
26 };
27 
run_test(const QString & filename)28 void LyricsTest::run_test(const QString& filename)
29 {
30 	const QString lyrics = QString::fromUtf8("Those are söme lyrics фыва");
31 	MetaData md(filename);
32 	Tagging::Utils::getMetaDataOfFile(md);
33 
34 	bool wroteLyrics = Tagging::writeLyrics(md, lyrics);
35 	QVERIFY(wroteLyrics == true);
36 
37 	QString readLyrics;
38 	bool success = Tagging::extractLyrics(md, readLyrics);
39 
40 	QVERIFY(success == true);
41 	QVERIFY(lyrics.compare(readLyrics) == 0);
42 }
43 
id3_test()44 void LyricsTest::id3_test()
45 {
46 	AbstractTaggingTest::id3_test();
47 }
48 
xiph_test()49 void LyricsTest::xiph_test()
50 {
51 	AbstractTaggingTest::xiph_test();
52 }
53 
54 QTEST_GUILESS_MAIN(LyricsTest)
55 
56 #include "LyricsTest.moc"
57 
58 
59