diff options
-rw-r--r-- | tests/auto/qml/qmllint/data/badEnumFromQtQml.qml | 6 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/data/enumFromQtQml.qml | 8 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 8 | ||||
-rw-r--r-- | tools/qmllint/findwarnings.cpp | 4 |
4 files changed, 21 insertions, 5 deletions
diff --git a/tests/auto/qml/qmllint/data/badEnumFromQtQml.qml b/tests/auto/qml/qmllint/data/badEnumFromQtQml.qml new file mode 100644 index 0000000000..896458d598 --- /dev/null +++ b/tests/auto/qml/qmllint/data/badEnumFromQtQml.qml @@ -0,0 +1,6 @@ +import QtQml + +QtObject { + property int foo: Easing.Linear123 +} + diff --git a/tests/auto/qml/qmllint/data/enumFromQtQml.qml b/tests/auto/qml/qmllint/data/enumFromQtQml.qml new file mode 100644 index 0000000000..e07789fffc --- /dev/null +++ b/tests/auto/qml/qmllint/data/enumFromQtQml.qml @@ -0,0 +1,8 @@ +import QtQml + +QtObject { + // Remarkably, Easing.Type.Linear is not allowed in QML + // This is in contrast to QML-declared enums. See EnumAccess2.qml + property int foo: Easing.Linear +} + diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 74f73d8baf..f8e031689b 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -189,7 +189,12 @@ void TestQmllint::dirtyQmlCode_data() << QString(); QTest::newRow("javascriptMethodsInModule") << QStringLiteral("javascriptMethodsInModuleBad.qml") - << QString("Warning: Property \"unknownFunc\" not found on type \"Foo\"") << QString(); + << QString("Warning: Property \"unknownFunc\" not found on type \"Foo\"") + << QString(); + QTest::newRow("badEnumFromQtQml") + << QStringLiteral("badEnumFromQtQml.qml") + << QString("Warning: Property \"Linear123\" not found on type \"QQmlEasingEnums\"") + << QString(); } void TestQmllint::dirtyQmlCode() @@ -236,6 +241,7 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("Signals") << QStringLiteral("Signal.qml"); QTest::newRow("javascriptMethodsInModule") << QStringLiteral("javascriptMethodsInModuleGood.qml"); + QTest::newRow("enumFromQtQml") << QStringLiteral("enumFromQtQml.qml"); } void TestQmllint::cleanQmlCode() diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp index 47142e60da..1e0edf1f49 100644 --- a/tools/qmllint/findwarnings.cpp +++ b/tools/qmllint/findwarnings.cpp @@ -164,10 +164,6 @@ void FindWarningVisitor::processImport( const auto exports = val->exports(); for (const auto &valExport : exports) m_exportedName2Scope.insert(prefixedName(prefix, valExport.type()), val); - - const auto enums = val->enums(); - for (const auto &valEnum : enums) - m_currentScope->addEnum(valEnum); } } |