diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2020-04-29 13:24:58 +0200 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2020-05-06 10:44:58 +0200 |
commit | 22f9e5fb1ed643f284f50b9417bdbafdfb20566b (patch) | |
tree | 9c2616522ca98534e2ceb6e4f13a9ffe5c622b93 /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | |
parent | 1250d8b5b95eecac767a23563717e53faa5d3b8a (diff) |
Add a default message to QML_UNCREATABLE
[ChangeLog][QML][Feature] Add a default message to QML_UNCREATABLE when
proving an empty string as a reason
Fixes: QTBUG-83842
Change-Id: Ifd2044fa6c56c3a382d451ec47d5f92a1ac16b81
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 4ea8de5a40..3dbaa2ec4e 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -333,6 +333,7 @@ private slots: void arrayToContainer(); void qualifiedScopeInCustomParser(); + void checkUncreatableNoReason(); private: QQmlEngine engine; QStringList defaultImportPathList; @@ -5839,6 +5840,17 @@ void tst_qqmllanguage::qualifiedScopeInCustomParser() QVERIFY(!obj.isNull()); } +void tst_qqmllanguage::checkUncreatableNoReason() +{ + qmlRegisterTypesAndRevisions<UncreatableElementNoReason>("qt.uncreatable.noreason", 1, 0); + QQmlEngine engine; + QString qml = QString("import QtQuick 2.0\nimport qt.uncreatable.noreason 1.0\nUncreatableElementNoReason {}"); + QQmlComponent c(&engine); + c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); + QCOMPARE(c.errors().count(), 1); + QCOMPARE(c.errors().first().description(), QString("Type cannot be created in QML.")); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |