diff options
author | David Faure <david.faure@kdab.com> | 2023-09-12 23:26:47 +0200 |
---|---|---|
committer | David Faure <david.faure@kdab.com> | 2023-09-13 13:45:04 +0200 |
commit | 4e9944e6c8a456353d243ab268cb0f01ff006faa (patch) | |
tree | 688c3cde3f6247ddadb73823e188a67624de3eb8 /tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp | |
parent | 994311a66bd31983bec5d75d87f5e03f53f14def (diff) |
QMimeDatabase: collect glob patterns from all locations
A QMimeTypePrivate used to belong to a single provider, which would
provide the complete data for it.
But since the redesign in commit 7a5644d6481a3c1a741677, each provider
represents is a single mime directory, and the merging happens at the
QMimeDatabase level. So we need a QMimeType[Private] to be just a name
(a "request" for information about this mimetype) and the information
for that mimetype is retrieved on demand by querying the providers
and either stopping at the first one (e.g. for icons) or merging
the data from all of them (e.g. for glob patterns).
The XML provider was using QMimeTypePrivate as data storage,
give it its own struct QMimeTypeXMLData for that purpose instead.
Task-number: QTBUG-116905
Change-Id: Ia0e0d94aa899720dc0b908f40c25317473005af4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp')
-rw-r--r-- | tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index afd31210b2..660ebf9680 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -38,6 +38,7 @@ static const std::array additionalGlobalMimeFiles = { }; static const std::array additionalLocalMimeFiles = { + "add-extension.xml", // adds *.jnewext to image/jpeg "yast2-metapackage-handler-mimetypes.xml", "qml-again.xml", "text-x-objcsrc.xml", @@ -1229,6 +1230,11 @@ void tst_QMimeDatabase::installNewLocalMimeType() QCOMPARE(mimes.at(0).name(), u"video/webm"); } + // QTBUG-116905: globPatterns() should merge all locations + // add-extension.xml adds *.jnewext + const QStringList expectedJpegPatterns{ "*.jpg", "*.jpeg", "*.jpe", "*.jnewext" }; + QCOMPARE(db.mimeTypeForName(QStringLiteral("image/jpeg")).globPatterns(), expectedJpegPatterns); + // Now that we have two directories with mime definitions, check that everything still works inheritance(); if (QTest::currentTestFailed()) |