QQmlIRLoader: Restore inline components correctly
Whether a component is an inline component is not only stored in the flags, but also in the isInlineComponent member. Ideally, this should be unified and the member removed, but for now we just restore the value correctly. Adjusted tst_qmlcachegen::initTestCase so that we testFile and testFileUrl are actually usable in the test. Fixes: QTBUG-84237 Pick-to: 5.15 Change-Id: I759cd6b8914b186b9e5c8118863fc8d0580d21af Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
parent
682a87a637
commit
b4d36a05be
|
@ -95,6 +95,7 @@ QmlIR::Object *QQmlIRLoader::loadObject(const QV4::CompiledData::Object *seriali
|
|||
|
||||
object->indexOfDefaultPropertyOrAlias = serializedObject->indexOfDefaultPropertyOrAlias;
|
||||
object->defaultPropertyIsAlias = serializedObject->defaultPropertyIsAlias;
|
||||
object->isInlineComponent = serializedObject->flags & QV4::CompiledData::Object::IsInlineComponentRoot;
|
||||
object->flags = serializedObject->flags;
|
||||
object->id = serializedObject->id;
|
||||
object->location = serializedObject->location;
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import QtQuick 2.15
|
||||
|
||||
Item {
|
||||
component Test: Item {
|
||||
id: test
|
||||
property int t: 42
|
||||
Component.onCompleted: console.info(test.t)
|
||||
}
|
||||
Test {}
|
||||
}
|
|
@ -76,6 +76,7 @@ private slots:
|
|||
void reproducibleCache();
|
||||
|
||||
void parameterAdjustment();
|
||||
void inlineComponent();
|
||||
};
|
||||
|
||||
// A wrapper around QQmlComponent to ensure the temporary reference counts
|
||||
|
@ -129,6 +130,7 @@ void tst_qmlcachegen::initTestCase()
|
|||
if (!cacheDir.isEmpty())
|
||||
//QDir(cacheDir).removeRecursively();
|
||||
qDebug() << cacheDir;
|
||||
QQmlDataTest::initTestCase();
|
||||
}
|
||||
|
||||
void tst_qmlcachegen::loadGeneratedFile()
|
||||
|
@ -690,6 +692,18 @@ void tst_qmlcachegen::parameterAdjustment()
|
|||
QVERIFY(!obj.isNull()); // Doesn't crash
|
||||
}
|
||||
|
||||
|
||||
void tst_qmlcachegen::inlineComponent()
|
||||
{
|
||||
bool ok = generateCache(testFile("inlineComponentWithId.qml"));
|
||||
QVERIFY(ok);
|
||||
QQmlEngine engine;
|
||||
CleanlyLoadingComponent component(&engine, testFileUrl("inlineComponentWithId.qml"));
|
||||
QTest::ignoreMessage(QtMsgType::QtInfoMsg, "42");
|
||||
QScopedPointer<QObject> obj(component.create());
|
||||
QVERIFY(!obj.isNull());
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(tst_qmlcachegen)
|
||||
|
||||
#include "tst_qmlcachegen.moc"
|
||||
|
|
Loading…
Reference in New Issue