diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-02-19 13:51:24 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-03-16 09:51:22 +0100 |
commit | 61413825960870ac9390d0aa0431702431c620f2 (patch) | |
tree | a82421e2f091aef1ef228bcc7738db83ed0e5789 /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | |
parent | b5f4b92b36f4957452cb0df7ead79d270bc568b5 (diff) |
Inline components: Abort if two IC's with same name exist
Change-Id: Ic52fa388711a76d729ae28678932f4a150da9583
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index bc2b7169d0..6abcf13b5f 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -319,6 +319,7 @@ private slots: void nonExistingInlineComponent_data(); void nonExistingInlineComponent(); void inlineComponentFoundBeforeOtherImports(); + void inlineComponentDuplicateNameError(); void selfReference(); void selfReferencingSingleton(); @@ -5674,6 +5675,19 @@ void tst_qqmllanguage::inlineComponentFoundBeforeOtherImports() 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 |