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.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 103e0171b8..bbf4b4691f 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -120,6 +120,7 @@ private slots:
void boundComponents();
void invisibleListElementType();
void typePropertyClash();
+ void objectToString();
};
void tst_QmlCppCodegen::simpleBinding()
@@ -2194,6 +2195,20 @@ void tst_QmlCppCodegen::typePropertyClash()
QCOMPARE(o->objectName(), u"Size: 5"_s);
}
+void tst_QmlCppCodegen::objectToString()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/toString.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+
+ QTest::ignoreMessage(QtWarningMsg, "qrc:/TestTypes/toString.qml:6: no");
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+
+ QCOMPARE(o->property("yes").toString(), u"yes yes"_s);
+ QCOMPARE(o->property("no").toString(), u" no"_s); // throws, but that is ignored
+}
+
void tst_QmlCppCodegen::runInterpreted()
{
#ifdef Q_OS_ANDROID