From 795d7dafe5be5cd48aa8225a1343285b3aca2be7 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 17 Feb 2022 17:23:10 +0100 Subject: QmlCompiler: Do not generate block comments into C++ code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code we're commenting could again contain block comments. You cannot nest them. Pick-to: 6.2 6.3 Fixes: QTBUG-100978 Change-Id: I78685bf29dd30f05e5a3b17abc43ba0b4cb6849e Reviewed-by: Fabian Kosmale Reviewed-by: Jan Arve Sæther --- tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt | 1 + tests/auto/qml/qmlcppcodegen/data/blockComments.qml | 10 ++++++++++ tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 11 +++++++++++ 3 files changed, 22 insertions(+) create mode 100644 tests/auto/qml/qmlcppcodegen/data/blockComments.qml (limited to 'tests') diff --git a/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt b/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt index 6afc186cad..1cfd0b493c 100644 --- a/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt +++ b/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt @@ -35,6 +35,7 @@ set(qml_files asCast.qml attachedBaseEnum.qml bindToValueType.qml + blockComments.qml callContextPropertyLookupResult.qml childobject.qml colorAsVariant.qml diff --git a/tests/auto/qml/qmlcppcodegen/data/blockComments.qml b/tests/auto/qml/qmlcppcodegen/data/blockComments.qml new file mode 100644 index 0000000000..da4bb2fd25 --- /dev/null +++ b/tests/auto/qml/qmlcppcodegen/data/blockComments.qml @@ -0,0 +1,10 @@ +pragma Strict +import QtQml + +QtObject { + property real implicitHeight: { + return /*+ (control.implicitHeaderHeight > 0 + ? control.implicitHeaderHeight + control.spacing + : 0)*/ 8; + } +} diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index b04eb011b3..1863b92c64 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -118,6 +118,7 @@ private slots: void invisibleBase(); void notEqualsInt(); void infinities(); + void blockComments(); }; void tst_QmlCppCodegen::simpleBinding() @@ -1776,6 +1777,16 @@ void tst_QmlCppCodegen::infinities() QVERIFY(qIsNaN(o->property("naN").toDouble())); } +void tst_QmlCppCodegen::blockComments() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/blockComments.qml"_qs)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer o(c.create()); + QVERIFY(o); + QCOMPARE(o->property("implicitHeight").toDouble(), 8.0); +} + void tst_QmlCppCodegen::runInterpreted() { if (qEnvironmentVariableIsSet("QV4_FORCE_INTERPRETER")) -- cgit v1.2.3