Changeset View
Changeset View
Standalone View
Standalone View
autotests/exiv2extractortest.cpp
Show All 16 Lines | |||||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | * | 18 | * | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "exiv2extractortest.h" | 21 | #include "exiv2extractortest.h" | ||
22 | #include "simpleextractionresult.h" | 22 | #include "simpleextractionresult.h" | ||
23 | #include "indexerextractortestsconfig.h" | 23 | #include "indexerextractortestsconfig.h" | ||
24 | #include "extractors/exiv2extractor.h" | 24 | #include "extractors/exiv2extractor.h" | ||
25 | #include "mimeutils.h" | ||||
25 | 26 | | |||
26 | #include <QDebug> | 27 | #include <QDebug> | ||
27 | #include <QTest> | 28 | #include <QTest> | ||
28 | #include <QDir> | 29 | #include <QDir> | ||
30 | #include <QMimeDatabase> | ||||
29 | 31 | | |||
30 | using namespace KFileMetaData; | 32 | using namespace KFileMetaData; | ||
31 | using namespace KFileMetaData::Property; | 33 | using namespace KFileMetaData::Property; | ||
32 | 34 | | |||
33 | QString Exiv2ExtractorTest::testFilePath(const QString& fileName) const | 35 | QString Exiv2ExtractorTest::testFilePath(const QString& fileName) const | ||
34 | { | 36 | { | ||
35 | return QLatin1String(INDEXER_TESTS_SAMPLE_FILES_PATH) + QLatin1Char('/') + fileName; | 37 | return QLatin1String(INDEXER_TESTS_SAMPLE_FILES_PATH) + QLatin1Char('/') + fileName; | ||
36 | } | 38 | } | ||
37 | 39 | | |||
38 | void Exiv2ExtractorTest::test() | 40 | void Exiv2ExtractorTest::test() | ||
39 | { | 41 | { | ||
40 | Exiv2Extractor plugin{this}; | 42 | Exiv2Extractor plugin{this}; | ||
41 | 43 | | |||
42 | SimpleExtractionResult result(testFilePath("test.jpg"), "image/jpeg"); | 44 | QString fileName = testFilePath(QStringLiteral("test.jpg")); | ||
45 | QMimeDatabase mimeDb; | ||||
46 | QString mimeType = MimeUtils::strictMimeType(fileName, mimeDb).name(); | ||||
47 | QVERIFY(plugin.mimetypes().contains(mimeType)); | ||||
48 | | ||||
49 | SimpleExtractionResult result(fileName, mimeType); | ||||
43 | plugin.extract(&result); | 50 | plugin.extract(&result); | ||
44 | 51 | | |||
45 | QCOMPARE(result.types().size(), 1); | 52 | QCOMPARE(result.types().size(), 1); | ||
46 | QCOMPARE(result.types().constFirst(), Type::Image); | 53 | QCOMPARE(result.types().constFirst(), Type::Image); | ||
47 | 54 | | |||
48 | QCOMPARE(result.properties().value(Artist).toString(), QStringLiteral("Artist")); | 55 | QCOMPARE(result.properties().value(Artist).toString(), QStringLiteral("Artist")); | ||
49 | QCOMPARE(result.properties().value(Description).toString(), QStringLiteral("Description")); | 56 | QCOMPARE(result.properties().value(Description).toString(), QStringLiteral("Description")); | ||
50 | QCOMPARE(result.properties().value(Copyright).toString(), QStringLiteral("Copyright")); | 57 | QCOMPARE(result.properties().value(Copyright).toString(), QStringLiteral("Copyright")); | ||
Show All 31 Lines |