CMake: Add test for configuring a standalone test
A standalone test is one that uses find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) in its project code. To ensure we don't accidentally regress this feature, test it as a cmake test. Also run test, this somewhat covers testing qt_internal_add_test. Pick-to: 6.6 6.5 Change-Id: Ia9f27eef2bd7bd5bb57b96e553304924db252365 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit a61ac2ca58eb705021176720d481c0eb4c925c2a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c4de095be1
commit
f1cb2edd1e
@ -338,6 +338,12 @@ if(is_qt_build_platform)
|
||||
set_tests_properties(test_import_plugins PROPERTIES FIXTURES_REQUIRED build_mockplugins)
|
||||
endif()
|
||||
|
||||
if(NOT NO_GUI)
|
||||
_qt_internal_test_expect_pass(test_standalone_test
|
||||
BINARY "${CMAKE_CTEST_COMMAND}"
|
||||
BINARY_ARGS "-V")
|
||||
endif()
|
||||
|
||||
_qt_internal_test_expect_pass(test_versionless_targets)
|
||||
|
||||
if(NOT NO_GUI)
|
||||
|
14
tests/auto/cmake/test_standalone_test/CMakeLists.txt
Normal file
14
tests/auto/cmake/test_standalone_test/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (C) 2024 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(tststandalone_test LANGUAGES CXX)
|
||||
find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
|
||||
|
||||
qt_internal_add_test(tst_standalone_test
|
||||
GUI
|
||||
SOURCES
|
||||
tst_standalone_test.cpp
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include <QTest>
|
||||
#include <QWindow>
|
||||
|
||||
class tst_standalone_test : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void testLaunched()
|
||||
{
|
||||
QWindow w;
|
||||
w.show();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
}
|
||||
};
|
||||
|
||||
QTEST_MAIN(tst_standalone_test)
|
||||
|
||||
#include "tst_standalone_test.moc"
|
Loading…
x
Reference in New Issue
Block a user