diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2022-07-26 14:32:23 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2022-07-28 14:58:43 +0200 |
commit | 12ce72825995529e203c98adbe636a01b995ff13 (patch) | |
tree | 8fc48f172bd3fdc30295328572c35a5de409526a /tests/auto/qml/qmltc | |
parent | f52d4cf2c0242d2b13990553a28bfde950fa05ce (diff) |
qmltc: Make explicit component ids accessible during object creation
Explicit components could be accessed by id like regular objects. Make
this work in qmltc by revisiting the object creation procedure - store
explicit components along with pure QML types in
QQmltcObjectCreationBase:
xxxxxxxx x'x'x'x'x'|yyyyy...
^ ^ ^
pure explicit types from base class
types components
As a drive by, fix unset required property in one test file and add a
bunch of other test files to the initTestCase() check
Pick-to: 6.4
Change-Id: Ibdaa430d692c81101853f51dae1da462a57a9980
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmltc')
-rw-r--r-- | tests/auto/qml/qmltc/QmltcTests/componentTypes.qml | 8 | ||||
-rw-r--r-- | tests/auto/qml/qmltc/QmltcTests/properties.qml | 1 | ||||
-rw-r--r-- | tests/auto/qml/qmltc/tst_qmltc.cpp | 10 |
3 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qml/qmltc/QmltcTests/componentTypes.qml b/tests/auto/qml/qmltc/QmltcTests/componentTypes.qml index 48b68e9112..d45f2399b4 100644 --- a/tests/auto/qml/qmltc/QmltcTests/componentTypes.qml +++ b/tests/auto/qml/qmltc/QmltcTests/componentTypes.qml @@ -1,5 +1,7 @@ import QtQuick Item { + id: root + ComponentType { // normal type here id: normal property string text: "indirect component" @@ -22,4 +24,10 @@ Item { TableView { delegate: ComponentType { id: accessibleDelegate } } + + property alias accessibleNormalProgress: accessibleNormal.progress + property alias accessibleNormalUrl: accessibleNormal.url + property url urlClone: root.accessibleNormalUrl + + property alias delegateUrlClone: accessibleDelegate.url } diff --git a/tests/auto/qml/qmltc/QmltcTests/properties.qml b/tests/auto/qml/qmltc/QmltcTests/properties.qml index 896cd88eac..ca827519d5 100644 --- a/tests/auto/qml/qmltc/QmltcTests/properties.qml +++ b/tests/auto/qml/qmltc/QmltcTests/properties.qml @@ -37,6 +37,7 @@ QtObject { default property QtObject defaultObjP readonly property string readonlyStringP: "foobar" required property real requiredRealP + requiredRealP: 3.2 // extra: property Timer timerP: Timer { diff --git a/tests/auto/qml/qmltc/tst_qmltc.cpp b/tests/auto/qml/qmltc/tst_qmltc.cpp index 87ec8bd131..89d39c2c1a 100644 --- a/tests/auto/qml/qmltc/tst_qmltc.cpp +++ b/tests/auto/qml/qmltc/tst_qmltc.cpp @@ -122,6 +122,11 @@ void tst_qmltc::initTestCase() QUrl("qrc:/qt/qml/QmltcTests/ObjectWithId.qml"), QUrl("qrc:/qt/qml/QmltcTests/documentWithIds.qml"), QUrl("qrc:/qt/qml/QmltcTests/importNamespace.qml"), + QUrl("qrc:/qt/qml/QmltcTests/ComponentType.qml"), + QUrl("qrc:/qt/qml/QmltcTests/componentTypes.qml"), + QUrl("qrc:/qt/qml/QmltcTests/gradients.qml"), + QUrl("qrc:/qt/qml/QmltcTests/qjsvalueAssignments.qml"), + QUrl("qrc:/qt/qml/QmltcTests/deferredProperties.qml"), QUrl("qrc:/qt/qml/QmltcTests/deferredProperties_group.qml"), QUrl("qrc:/qt/qml/QmltcTests/deferredProperties_attached.qml"), @@ -588,6 +593,11 @@ void tst_qmltc::componentTypes() QQuickTableView *table = qobject_cast<QQuickTableView *>(children.at(3)); QVERIFY(table); QCOMPARE(ctx->objectForName(u"accessibleDelegate"_s), table->delegate()); + + QCOMPARE(created.accessibleNormalProgress(), + children.at(1)->property("progress").toDouble()); + QCOMPARE(created.urlClone(), QUrl("qrc:/qt/qml/QmltcTests/componentTypes.qml")); + QCOMPARE(created.delegateUrlClone(), QUrl("qrc:/qt/qml/QmltcTests/ComponentType.qml")); } } |