qmltc: Move qlmtc_build_failures to tst_qmltc_qprocess

`qmltc_build_failures` uses the available CMake infrastructure to test
for expected build-level failures from a `qmltc` compilation.

This allows tracking failures over certain constructs that
`qmltc` should not support, but has an high amount of friction when
extended, as each "test case" needs to be its own whole project, and
doesn't provide an error-level granularity for the failures, so that the
success of a "test case" might depend on a failure that is different
from the intended one.

`tst_qmltc_qprocess` has the infrastructure required to run failing
`qmltc` builds in a leaner way, provides an easier extension story, based on
the general and well-known testlib-based structure and allows to
have tests with an error-level granularity.

Hence, remove `qmltc_build_failures` and move the existing "test case"
to `tst_qmltc_qprocess`.

Change-Id: Ib11227c0da1f6336e6537bea76011ccc0090039f
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
This commit is contained in:
Luca Di Sera 2024-04-17 17:48:14 +02:00
parent d48b5545a9
commit 1126785007
7 changed files with 12 additions and 39 deletions

View File

@ -155,7 +155,4 @@ if(TARGET Qt::Quick)
)
endif()
endif()
add_subdirectory(qmltc_build_failures)
endif()

View File

@ -1,7 +0,0 @@
# 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)

View File

@ -1,26 +0,0 @@
# 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)

View File

@ -1,3 +0,0 @@
#include "main.h"
int main() { }

View File

@ -47,6 +47,7 @@ qt6_add_qml_module(tst_qmltc_qprocess
data/unboundRequiredPropertyInInlineComponent.qml
data/componentDefinitionInnerRequiredProperty.qml
data/componentDefinitionInnerRequiredPropertyFromOutside.qml
data/innerLevelRequiredProperty.qml
)
set(common_libraries

View File

@ -58,6 +58,7 @@ private slots:
void unboundRequiredPropertyInInlineComponent();
void componentDefinitionInnerRequiredProperty();
void componentDefinitionInnerRequiredPropertyFromOutside();
void innerLevelRequiredProperty();
};
#ifndef TST_QMLTC_QPROCESS_RESOURCES
@ -374,5 +375,15 @@ void tst_qmltc_qprocess::componentDefinitionInnerRequiredPropertyFromOutside()
}
}
void tst_qmltc_qprocess::innerLevelRequiredProperty()
{
{
const auto errors = runQmltc(u"innerLevelRequiredProperty.qml"_s, false);
QVERIFY(errors.contains(
u"innerLevelRequiredProperty.qml:7:5: Component is missing required property foo from here [required]"
));
}
}
QTEST_MAIN(tst_qmltc_qprocess)
#include "tst_qmltc_qprocess.moc"