aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qv4compileddata.cpp2
-rw-r--r--tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp21
2 files changed, 21 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index e815c41a86..f8668b48e4 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -397,7 +397,7 @@ bool CompilationUnit::loadFromDisk(const QUrl &url, EvalISelFactory *iselFactory
return false;
}
- const QString sourcePath = url.toLocalFile();
+ const QString sourcePath = QQmlFile::urlToLocalFileOrQrc(url);
QScopedPointer<CompilationUnitMapper> cacheFile(new CompilationUnitMapper());
CompiledData::Unit *mappedUnit = cacheFile->open(cacheFilePath(url), sourcePath, errorString);
diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
index f8698f0afa..8af446173d 100644
--- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
+++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
@@ -549,7 +549,6 @@ void tst_qmldiskcache::cacheResources()
{
CleanlyLoadingComponent component(&engine, QUrl("qrc:/test.qml"));
- qDebug() << component.errorString();
QScopedPointer<QObject> obj(component.create());
QVERIFY(!obj.isNull());
QCOMPARE(obj->property("value").toInt(), 20);
@@ -558,17 +557,37 @@ void tst_qmldiskcache::cacheResources()
const QStringList entries = QDir(qmlCacheDirectory).entryList(QDir::NoDotAndDotDot | QDir::Files);
QCOMPARE(entries.count(), 1);
+ QDateTime cacheFileTimeStamp;
+
{
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));
+ cacheFileTimeStamp = QFileInfo(cacheFile.fileName()).lastModified();
+
QDateTime referenceTimeStamp = QFileInfo(":/test.qml").lastModified();
if (!referenceTimeStamp.isValid())
referenceTimeStamp = QFileInfo(QCoreApplication::applicationFilePath()).lastModified();
QCOMPARE(qint64(unit.sourceTimeStamp), referenceTimeStamp.toMSecsSinceEpoch());
}
+
+ waitForFileSystem();
+
+ {
+ CleanlyLoadingComponent component(&engine, QUrl("qrc:///test.qml"));
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+ QCOMPARE(obj->property("value").toInt(), 20);
+ }
+
+ {
+ const QStringList entries = QDir(qmlCacheDirectory).entryList(QDir::NoDotAndDotDot | QDir::Files);
+ QCOMPARE(entries.count(), 1);
+
+ QCOMPARE(QFileInfo(qmlCacheDirectory + QLatin1Char('/') + entries.constFirst()).lastModified().toMSecsSinceEpoch(), cacheFileTimeStamp.toMSecsSinceEpoch());
+ }
}
void tst_qmldiskcache::stableOrderOfDependentCompositeTypes()