diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-09-12 16:48:59 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-10-14 14:17:23 +0000 |
commit | a94452b1991a111ee44c298b9fdf9f63a9513ca5 (patch) | |
tree | aea42ae37b03fc9bbb5518a681ea0f8edd9445b7 /tests/auto/qml/qmldiskcache | |
parent | 330663c7b6d0faa7d10ec511d58b317a5ec37a19 (diff) |
Fix written time stamp in QML cache files for QRC sources
For loading and verification we compare against the time stamp of the
executable, so we should do the same thing when generating the cache
data.
Task-number: QTBUG-55926
Change-Id: If5922e76b8ae86185f6eacb6aeeb5c3afbc1f8d5
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'tests/auto/qml/qmldiskcache')
-rw-r--r-- | tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp index 8ccf4714ba..92b38c6ad8 100644 --- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp +++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp @@ -554,7 +554,16 @@ void tst_qmldiskcache::cacheResources() QCOMPARE(obj->property("value").toInt(), 20); } - QCOMPARE(QDir(qmlCacheDirectory).entryList(QDir::NoDotAndDotDot | QDir::Files).count(), 1); + const QStringList entries = QDir(qmlCacheDirectory).entryList(QDir::NoDotAndDotDot | QDir::Files); + QCOMPARE(entries.count(), 1); + + { + QFile cacheFile(qmlCacheDirectory + QLatin1Char('/') + entries.constFirst()); + QVERIFY2(cacheFile.open(QIODevice::ReadOnly), qPrintable(cacheFile.errorString())); + QV4::CompiledData::Unit unit; + QVERIFY(cacheFile.read(reinterpret_cast<char *>(&unit), sizeof(unit)) == sizeof(unit)); + QCOMPARE(qint64(unit.sourceTimeStamp), QFileInfo(QCoreApplication::applicationFilePath()).lastModified().toMSecsSinceEpoch()); + } } QTEST_MAIN(tst_qmldiskcache) |