aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmltc
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2022-07-01 14:06:35 +0200
committerAndrei Golubev <andrei.golubev@qt.io>2022-07-26 10:34:49 +0200
commitca68b0cde7a3b9bad468dfae1935d5886f461499 (patch)
treef4d1e93b69bf7f77abe829118fd80ce8bf779e78 /tests/auto/qml/qmltc
parent10c475624cfef9cddca71622c2883e7c7595612a (diff)
qmltc: Use QMetaObject hierarchy as reference for meta index calculation
qmltc needs to compute a QMetaProperty index ahead of time when creating property bindings. This procedure has to acknowledge that extensions exist Change-Id: I7bf6b6c558ce78e0fec5ee880bc4d39a79fe5640 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmltc')
-rw-r--r--tests/auto/qml/qmltc/QmltcTests/extensionTypeBindings.qml13
-rw-r--r--tests/auto/qml/qmltc/QmltcTests/groupedProperty_qquicktext.qml1
-rw-r--r--tests/auto/qml/qmltc/tst_qmltc.cpp26
3 files changed, 38 insertions, 2 deletions
diff --git a/tests/auto/qml/qmltc/QmltcTests/extensionTypeBindings.qml b/tests/auto/qml/qmltc/QmltcTests/extensionTypeBindings.qml
index 9331b9e25c..d74dcf7c03 100644
--- a/tests/auto/qml/qmltc/QmltcTests/extensionTypeBindings.qml
+++ b/tests/auto/qml/qmltc/QmltcTests/extensionTypeBindings.qml
@@ -51,4 +51,17 @@ Item {
count: -10
property bool shouldBeVisible: true
}
+
+ // script bindings on properties:
+
+ TypeWithExtensionDerived {
+ id: withExtensionDerivedScript
+ str: "hoo" + "ray"
+ count: -10 + 0
+ }
+
+ TypeWithExtensionNamespace {
+ id: withExtensionNamespaceScript
+ count: -10 + 0
+ }
}
diff --git a/tests/auto/qml/qmltc/QmltcTests/groupedProperty_qquicktext.qml b/tests/auto/qml/qmltc/QmltcTests/groupedProperty_qquicktext.qml
index 7c067e0e89..9a93c7ff68 100644
--- a/tests/auto/qml/qmltc/QmltcTests/groupedProperty_qquicktext.qml
+++ b/tests/auto/qml/qmltc/QmltcTests/groupedProperty_qquicktext.qml
@@ -8,6 +8,7 @@ Text {
font.family: "Helvetica"
font.pointSize: 4
+ font.letterSpacing: Math.max(2, 3)
Text {
anchors.topMargin: root.anchors.topMargin
diff --git a/tests/auto/qml/qmltc/tst_qmltc.cpp b/tests/auto/qml/qmltc/tst_qmltc.cpp
index 84f31d3ca5..fda21384fa 100644
--- a/tests/auto/qml/qmltc/tst_qmltc.cpp
+++ b/tests/auto/qml/qmltc/tst_qmltc.cpp
@@ -125,6 +125,12 @@ void tst_qmltc::initTestCase()
QUrl("qrc:/qt/qml/QmltcTests/deferredProperties_attached.qml"),
QUrl("qrc:/qt/qml/QmltcTests/deferredProperties_complex.qml"),
QUrl("qrc:/qt/qml/QmltcTests/extensionTypeBindings.qml"),
+ QUrl("qrc:/qt/qml/QmltcTests/nonStandardInclude.qml"),
+ QUrl("qrc:/qt/qml/QmltcTests/memberProperties.qml"),
+
+ QUrl("qrc:/qt/qml/QmltcTests/qtbug103956/SubComponent.qml"),
+ QUrl("qrc:/qt/qml/QmltcTests/qtbug103956/MainComponent.qml"),
+ QUrl("qrc:/qt/qml/QmltcTests/qtbug103956/qtbug103956_main.qml"),
QUrl("qrc:/qt/qml/QmltcTests/signalHandlers.qml"),
QUrl("qrc:/qt/qml/QmltcTests/javaScriptFunctions.qml"),
@@ -686,12 +692,12 @@ void tst_qmltc::extensionTypeBindings()
const auto verifyExtensionType = [](QObject *root) {
QQmlListReference data(root, "data");
- QCOMPARE(data.count(), 7);
+ QCOMPARE(data.count(), 9);
// NB: Text object is not at index 0 due to non-QQuickItem-derived types
// added along with it. This has something to do with QQuickItem's
// internals that we just accept here
- auto text = qobject_cast<QQuickText *>(data.at(6));
+ auto text = qobject_cast<QQuickText *>(data.at(8));
QVERIFY(text);
auto withExtension = qobject_cast<TypeWithExtension *>(data.at(0));
QVERIFY(withExtension);
@@ -710,6 +716,12 @@ void tst_qmltc::extensionTypeBindings()
auto qmlWithBaseTypeExtension = qobject_cast<TypeWithBaseTypeExtension *>(data.at(5));
QVERIFY(qmlWithBaseTypeExtension);
+ // script bindings:
+ auto withExtensionDerivedScript = qobject_cast<TypeWithExtensionDerived *>(data.at(6));
+ QVERIFY(withExtensionDerivedScript);
+ auto withExtensionNamespaceScript = qobject_cast<TypeWithExtensionNamespace *>(data.at(7));
+ QVERIFY(withExtensionNamespaceScript);
+
QFont font = text->font();
QCOMPARE(font.letterSpacing(), 13);
@@ -767,6 +779,15 @@ void tst_qmltc::extensionTypeBindings()
QCOMPARE(qmlWithBaseTypeExtension->property("count").toInt(), -10);
QVERIFY(qmlWithBaseTypeExtension->property("shouldBeVisibleFromBase").toBool());
QVERIFY(qmlWithBaseTypeExtension->property("shouldBeVisible").toBool());
+
+ // script bindings:
+ QCOMPARE(withExtensionDerivedScript->getStr(), TypeWithExtensionDerived::unsetStr);
+ QCOMPARE(withExtensionDerivedScript->getCount(), TypeWithExtension::unsetCount);
+ QCOMPARE(withExtensionDerivedScript->property("str").toString(), u"hooray"_s);
+ QCOMPARE(withExtensionDerivedScript->property("count").toInt(), -10);
+
+ QCOMPARE(withExtensionNamespaceScript->getCount(), -10);
+ QCOMPARE(withExtensionNamespaceScript->property("count").toInt(), -10);
};
{
@@ -1502,6 +1523,7 @@ void tst_qmltc::groupedProperty_qquicktext()
QFont font = created.font();
QCOMPARE(font.family(), u"Helvetica"_s);
QCOMPARE(font.pointSize(), 4);
+ QCOMPARE(font.letterSpacing(), 3);
QQmlListReference ref(&created, "data");
QCOMPARE(ref.count(), 1);