diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2024-04-09 09:06:51 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-04-11 13:47:46 +0000 |
| commit | 7894f271ab3714102e14744914de6d0549b9a7d8 (patch) | |
| tree | 6baa5138a8be07d8ef4713de5f391ebcc8d25cba /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | 1087977a9a967dc4058eda7303ddd9f59874e21e (diff) | |
QmlCompiler: Allow coercion of lists to strings
We have to allow two different forms of coercion. When printing directly
through console.log etc, we add a pair of square brackets around the
string.
Fixes: QTBUG-119482
Change-Id: I03177e5905b41f5f0b5aaa867b18379eb9c7a243
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index fb1ab69c71..b8bb660516 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -155,6 +155,7 @@ private slots: void listLength(); void listOfInvisible(); void listPropertyAsModel(); + void listToString(); void lotsOfRegisters(); void math(); void mathMinMax(); @@ -2992,6 +2993,30 @@ void tst_QmlCppCodegen::listPropertyAsModel() QCOMPARE(children.count(), 5); } +void tst_QmlCppCodegen::listToString() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/listToString.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + + QTest::ignoreMessage(QtDebugMsg, "[one,two]"); + QTest::ignoreMessage(QtDebugMsg, "one,two"); + QTest::ignoreMessage(QtDebugMsg, "[1,2]"); + QTest::ignoreMessage(QtDebugMsg, "1,2"); + QTest::ignoreMessage( + QtDebugMsg, + QRegularExpression("\\[QObject_QML_[0-9]+\\(0x[0-9a-f]+\\)," + "QObject_QML_[0-9]+\\(0x[0-9a-f]+\\)\\]")); + QTest::ignoreMessage( + QtDebugMsg, + QRegularExpression("QObject_QML_[0-9]+\\(0x[0-9a-f]+\\)," + "QObject_QML_[0-9]+\\(0x[0-9a-f]+\\)")); + + QTest::ignoreMessage(QtDebugMsg, "[a,b]"); + + QScopedPointer<QObject> o(c.create()); +} + void tst_QmlCppCodegen::lotsOfRegisters() { QQmlEngine engine; |
