diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2022-07-18 14:16:11 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-07-22 21:30:12 +0200 |
| commit | 1969a108214b993275aa694116a167449eae7567 (patch) | |
| tree | 42b6fd3c9af35b22fcaa1eab67f107695374777d /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | 8d0adee3b3317f1fab03742bdf0f7cdbe57df914 (diff) | |
QmlCompiler: Support conversions between QString and QByteArray
Pick-to: 6.4
Fixes: QTBUG-104702
Change-Id: I80d3a28e17751d440ec4bea4c7be0d09c935fa19
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 | 15 |
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 3daa78b721..352660b6e3 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -132,6 +132,7 @@ private slots: void badSequence(); void enumLookup(); void trivialSignalHandler(); + void stringToByteArray(); }; void tst_QmlCppCodegen::simpleBinding() @@ -2438,6 +2439,20 @@ void tst_QmlCppCodegen::trivialSignalHandler() QCOMPARE(o->property("c").toDouble(), 2.5); } +void tst_QmlCppCodegen::stringToByteArray() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/stringToByteArray.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + + Person *person = qobject_cast<Person *>(o.data()); + QVERIFY(person); + + QCOMPARE(person->dataBindable().value(), QByteArray("some data")); + QCOMPARE(person->name(), u"some data"_s); +} + void tst_QmlCppCodegen::runInterpreted() { #ifdef Q_OS_ANDROID |
