aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-10-30 17:10:08 +0100
committerUlf Hermann <ulf.hermann@qt.io>2024-11-01 12:52:03 +0100
commit5b867e35487fa487d13a1ff5460c1b2f21996d98 (patch)
tree454527e626f31d21073851e2f6b1dbeda19f43b3 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parentefb64be6ce735e83b380ac9b2213c56d0bca1a3d (diff)
QmlCompiler: Allow conversion of object literals to QJSValue
Task-number: QTBUG-124634 Change-Id: Ifb09c0f5e4a732518e44a8d3b73c5a836ad66508 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index cf4a673722..3cc7e6a62c 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -202,6 +202,7 @@ private slots:
void popContextAfterRet();
void prefixedType();
void propertyOfParent();
+ void qtfont();
void reduceWithNullThis();
void readEnumFromInstance();
void readonlyListProperty();
@@ -4219,6 +4220,26 @@ void tst_QmlCppCodegen::propertyOfParent()
}
}
+void tst_QmlCppCodegen::qtfont()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, QUrl(u"qrc:/qt/qml/TestTypes/qtfont.qml"_s));
+ QVERIFY2(component.isReady(), component.errorString().toUtf8());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
+
+ const QVariant font = object->property("font");
+ QCOMPARE(font.metaType(), QMetaType::fromType<QFont>());
+
+ QFont expected;
+ expected.setFamily(u"Arial"_s);
+ expected.setWeight(QFont::Normal);
+ expected.setItalic(false);
+ expected.setPixelSize(32);
+
+ QCOMPARE(font.value<QFont>(), expected);
+}
+
void tst_QmlCppCodegen::reduceWithNullThis()
{
QQmlEngine engine;