diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-07-19 10:13:26 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-07-19 18:19:46 +0000 |
commit | 6a1667bc4e6d1074f547434d714cd47ed8ebfc41 (patch) | |
tree | 84285121878205ec1f5a2c2f5ddff3a20c1fc27f /tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp | |
parent | e0e50532d29d02c8bcbab01dbfb72377102eaf8f (diff) |
Improve robustness of qml cache expiry checking
Instead of relying on two time stamps in the file system (source file and cache
file), make the determination on whether the source file is newer than the
cache solely depend on the time stamp of only the source file. This means that
when cache files are stored in archives for example their modification date
does not need to be preserved upon extraction.
Change-Id: I0b4362663868c6fb9bd7e106028161b2d67274d4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp')
-rw-r--r-- | tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp | 5 |
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)) { |