QMimeDatabase: pass MatchMode down, to fix MatchContent.

Task-number: QTBUG-29702
Change-Id: I2f1538adbf8e7a5edfc4276585bf4ef04ce69874
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
David Faure 2013-02-21 12:11:35 +01:00 committed by The Qt Project
parent ebc4fb452a
commit f2e8a81227
2 changed files with 5 additions and 1 deletions

View File

@ -418,7 +418,7 @@ QMimeType QMimeDatabase::mimeTypeForFile(const QString &fileName, MatchMode mode
} else {
// Implemented as a wrapper around mimeTypeForFile(QFileInfo), so no mutex.
QFileInfo fileInfo(fileName);
return mimeTypeForFile(fileInfo);
return mimeTypeForFile(fileInfo, mode);
}
}

View File

@ -442,6 +442,8 @@ void tst_QMimeDatabase::mimeTypeForFileWithContent()
txtTempFile.close();
mime = db.mimeTypeForFile(txtTempFileName);
QCOMPARE(mime.name(), QString::fromLatin1("text/plain"));
mime = db.mimeTypeForFile(txtTempFileName, QMimeDatabase::MatchContent);
QCOMPARE(mime.name(), QString::fromLatin1("application/smil"));
}
// Test what happens with an incorrect path
@ -714,6 +716,8 @@ void tst_QMimeDatabase::findByData()
QFileInfo info(filePath);
QString mimeForInfo = database.mimeTypeForFile(info, QMimeDatabase::MatchContent).name();
QCOMPARE(mimeForInfo, resultMimeTypeName);
QString mimeForFile = database.mimeTypeForFile(filePath, QMimeDatabase::MatchContent).name();
QCOMPARE(mimeForFile, resultMimeTypeName);
}
void tst_QMimeDatabase::findByFile_data()