qmltc: Test failure on presence of non-top level required property
`qmltc` should fail when it processes a QML file that has a required property that is not top-level, as it is invalid QML. For example: ``` import QtQuick Item { Item { required property int foo } } ``` To parse a QML file, `qmltc` uses `QQmlJSImportVisitor`, which will produce an error on encountering such a property. `qmltc` will in turn propagate the error and fail itself, thus acting properly when a non-top level required property is encountered in a QML file. A new test, `qmltc_build_failures`, is added to keep track of the behavior and ensure that `qmltc` fails at the build-level when this form of error is encountered. Task-number: QTBUG-120698 Change-Id: I45f975f1258a42fd2eb66283c1d3611152278fcc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
036137238a
commit
18acf564fa
|
@ -155,5 +155,7 @@ if(TARGET Qt::Quick)
|
|||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(qmltc_build_failures)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# Copyright (C) 2024 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(qmltc_build_failures)
|
||||
|
||||
_qt_internal_test_expect_build_fail(nontoplevelrequiredproperty)
|
|
@ -0,0 +1,26 @@
|
|||
# Copyright (C) 2024 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(nontoplevelrequiredproperty)
|
||||
|
||||
find_package(Qt6 REQUIRED Quick REQUIRED ${Qt6Tests_PREFIX_PATH})
|
||||
|
||||
qt_standard_project_setup()
|
||||
|
||||
qt_add_executable(executable
|
||||
main.cpp
|
||||
)
|
||||
|
||||
qt6_add_qml_module(executable
|
||||
VERSION 1.0
|
||||
URI QmltcBuildFailures
|
||||
QML_FILES
|
||||
Main.qml
|
||||
DEPENDENCIES
|
||||
QtQuick
|
||||
ENABLE_TYPE_COMPILER
|
||||
)
|
||||
|
||||
target_link_libraries(executable PRIVATE Qt6::Quick)
|
|
@ -0,0 +1,10 @@
|
|||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
||||
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
Item {
|
||||
required property int foo
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
#include "main.h"
|
||||
|
||||
int main() { }
|
Loading…
Reference in New Issue