diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-02-19 13:19:09 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-03-16 09:51:21 +0100 |
commit | b5f4b92b36f4957452cb0df7ead79d270bc568b5 (patch) | |
tree | a081231d01e68741e32e28a43d97ec7082fbd2dc /tests | |
parent | f9ce66f1218beba5e88ae2137520a1516e40007f (diff) |
Prefer Inline Components over any other imported name
After processing all other imports, there might be other imports both
in front and behind of the inline component imports in the import list.
To avoid having to search for them, we sort the list so that they are
in front.
Fixes: QTBUG-82302
Change-Id: I9f6deb03608b1ebd0cbe0eddd1a1e5d39837a783
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/inlineComponentFoundBeforeOtherImports.qml | 9 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 11 |
2 files changed, 20 insertions, 0 deletions
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 4d4056ba3f..bc2b7169d0 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -318,6 +318,7 @@ private slots: void inlineComponentInSingleton(); void nonExistingInlineComponent_data(); void nonExistingInlineComponent(); + void inlineComponentFoundBeforeOtherImports(); void selfReference(); void selfReferencingSingleton(); @@ -5663,6 +5664,16 @@ 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()}; +} + class TestItem : public QObject { Q_OBJECT |