aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp')
-rw-r--r--tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
index 520697909a..3df18fc77f 100644
--- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
+++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
@@ -59,6 +59,7 @@ private slots:
void qmlPropertyValueSourceCast();
void qmlPropertyValueInterceptorCast();
void qmlType();
+ void invalidQmlTypeName();
void isList();
@@ -188,6 +189,19 @@ void tst_qqmlmetatype::qmlType()
QCOMPARE(type->qmlTypeName(), QLatin1String("Test/ParserStatusTestType"));
}
+void tst_qqmlmetatype::invalidQmlTypeName()
+{
+ QStringList currFailures = QQmlMetaType::typeRegistrationFailures();
+ QCOMPARE(qmlRegisterType<TestType>("TestNamespace", 1, 0, "Test$Type"), -1); // should fail due to invalid QML type name.
+ QStringList nowFailures = QQmlMetaType::typeRegistrationFailures();
+
+ foreach (const QString &f, currFailures)
+ nowFailures.removeOne(f);
+
+ QCOMPARE(nowFailures.size(), 1);
+ QCOMPARE(nowFailures.at(0), QStringLiteral("Invalid QML element name \"Test$Type\""));
+}
+
void tst_qqmlmetatype::isList()
{
QCOMPARE(QQmlMetaType::isList(QVariant::Invalid), false);