aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcachegen
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-02-02 09:50:10 +0100
committerLiang Qi <liang.qi@qt.io>2018-02-02 09:50:10 +0100
commit2e65f6c2a5d84f4369245cabdc03eca4c19851f0 (patch)
treeae662f1aca8dc42d4fbb309681c3051d6201ceb6 /tests/auto/qml/qmlcachegen
parenta8cff469b6f9055f084c31514481d08c11b5303b (diff)
parent6958308c09ceda855a30c5a2d491f078c5104071 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Diffstat (limited to 'tests/auto/qml/qmlcachegen')
-rw-r--r--tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
index 7e81df93b9..d8afcd6946 100644
--- a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
+++ b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
@@ -33,6 +33,7 @@
#include <QProcess>
#include <QLibraryInfo>
#include <QSysInfo>
+#include <private/qqmlcomponent_p.h>
class tst_qmlcachegen: public QObject
{
@@ -115,6 +116,16 @@ void tst_qmlcachegen::loadGeneratedFile()
const QString cacheFilePath = testFilePath + QLatin1Char('c');
QVERIFY(QFile::exists(cacheFilePath));
+
+ {
+ QFile cache(cacheFilePath);
+ QVERIFY(cache.open(QIODevice::ReadOnly));
+ const QV4::CompiledData::Unit *cacheUnit = reinterpret_cast<const QV4::CompiledData::Unit *>(cache.map(/*offset*/0, sizeof(QV4::CompiledData::Unit)));
+ QVERIFY(cacheUnit);
+ QVERIFY(cacheUnit->flags & QV4::CompiledData::Unit::StaticData);
+ QVERIFY(cacheUnit->flags & QV4::CompiledData::Unit::PendingTypeCompilation);
+ }
+
QVERIFY(QFile::remove(testFilePath));
QQmlEngine engine;
@@ -122,6 +133,13 @@ void tst_qmlcachegen::loadGeneratedFile()
QScopedPointer<QObject> obj(component.create());
QVERIFY(!obj.isNull());
QCOMPARE(obj->property("value").toInt(), 42);
+
+ auto componentPrivate = QQmlComponentPrivate::get(&component);
+ QVERIFY(componentPrivate);
+ auto compilationUnit = componentPrivate->compilationUnit;
+ QVERIFY(compilationUnit);
+ QVERIFY(compilationUnit->data);
+ QVERIFY(!(compilationUnit->data->flags & QV4::CompiledData::Unit::StaticData));
}
void tst_qmlcachegen::translationExpressionSupport()