From fc8f5afc874073f91d3770273e0a9164182d7897 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 11 Sep 2020 10:05:51 +0200 Subject: QMimeDatabase: fix handling of glob-deleteall Binary provider: It was not possible to remove the first glob in a local override, because the mainPattern handling would re-add the first glob back. XML provider: It didn't support glob-deleteall. Also, the order of the providers was wrong. We want to pick local overrides first, the internal DB has to go last in the list. Fixes: QTBUG-85436 Pick-to: 5.15 Change-Id: I9a4523f37cd962c730df9a6ed992bd01c075bf03 Reviewed-by: Thiago Macieira --- tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index 5ca89c7dc1..1c2597a1f2 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -985,11 +985,10 @@ void tst_QMimeDatabase::installNewGlobalMimeType() QCOMPARE(db.mimeTypeForFile(qmlTestFile).name(), QString::fromLatin1("text/x-qml")); - // ensure we can access the empty glob list { QMimeType objcsrc = db.mimeTypeForName(QStringLiteral("text/x-objcsrc")); QVERIFY(objcsrc.isValid()); - qDebug() << objcsrc.globPatterns(); + QCOMPARE(objcsrc.globPatterns(), QStringList()); } const QString fooTestFile = QLatin1String(RESOURCE_PREFIX "magic-and-hierarchy.foo"); @@ -1066,6 +1065,12 @@ void tst_QMimeDatabase::installNewLocalMimeType() QCOMPARE(db.mimeTypeForName(QLatin1String("text/x-SuSE-ymu")).comment(), QString("URL of a YaST Meta Package")); checkHasMimeType("text/x-suse-ymp"); + { // QTBUG-85436 + QMimeType objcsrc = db.mimeTypeForName(QStringLiteral("text/x-objcsrc")); + QVERIFY(objcsrc.isValid()); + QCOMPARE(objcsrc.globPatterns(), QStringList()); + } + // Test that a double-definition of a mimetype doesn't lead to sniffing ("conflicting globs"). const QString qmlTestFile = QLatin1String(RESOURCE_PREFIX "test.qml"); QVERIFY2(!qmlTestFile.isEmpty(), -- cgit v1.2.3