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-29 15:23:07 +0200 |
commit | fe11a7dcc71adf017553d430a96a77020ca4c4d8 (patch) | |
tree | 055f7b280fb2f9652c5dba2484af65acc481cade /tests | |
parent | ddd50b9f2eb211f6a8d58bf3a2aac345c61a4ab0 (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
Change-Id: Ibdaa430d692c81101853f51dae1da462a57a9980
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 12ce72825995529e203c98adbe636a01b995ff13)
Diffstat (limited to 'tests')
-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 e15870dcaa..5a0d7eea9d 100644 --- a/tests/auto/qml/qmltc/tst_qmltc.cpp +++ b/tests/auto/qml/qmltc/tst_qmltc.cpp @@ -121,6 +121,11 @@ void tst_qmltc::initTestCase() QUrl("qrc:/QmltcTests/ObjectWithId.qml"), QUrl("qrc:/QmltcTests/documentWithIds.qml"), QUrl("qrc:/QmltcTests/importNamespace.qml"), + QUrl("qrc:/QmltcTests/ComponentType.qml"), + QUrl("qrc:/QmltcTests/componentTypes.qml"), + QUrl("qrc:/QmltcTests/gradients.qml"), + QUrl("qrc:/QmltcTests/qjsvalueAssignments.qml"), + QUrl("qrc:/QmltcTests/deferredProperties.qml"), QUrl("qrc:/QmltcTests/deferredProperties_group.qml"), QUrl("qrc:/QmltcTests/deferredProperties_attached.qml"), @@ -582,6 +587,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:/QmltcTests/componentTypes.qml")); + QCOMPARE(created.delegateUrlClone(), QUrl("qrc:/QmltcTests/ComponentType.qml")); } } |