diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-06-09 17:08:47 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-06-09 17:08:47 +0300 |
commit | 960a980dc885622cb84990c4da75d5060318302d (patch) | |
tree | b02009bb0e08ec4f94f2ef1d4318679700347d9a /tests/auto/qml/qqmllanguage | |
parent | 540c4e4a5def8c350a49bb68380b787ae62490c6 (diff) | |
parent | cecf9b52904ab790e1a531698e9c5e33585227f0 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.11' into tqtc/lts-5.15-opensourcev5.15.11-lts-lgpl
Change-Id: I7b6e0ef657d1278405738f682b2795f8c345c3d4
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
7 files changed, 107 insertions, 3 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/ComponentType.qml b/tests/auto/qml/qqmllanguage/data/ComponentType.qml new file mode 100644 index 0000000000..ad0dad455c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/ComponentType.qml @@ -0,0 +1,8 @@ +import QtQml 2 + +Component { + id: componentRoot + QtObject { + objectName: "enclosed" + } +} diff --git a/tests/auto/qml/qqmllanguage/data/alias.15a.qml b/tests/auto/qml/qqmllanguage/data/alias.15a.qml new file mode 100644 index 0000000000..ba8097c997 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.15a.qml @@ -0,0 +1,12 @@ +import QtQuick 2.15 + +Item { + id: root + + property alias symbol: symbol + symbol.layer.enabled: true + + Item { + id: symbol + } +} diff --git a/tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl.qml b/tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl.qml new file mode 100644 index 0000000000..7e10553ae7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl.qml @@ -0,0 +1,11 @@ +import QtQuick 2 + +Item { + id: root + Component { + id: accessibleNormal + Item {} + } + property alias accessibleNormalUrl: accessibleNormal.url + property url urlClone: root.accessibleNormalUrl // crashes qml utility +} diff --git a/tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl2.qml b/tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl2.qml new file mode 100644 index 0000000000..899b7aca37 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl2.qml @@ -0,0 +1,11 @@ +import QtQuick 2 +Item { + id: root + Component { + id: accessibleNormal + ComponentType { + id: inaccessibleNormal + } + } + property alias accessibleNormalProgress: accessibleNormal.progress +} diff --git a/tests/auto/qml/qqmllanguage/data/fuzzed.1.errors.txt b/tests/auto/qml/qqmllanguage/data/fuzzed.1.errors.txt index e399799fe9..758be7feae 100644 --- a/tests/auto/qml/qqmllanguage/data/fuzzed.1.errors.txt +++ b/tests/auto/qml/qqmllanguage/data/fuzzed.1.errors.txt @@ -1,2 +1 @@ -2:8:Cannot assign to non-existent property "_G" - +2:11:Non-existent attached object diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp index 31a4135d89..df9d1401a9 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.cpp +++ b/tests/auto/qml/qqmllanguage/testtypes.cpp @@ -174,7 +174,7 @@ void EnumSupportingCustomParser::verifyBindings(const QQmlRefPointer<QV4::Execut return; } - if (binding->type != QV4::CompiledData::Binding::Type_Script) { + if (binding->type() != QV4::CompiledData::Binding::Type_Script) { error(binding, QStringLiteral("Custom parser invoked with the wrong property value. Expected script that evaluates to enum")); return; } diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index bffb62c59e..1be1533b63 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -28,6 +28,7 @@ #include <qtest.h> #include <QtQml/qqmlengine.h> #include <QtQml/qqmlcomponent.h> +#include <QtQml/qqmlprivate.h> #include <QtQml/qqmlincubator.h> #include <QtCore/qcoreapplication.h> #include <QtCore/qfile.h> @@ -338,6 +339,8 @@ private slots: void hangOnWarning(); void ambiguousContainingType(); + void staticConstexprMembers(); + void bindingAliasToComponentUrl(); private: QQmlEngine engine; @@ -2146,6 +2149,22 @@ void tst_qqmllanguage::aliasProperties() QCOMPARE(subItem->property("y").toInt(), 1); } + // Nested property bindings on group properties that are actually aliases (QTBUG-94983) + { + QQmlComponent component(&engine, testFileUrl("alias.15a.qml")); + VERIFY_ERRORS(0); + + QScopedPointer<QObject> object(component.create()); + QVERIFY(!object.isNull()); + + QPointer<QObject> subItem = qvariant_cast<QObject*>(object->property("symbol")); + QVERIFY(!subItem.isNull()); + + QPointer<QObject> subSubItem = qvariant_cast<QObject*>(subItem->property("layer")); + + QCOMPARE(subSubItem->property("enabled").value<bool>(), true); + } + // Alias to sub-object with binding (QTBUG-57041) { // This is shold *not* crash. @@ -5875,6 +5894,50 @@ void tst_qqmllanguage::ambiguousContainingType() QVERIFY(!o.isNull()); } } + void tst_qqmllanguage::staticConstexprMembers() { + // this tests if the symbols are correclty defined for c++11 (gcc 11 and 12), and should + // not have any linker errors + using T = QObject; + using T2 = QObject; + + auto f1 = QQmlPrivate::Constructors<T, true>::createSingletonInstance; + auto f2 = QQmlPrivate::Constructors<T, false>::createSingletonInstance; + auto f3 = QQmlPrivate::Constructors<T, true>::createInto; + + auto f4 = QQmlPrivate::ExtendedType<T, true>::createParent; + auto f5 = QQmlPrivate::ExtendedType<T, false>::createParent; + auto f6 = QQmlPrivate::ExtendedType<T, true>::staticMetaObject; + + auto f7 = QQmlPrivate::QmlSingleton<T, T2>::Value; + + Q_UNUSED(f1); + Q_UNUSED(f2); + Q_UNUSED(f3); + Q_UNUSED(f3); + Q_UNUSED(f4); + Q_UNUSED(f5); + Q_UNUSED(f6); + Q_UNUSED(f7); + } + +void tst_qqmllanguage::bindingAliasToComponentUrl() +{ + QQmlEngine engine; + { + QQmlComponent component(&engine, testFileUrl("bindingAliasToComponentUrl.qml")); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer<QObject> object(component.create()); + QVERIFY(object); + QCOMPARE(object->property("accessibleNormalUrl"), object->property("urlClone")); + } + { + QQmlComponent component(&engine, testFileUrl("bindingAliasToComponentUrl2.qml")); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer<QObject> object(component.create()); + QVERIFY(object); + QCOMPARE(object->property("accessibleNormalProgress"), QVariant(1.0)); + } +} QTEST_MAIN(tst_qqmllanguage) |