Commit a4a555ca authored by David Faure's avatar David Faure
Browse files

autotest: remove dependency on developer build of Qt

parent 676dabdd
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
#include <mimetypedata.h> #include <mimetypedata.h>
#include <mimetypewriter.h> #include <mimetypewriter.h>
extern Q_CORE_EXPORT int qmime_secondsBetweenChecks; // see qmimeprovider.cpp // Unfortunately this isn't available in non-developer builds of Qt...
//extern Q_CORE_EXPORT int qmime_secondsBetweenChecks; // see qmimeprovider.cpp
class FileTypesTest : public QObject class FileTypesTest : public QObject
{ {
...@@ -287,7 +288,9 @@ private Q_SLOTS: ...@@ -287,7 +288,9 @@ private Q_SLOTS:
QVERIFY(data.isDirty()); QVERIFY(data.isDirty());
QVERIFY(data.sync()); QVERIFY(data.sync());
MimeTypeWriter::runUpdateMimeDatabase(); MimeTypeWriter::runUpdateMimeDatabase();
qmime_secondsBetweenChecks = 0; // ensure QMimeDatabase sees it immediately // QMimeDatabase doesn't even try to update the cache if less than
// 5000 ms have passed (can't use qmime_secondsBetweenChecks)
QTest::qSleep(5000);
QMimeType mime = db.mimeTypeForName(mimeTypeName); QMimeType mime = db.mimeTypeForName(mimeTypeName);
QVERIFY(mime.isValid()); QVERIFY(mime.isValid());
QCOMPARE(mime.comment(), QStringLiteral("Fake MimeType")); QCOMPARE(mime.comment(), QStringLiteral("Fake MimeType"));
...@@ -308,6 +311,9 @@ private Q_SLOTS: ...@@ -308,6 +311,9 @@ private Q_SLOTS:
QVERIFY(MimeTypeWriter::hasDefinitionFile(mimeTypeName)); QVERIFY(MimeTypeWriter::hasDefinitionFile(mimeTypeName));
MimeTypeWriter::removeOwnMimeType(mimeTypeName); MimeTypeWriter::removeOwnMimeType(mimeTypeName);
MimeTypeWriter::runUpdateMimeDatabase(); MimeTypeWriter::runUpdateMimeDatabase();
// QMimeDatabase doesn't even try to update the cache if less than
// 5000 ms have passed (can't use qmime_secondsBetweenChecks)
QTest::qSleep(5000);
const QMimeType mime = db.mimeTypeForName(mimeTypeName); const QMimeType mime = db.mimeTypeForName(mimeTypeName);
QVERIFY2(!mime.isValid(), qPrintable(mimeTypeName)); QVERIFY2(!mime.isValid(), qPrintable(mimeTypeName));
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment