diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-18 11:44:13 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-18 12:37:04 +0100 |
commit | 13caf26b29283b544edc2974fa1ea0481c63b435 (patch) | |
tree | c06077293de36f69c42b5e1a38844e2b8bbe07c4 /tests/auto | |
parent | 36fb7cf832e801a7b3718fa443ec2f1b83e0fea2 (diff) | |
parent | 869efe4a49c5286493d7f039325992725bcac6c3 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
tools/qmllint/findunqualified.cpp
Change-Id: I2593b5cc0db1d14e0c944aec4b88a80f46f5b0c1
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qml/qmllint/data/ButtonLoader.qml | 10 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/data/Dialog.qml | 10 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/data/Drawer.qml | 5 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/data/Text.qml | 6 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/data/Things/plugins.qmltypes | 1 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/data/incompleteQmltypes.qml | 6 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 7 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/inlineComponentDuplicateName.qml | 6 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/inlineComponentFoundBeforeOtherImports.qml | 9 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 25 |
10 files changed, 85 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/ButtonLoader.qml b/tests/auto/qml/qmllint/data/ButtonLoader.qml new file mode 100644 index 0000000000..2721614735 --- /dev/null +++ b/tests/auto/qml/qmllint/data/ButtonLoader.qml @@ -0,0 +1,10 @@ +import QtQuick 2.12 + +Item { + Text { + id: roundButton + Text { + font.pixelSize: roundButton.font.pixelSize * 0.5 + } + } +} diff --git a/tests/auto/qml/qmllint/data/Dialog.qml b/tests/auto/qml/qmllint/data/Dialog.qml new file mode 100644 index 0000000000..bde8eae18b --- /dev/null +++ b/tests/auto/qml/qmllint/data/Dialog.qml @@ -0,0 +1,10 @@ +import QtQuick 2.12 + +Item { + id: control + property Text header + header: Text { + font.bold: true + padding: 12 + } +} diff --git a/tests/auto/qml/qmllint/data/Drawer.qml b/tests/auto/qml/qmllint/data/Drawer.qml new file mode 100644 index 0000000000..db1d785c6c --- /dev/null +++ b/tests/auto/qml/qmllint/data/Drawer.qml @@ -0,0 +1,5 @@ +import QtQml 2.12 as T + +T.QtObject { + objectName: T.Component.objectName +} diff --git a/tests/auto/qml/qmllint/data/Text.qml b/tests/auto/qml/qmllint/data/Text.qml new file mode 100644 index 0000000000..130578d1e3 --- /dev/null +++ b/tests/auto/qml/qmllint/data/Text.qml @@ -0,0 +1,6 @@ +import QtQuick 2.12 as T + +T.Text { + id: control + text: "'ello" +} diff --git a/tests/auto/qml/qmllint/data/Things/plugins.qmltypes b/tests/auto/qml/qmllint/data/Things/plugins.qmltypes index 00cda191cc..9d81c21070 100644 --- a/tests/auto/qml/qmllint/data/Things/plugins.qmltypes +++ b/tests/auto/qml/qmllint/data/Things/plugins.qmltypes @@ -12,5 +12,6 @@ Module { "CCC": 2 } } + Property { name: "palette"; type: "QPalette" } } } diff --git a/tests/auto/qml/qmllint/data/incompleteQmltypes.qml b/tests/auto/qml/qmllint/data/incompleteQmltypes.qml new file mode 100644 index 0000000000..ab06bbd8b0 --- /dev/null +++ b/tests/auto/qml/qmllint/data/incompleteQmltypes.qml @@ -0,0 +1,6 @@ +import Things 1.0 + +SomethingEntirelyStrange { + id: self + property var a: self.palette.weDontKnowIt +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 1cd9f8b0d1..ed968d6623 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -160,6 +160,10 @@ void TestQmllint::dirtyQmlCode_data() << QStringLiteral("badTypeAssertion.qml") << QString("Warning: Property \"rrr\" not found on type \"Item\" at 5:39") << QString(); + QTest::newRow("incompleteQmltypes") + << QStringLiteral("incompleteQmltypes.qml") + << QString("Warning: Type \"QPalette\" of member \"palette\" not found at 5:26") + << QString(); } void TestQmllint::dirtyQmlCode() @@ -192,6 +196,9 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("goodParent") << QStringLiteral("goodParent.qml"); QTest::newRow("goodTypeAssertion") << QStringLiteral("goodTypeAssertion.qml"); QTest::newRow("AttachedProps") << QStringLiteral("AttachedProps.qml"); + QTest::newRow("unknownBuiltinFont") << QStringLiteral("ButtonLoader.qml"); + QTest::newRow("confusingImport") << QStringLiteral("Dialog.qml"); + QTest::newRow("qualifiedAttached") << QStringLiteral("Drawer.qml"); } void TestQmllint::cleanQmlCode() diff --git a/tests/auto/qml/qqmllanguage/data/inlineComponentDuplicateName.qml b/tests/auto/qml/qqmllanguage/data/inlineComponentDuplicateName.qml new file mode 100644 index 0000000000..12cc79cf14 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/inlineComponentDuplicateName.qml @@ -0,0 +1,6 @@ +import QtQuick 2.12 +Item +{ + component IC: Item {} + component IC: Item {} +} diff --git a/tests/auto/qml/qqmllanguage/data/inlineComponentFoundBeforeOtherImports.qml b/tests/auto/qml/qqmllanguage/data/inlineComponentFoundBeforeOtherImports.qml new file mode 100644 index 0000000000..85903727fb --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/inlineComponentFoundBeforeOtherImports.qml @@ -0,0 +1,9 @@ +import QtQuick 2.12 + +Item +{ + component Rectangle: Item { + Component.onCompleted: console.info("Created") + } + Rectangle {} +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index c6076410b2..6d932c2665 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -318,6 +318,8 @@ private slots: void inlineComponentInSingleton(); void nonExistingInlineComponent_data(); void nonExistingInlineComponent(); + void inlineComponentFoundBeforeOtherImports(); + void inlineComponentDuplicateNameError(); void selfReference(); void selfReferencingSingleton(); @@ -5743,6 +5745,29 @@ void tst_qqmllanguage::nonExistingInlineComponent() QCOMPARE(error.column(), column); } +void tst_qqmllanguage::inlineComponentFoundBeforeOtherImports() +{ + QQmlEngine engine; + QUrl url = testFileUrl("inlineComponentFoundBeforeOtherImports.qml"); + QQmlComponent component(&engine, url); + + QTest::ignoreMessage(QtMsgType::QtInfoMsg, "Created"); + QScopedPointer<QObject> root {component.create()}; +} + +void tst_qqmllanguage::inlineComponentDuplicateNameError() +{ + QQmlEngine engine; + QUrl url = testFileUrl("inlineComponentDuplicateName.qml"); + QQmlComponent component(&engine, url); + + QString message = QLatin1String("%1:5 Inline component names must be unique per file\n").arg(url.toString()); + QScopedPointer<QObject> root {component.create()}; + QVERIFY(root.isNull()); + QVERIFY(component.isError()); + QCOMPARE(component.errorString(), message); +} + class TestItem : public QObject { Q_OBJECT |