aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2018-05-29 13:55:38 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2018-06-26 08:31:20 +0000
commit036aa822455b4d831076a1ba364fa1ef304dee84 (patch)
treee6aa6a43147dd92a00d4305ec5db8944216837b2 /tests
parent23f9dd17b5f999b6a4c78f7513ea1c5a20d1208e (diff)
Show error message when type qmlRegisterType and friends fail
When a type is registered through qmlRegisterType or similar functions, no error was shown. Task-number: QTBUG-68323 Change-Id: Iff44bf8744c67dba2fdd12c43aaee44a8e15364a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
index 1d0d353668..e83dac48fb 100644
--- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
+++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
@@ -227,17 +227,13 @@ void tst_qqmlmetatype::qmlType()
void tst_qqmlmetatype::invalidQmlTypeName()
{
- QStringList currFailures = QQmlMetaType::typeRegistrationFailures();
+ QTest::ignoreMessage(QtWarningMsg, "Invalid QML element name \"testtype\"; type names must begin with an uppercase letter");
+ QTest::ignoreMessage(QtWarningMsg, "Invalid QML element name \"Test$Type\"");
+ QTest::ignoreMessage(QtWarningMsg, "Invalid QML element name \"EndingInSlash/\"");
+
QCOMPARE(qmlRegisterType<TestType>("TestNamespace", 1, 0, "Test$Type"), -1); // should fail due to invalid QML type name.
QCOMPARE(qmlRegisterType<TestType>("Test", 1, 0, "EndingInSlash/"), -1);
- QStringList nowFailures = QQmlMetaType::typeRegistrationFailures();
-
- foreach (const QString &f, currFailures)
- nowFailures.removeOne(f);
-
- QCOMPARE(nowFailures.size(), 2);
- QCOMPARE(nowFailures.at(0), QStringLiteral("Invalid QML element name \"Test$Type\""));
- QCOMPARE(nowFailures.at(1), QStringLiteral("Invalid QML element name \"EndingInSlash/\""));
+ QCOMPARE(qmlRegisterType<TestType>("Test", 1, 0, "testtype"), -1);
}
void tst_qqmlmetatype::prettyTypeName()