aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 131724c5ec..01268408ca 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -1,6 +1,7 @@
// Copyright (C) 2021 The Qt Company Ltd.
#include "data/druggeljug.h"
+#include "data/withlength.h"
#include <data/birthdayparty.h>
#include <data/cppbaseclass.h>
#include <data/enumproblems.h>
@@ -172,6 +173,7 @@ private slots:
void mathMinMax();
void enumFromBadSingleton();
void objectLookupOnListElement();
+ void multipleCtors();
};
void tst_QmlCppCodegen::initTestCase()
@@ -3425,6 +3427,18 @@ void tst_QmlCppCodegen::objectLookupOnListElement()
QCOMPARE(zOrders, (QList<int>()));
}
+void tst_QmlCppCodegen::multipleCtors()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/multipleCtors.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+ QCOMPARE(o->property("wr").value<ValueTypeWithLength>().length(), 3);
+ QCOMPARE(o->property("wp").value<ValueTypeWithLength>().length(), 11);
+ QCOMPARE(o->property("wi").value<ValueTypeWithLength>().length(), 17);
+}
+
QTEST_MAIN(tst_QmlCppCodegen)
#include "tst_qmlcppcodegen.moc"