aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmldiskcache
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qmldiskcache')
-rw-r--r--tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
index b4697a4a3b..f85f66378a 100644
--- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
+++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
@@ -31,6 +31,7 @@
#include <private/qv4compileddata_p.h>
#include <QQmlComponent>
#include <QQmlEngine>
+#include <QThread>
class tst_qmldiskcache: public QObject
{
@@ -63,6 +64,10 @@ struct TestCompiler
}
mappedFile.close();
+ // Qt API limits the precision of QFileInfo::modificationTime() to seconds, so to ensure that
+ // the newly written file has a modification date newer than an existing cache file, we must
+ // wait.
+ QThread::sleep(1);
{
QFile f(testFilePath);
if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate)) {