From 230b09360e3789cd533dca8ab526734af6081366 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 11 Sep 2025 12:18:14 +0200 Subject: tst_qmlcppcodegen: Adjust to fixed binding behavior in qtbase If the binding throws an exception, the binding wrapper internally returns false. This should result in the value being discarded. We had a long standing bug in qtbase that caused the value to still be accepted in certain cases. Commit 440a63a33e7176167d91244467fa380bae684173 fixed that. Fixes: QTBUG-140161 Change-Id: Ib36a32909dc3d487bea887cb7f89d7fcfeca2031 Reviewed-by: Fabian Kosmale --- tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp') diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 5780862b47..90fd5f391c 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -1104,7 +1104,8 @@ void tst_QmlCppCodegen::callObjectLookupOnNull() qPrintable(urlString + u":5:5: TypeError: Cannot call method 'getName' of null")); o->setProperty("person", QVariant::fromValue(nullptr)); - QCOMPARE(o->objectName(), QString()); + // Since the binding threw an exception, we expect the value _not_ to get updated. + QCOMPARE(o->objectName(), u"horst"_s); } void tst_QmlCppCodegen::callWithSpread() -- cgit v1.2.3