Changeset View
Changeset View
Standalone View
Standalone View
autotests/taglibwritertest.cpp
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 58 | { | |||
---|---|---|---|---|---|
75 | data.add(Property::Composer, QString(QStringLiteral("Composer1") + stringSuffix)); | 75 | data.add(Property::Composer, QString(QStringLiteral("Composer1") + stringSuffix)); | ||
76 | data.add(Property::TrackNumber, 10); | 76 | data.add(Property::TrackNumber, 10); | ||
77 | data.add(Property::DiscNumber, 2); | 77 | data.add(Property::DiscNumber, 2); | ||
78 | data.add(Property::ReleaseYear, 1999); | 78 | data.add(Property::ReleaseYear, 1999); | ||
79 | data.add(Property::Genre, QString(QStringLiteral("Genre1") + stringSuffix)); | 79 | data.add(Property::Genre, QString(QStringLiteral("Genre1") + stringSuffix)); | ||
80 | data.add(Property::Comment, QString(QStringLiteral("Comment1") + stringSuffix)); | 80 | data.add(Property::Comment, QString(QStringLiteral("Comment1") + stringSuffix)); | ||
81 | data.add(Property::Copyright, QString(QStringLiteral("Copyright1") + stringSuffix)); | 81 | data.add(Property::Copyright, QString(QStringLiteral("Copyright1") + stringSuffix)); | ||
82 | 82 | | |||
83 | QFile testFile(testFilePath("test.jpg")); | ||||
84 | testFile.open(QIODevice::ReadOnly); | ||||
85 | const auto pictureData = testFile.readAll(); | ||||
86 | | ||||
87 | data.add(Property::FrontCover, pictureData); | ||||
88 | | ||||
83 | writerPlugin.write(data); | 89 | writerPlugin.write(data); | ||
84 | 90 | | |||
85 | KFileMetaData::SimpleExtractionResult result(temporaryFileName, mimeType, KFileMetaData::ExtractionResult::ExtractMetaData); | 91 | KFileMetaData::SimpleExtractionResult result(temporaryFileName, mimeType, ExtractionResult::ExtractMetaData | ExtractionResult::ExtractImageData); | ||
86 | extractResult(mimeType, result); | 92 | extractResult(mimeType, result); | ||
87 | 93 | | |||
88 | QCOMPARE(result.properties().value(Property::Title), QVariant(QStringLiteral("Title1") + stringSuffix)); | 94 | QCOMPARE(result.properties().value(Property::Title), QVariant(QStringLiteral("Title1") + stringSuffix)); | ||
89 | QCOMPARE(result.properties().value(Property::Artist), QVariant(QStringLiteral("Artist1") + stringSuffix)); | 95 | QCOMPARE(result.properties().value(Property::Artist), QVariant(QStringLiteral("Artist1") + stringSuffix)); | ||
90 | QCOMPARE(result.properties().value(Property::Album), QVariant(QStringLiteral("Album1") + stringSuffix)); | 96 | QCOMPARE(result.properties().value(Property::Album), QVariant(QStringLiteral("Album1") + stringSuffix)); | ||
91 | QCOMPARE(result.properties().value(Property::AlbumArtist), QVariant(QStringLiteral("AlbumArtist1") + stringSuffix)); | 97 | QCOMPARE(result.properties().value(Property::AlbumArtist), QVariant(QStringLiteral("AlbumArtist1") + stringSuffix)); | ||
92 | QCOMPARE(result.properties().value(Property::Composer), QVariant(QStringLiteral("Composer1") + stringSuffix)); | 98 | QCOMPARE(result.properties().value(Property::Composer), QVariant(QStringLiteral("Composer1") + stringSuffix)); | ||
93 | QCOMPARE(result.properties().value(Property::TrackNumber).toInt(), 10); | 99 | QCOMPARE(result.properties().value(Property::TrackNumber).toInt(), 10); | ||
94 | QCOMPARE(result.properties().value(Property::DiscNumber).toInt(), 2); | 100 | QCOMPARE(result.properties().value(Property::DiscNumber).toInt(), 2); | ||
95 | QCOMPARE(result.properties().value(Property::ReleaseYear).toInt(), 1999); | 101 | QCOMPARE(result.properties().value(Property::ReleaseYear).toInt(), 1999); | ||
96 | QCOMPARE(result.properties().value(Property::Genre), QVariant(QStringLiteral("Genre1") + stringSuffix)); | 102 | QCOMPARE(result.properties().value(Property::Genre), QVariant(QStringLiteral("Genre1") + stringSuffix)); | ||
97 | QCOMPARE(result.properties().value(Property::Comment), QVariant(QStringLiteral("Comment1") + stringSuffix)); | 103 | QCOMPARE(result.properties().value(Property::Comment), QVariant(QStringLiteral("Comment1") + stringSuffix)); | ||
98 | QCOMPARE(result.properties().value(Property::Copyright), QVariant(QStringLiteral("Copyright1") + stringSuffix)); | 104 | QCOMPARE(result.properties().value(Property::Copyright), QVariant(QStringLiteral("Copyright1") + stringSuffix)); | ||
105 | QCOMPARE(result.properties().value(Property::FrontCover), pictureData); | ||||
99 | 106 | | |||
100 | QFile::remove(temporaryFileName); | 107 | QFile::remove(temporaryFileName); | ||
101 | } | 108 | } | ||
102 | 109 | | |||
103 | void TagLibWriterTest::testCommonData_data() | 110 | void TagLibWriterTest::testCommonData_data() | ||
104 | { | 111 | { | ||
105 | // Add some unicode characters, use codepoints to avoid any issues with | 112 | // Add some unicode characters, use codepoints to avoid any issues with | ||
106 | // source encoding: "€µ" | 113 | // source encoding: "€µ" | ||
▲ Show 20 Lines • Show All 530 Lines • Show Last 20 Lines |