Changeset View
Changeset View
Standalone View
Standalone View
autotests/taglibextractortest.cpp
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 95 | { | |||
---|---|---|---|---|---|
96 | QFETCH(QString, fileType); | 96 | QFETCH(QString, fileType); | ||
97 | 97 | | |||
98 | QString fileName = testFilePath(QStringLiteral("test.") + fileType); | 98 | QString fileName = testFilePath(QStringLiteral("test.") + fileType); | ||
99 | QString mimeType = MimeUtils::strictMimeType(fileName, mimeDb).name(); | 99 | QString mimeType = MimeUtils::strictMimeType(fileName, mimeDb).name(); | ||
100 | TagLibExtractor plugin{this}; | 100 | TagLibExtractor plugin{this}; | ||
101 | 101 | | |||
102 | QVERIFY(plugin.mimetypes().contains(mimeType)); | 102 | QVERIFY(plugin.mimetypes().contains(mimeType)); | ||
103 | 103 | | |||
104 | SimpleExtractionResult result(fileName, mimeType); | 104 | SimpleExtractionResult result(fileName, mimeType, ExtractionResult::ExtractEverythingIncludingBinary); | ||
105 | plugin.extract(&result); | 105 | plugin.extract(&result); | ||
106 | 106 | | |||
107 | QCOMPARE(result.types().size(), 1); | 107 | QCOMPARE(result.types().size(), 1); | ||
108 | QCOMPARE(result.types().constFirst(), Type::Audio); | 108 | QCOMPARE(result.types().constFirst(), Type::Audio); | ||
109 | 109 | | |||
110 | QCOMPARE(result.properties().value(Property::Title), QVariant(QStringLiteral("Title"))); | 110 | QCOMPARE(result.properties().value(Property::Title), QVariant(QStringLiteral("Title"))); | ||
111 | QCOMPARE(result.properties().value(Property::Artist), QVariant(QStringLiteral("Artist"))); | 111 | QCOMPARE(result.properties().value(Property::Artist), QVariant(QStringLiteral("Artist"))); | ||
112 | QCOMPARE(result.properties().value(Property::Album), QVariant(QStringLiteral("Album"))); | 112 | QCOMPARE(result.properties().value(Property::Album), QVariant(QStringLiteral("Album"))); | ||
113 | QCOMPARE(result.properties().value(Property::Genre), QVariant(QStringLiteral("Genre"))); | 113 | QCOMPARE(result.properties().value(Property::Genre), QVariant(QStringLiteral("Genre"))); | ||
114 | QCOMPARE(result.properties().value(Property::Comment), QVariant(QStringLiteral("Comment"))); | 114 | QCOMPARE(result.properties().value(Property::Comment), QVariant(QStringLiteral("Comment"))); | ||
115 | QCOMPARE(result.properties().value(Property::TrackNumber).toInt(), 1); | 115 | QCOMPARE(result.properties().value(Property::TrackNumber).toInt(), 1); | ||
116 | QCOMPARE(result.properties().value(Property::ReleaseYear).toInt(), 2015); | 116 | QCOMPARE(result.properties().value(Property::ReleaseYear).toInt(), 2015); | ||
117 | | ||||
118 | QByteArray originalFrontCoverImage; | ||||
119 | QFile testFile(testFilePath("cover.jpg")); | ||||
120 | testFile.open(QIODevice::ReadOnly); | ||||
121 | originalFrontCoverImage = testFile.readAll(); | ||||
122 | | ||||
123 | QCOMPARE(result.properties().value(Property::FrontCover).toByteArray(), originalFrontCoverImage); | ||||
117 | } | 124 | } | ||
118 | 125 | | |||
119 | void TagLibExtractorTest::testCommonData_data() | 126 | void TagLibExtractorTest::testCommonData_data() | ||
120 | { | 127 | { | ||
121 | QTest::addColumn<QString>("fileType"); | 128 | QTest::addColumn<QString>("fileType"); | ||
122 | 129 | | |||
123 | QTest::addRow("aiff") | 130 | QTest::addRow("aiff") | ||
124 | << QStringLiteral("aif") | 131 | << QStringLiteral("aif") | ||
▲ Show 20 Lines • Show All 506 Lines • Show Last 20 Lines |