aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 9440fcaad4..7e053a027d 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -1859,21 +1859,30 @@ void tst_qqmllanguage::valueTypes()
void tst_qqmllanguage::cppnamespace()
{
- {
- QQmlComponent component(&engine, testFileUrl("cppnamespace.qml"));
+ QScopedPointer<QObject> object;
+
+ auto create = [&](const char *file) {
+ QQmlComponent component(&engine, testFileUrl(file));
VERIFY_ERRORS(0);
- QScopedPointer<QObject> object(component.create());
+ object.reset(component.create());
QVERIFY(object != nullptr);
+ };
- QCOMPARE(object->property("intProperty").toInt(), (int)MyNamespace::MyOtherNSEnum::OtherKey2);
- }
+ auto createAndCheck = [&](const char *file) {
+ create(file);
+ return !QTest::currentTestFailed();
+ };
- {
- QQmlComponent component(&engine, testFileUrl("cppnamespace.2.qml"));
- VERIFY_ERRORS(0);
- QScopedPointer<QObject> object(component.create());
- QVERIFY(object != nullptr);
- }
+ QVERIFY(createAndCheck("cppnamespace.qml"));
+ QCOMPARE(object->property("intProperty").toInt(),
+ (int)MyNamespace::MyOtherNSEnum::OtherKey2);
+
+ QVERIFY(createAndCheck("cppstaticnamespace.qml"));
+ QCOMPARE(object->property("intProperty").toInt(),
+ (int)MyStaticNamespace::MyOtherNSEnum::OtherKey2);
+
+ QVERIFY(createAndCheck("cppnamespace.2.qml"));
+ QVERIFY(createAndCheck("cppstaticnamespace.2.qml"));
}
void tst_qqmllanguage::aliasProperties()