QMimeDatabase: fix regression in alias resolving
The refactoring to support multiple providers broke alias resolving (e.g. "text/directory" would be an invalid mimetype, instead of being resolved to "text/vcard"). The unittest didn't catch it because most of it was running with a single mime directory (and therefore a single provider, in the new model). Fixed by re-running a number of test methods once we have a second mime directory. Change-Id: Ib5da89ba79c11ed41813b2aff4bc71c30afcde7d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
592b0a37f5
commit
f2eb7b0204
|
|
@ -401,7 +401,7 @@ QString QMimeBinaryProvider::resolveAlias(const QString &name)
|
|||
return QLatin1String(mimeType);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
return QString();
|
||||
}
|
||||
|
||||
void QMimeBinaryProvider::addAliases(const QString &name, QStringList &result)
|
||||
|
|
@ -729,7 +729,7 @@ void QMimeXMLProvider::addAliases(const QString &name, QStringList &result)
|
|||
|
||||
QString QMimeXMLProvider::resolveAlias(const QString &name)
|
||||
{
|
||||
return m_aliases.value(name, name);
|
||||
return m_aliases.value(name);
|
||||
}
|
||||
|
||||
void QMimeXMLProvider::addAlias(const QString &alias, const QString &name)
|
||||
|
|
|
|||
|
|
@ -1045,6 +1045,31 @@ void tst_QMimeDatabase::installNewLocalMimeType()
|
|||
QCOMPARE(db.mimeTypeForFile(qmlTestFile).name(),
|
||||
QString::fromLatin1("text/x-qml"));
|
||||
|
||||
// Now that we have two directories with mime definitions, check that everything still works
|
||||
inheritance();
|
||||
if (QTest::currentTestFailed())
|
||||
return;
|
||||
|
||||
aliases();
|
||||
if (QTest::currentTestFailed())
|
||||
return;
|
||||
|
||||
icons();
|
||||
if (QTest::currentTestFailed())
|
||||
return;
|
||||
|
||||
comment();
|
||||
if (QTest::currentTestFailed())
|
||||
return;
|
||||
|
||||
mimeTypeForFileWithContent();
|
||||
if (QTest::currentTestFailed())
|
||||
return;
|
||||
|
||||
mimeTypeForName();
|
||||
if (QTest::currentTestFailed())
|
||||
return;
|
||||
|
||||
// Now test removing local mimetypes
|
||||
for (int i = 1 ; i <= 3 ; ++i)
|
||||
QFile::remove(destDir + QStringLiteral("invalid-magic%1.xml").arg(i));
|
||||
|
|
|
|||
Loading…
Reference in New Issue