diff options
author | Toby Tomkins <toby.tomkins@nokia.com> | 2012-02-20 13:29:13 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-20 08:06:19 +0100 |
commit | 853e9ac787f2eaf603c7756726b2d90a143aa183 (patch) | |
tree | 28457c321f1e719883276f2a3970b667457840e5 /tests/auto/corelib/mimetypes/qmimedatabase | |
parent | 2465143f2498e039dc7a62da7427d0aace5ee29c (diff) |
Modify helper functions to remove embedded QSKIP call and return status.
The helper functions contained QSKIP macros which do not also skip their
parent function. These QSKIP function were removed and replaced with a
return success value.
Change-Id: I533f57842fc95beaeb1fcde5235678e9807db056
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/corelib/mimetypes/qmimedatabase')
-rw-r--r-- | tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index 12d6587dfb..fc86fa5431 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -714,20 +714,21 @@ void tst_QMimeDatabase::fromThreads() f.waitForFinished(); } -static void runUpdateMimeDatabase(const QString &path) // TODO make it a QMimeDatabase method? +static bool runUpdateMimeDatabase(const QString &path) // TODO make it a QMimeDatabase method? { const QString umd = QStandardPaths::findExecutable(QString::fromLatin1("update-mime-database")); if (umd.isEmpty()) - QSKIP("shared-mime-info not found, skipping mime.cache test"); + return false; QProcess proc; proc.setProcessChannelMode(QProcess::MergedChannels); // silence output proc.start(umd, QStringList() << path); proc.waitForFinished(); //qDebug() << "runUpdateMimeDatabase" << path; + return true; } -static void waitAndRunUpdateMimeDatabase(const QString &path) +static bool waitAndRunUpdateMimeDatabase(const QString &path) { QFileInfo mimeCacheInfo(path + QString::fromLatin1("/mime.cache")); if (mimeCacheInfo.exists()) { @@ -736,7 +737,7 @@ static void waitAndRunUpdateMimeDatabase(const QString &path) QTest::qSleep(200); } } - runUpdateMimeDatabase(path); + return runUpdateMimeDatabase(path); } static void checkHasMimeType(const QString &mimeType) @@ -775,7 +776,8 @@ void tst_QMimeDatabase::installNewGlobalMimeType() QFile::remove(destFile); //qDebug() << destFile; QVERIFY(QFile::copy(srcFile, destFile)); - waitAndRunUpdateMimeDatabase(mimeDir); + if (!waitAndRunUpdateMimeDatabase(mimeDir)) + QSKIP("shared-mime-info not found, skipping mime.cache test"); QCOMPARE(db.mimeTypeForFile(QLatin1String("foo.ymu"), QMimeDatabase::MatchExtension).name(), QString::fromLatin1("text/x-suse-ymu")); @@ -784,7 +786,8 @@ void tst_QMimeDatabase::installNewGlobalMimeType() // Now test removing it again QFile::remove(destFile); - waitAndRunUpdateMimeDatabase(mimeDir); + if (!waitAndRunUpdateMimeDatabase(mimeDir)) + QSKIP("shared-mime-info not found, skipping mime.cache test"); QCOMPARE(db.mimeTypeForFile(QLatin1String("foo.ymu"), QMimeDatabase::MatchExtension).name(), QString::fromLatin1("application/octet-stream")); QVERIFY(!db.mimeTypeForName(QLatin1String("text/x-suse-ymp")).isValid()); @@ -805,7 +808,8 @@ void tst_QMimeDatabase::installNewLocalMimeType() const QString destFile = destDir + fileName; QFile::remove(destFile); QVERIFY(QFile::copy(srcFile, destFile)); - runUpdateMimeDatabase(mimeDir); + if (!runUpdateMimeDatabase(mimeDir)) + QSKIP("shared-mime-info not found, skipping mime.cache test");; QCOMPARE(db.mimeTypeForFile(QLatin1String("foo.ymu"), QMimeDatabase::MatchExtension).name(), QString::fromLatin1("text/x-suse-ymu")); @@ -814,7 +818,8 @@ void tst_QMimeDatabase::installNewLocalMimeType() // Now test removing it again (note, this leaves a mostly-empty mime.cache file) QFile::remove(destFile); - waitAndRunUpdateMimeDatabase(mimeDir); + if (!waitAndRunUpdateMimeDatabase(mimeDir)) + QSKIP("shared-mime-info not found, skipping mime.cache test"); QCOMPARE(db.mimeTypeForFile(QLatin1String("foo.ymu"), QMimeDatabase::MatchExtension).name(), QString::fromLatin1("application/octet-stream")); QVERIFY(!db.mimeTypeForName(QLatin1String("text/x-suse-ymp")).isValid()); |