diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index 34549c6ca30..d799637d645 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -811,7 +811,7 @@ function(extend_qtc_executable name) endfunction() function(add_qtc_test name) - cmake_parse_arguments(_arg "GTEST;MANUALTEST;EXCLUDE_FROM_PRECHECK" "TIMEOUT" + cmake_parse_arguments(_arg "GTEST;MANUALTEST;EXCLUDE_FROM_PRECHECK;NEEDS_GUI" "TIMEOUT" "DEFINES;DEPENDS;INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;SKIP_PCH;CONDITION;PROPERTIES" ${ARGN}) if (${_arg_UNPARSED_ARGUMENTS}) @@ -878,8 +878,12 @@ function(add_qtc_test name) enable_pch(${name}) endif() + if (_arg_NEEDS_GUI) + set(EXTRA_ARGUMENTS "-platform" "minimal") + endif() + if (NOT _arg_GTEST AND NOT _arg_MANUALTEST) - add_test(NAME ${name} COMMAND ${name}) + add_test(NAME ${name} COMMAND ${name} ${EXTRA_ARGUMENTS}) if (_arg_EXCLUDE_FROM_PRECHECK) set_tests_properties(${name} PROPERTIES LABELS exclude_from_precheck) endif() diff --git a/tests/auto/qml/qmldesigner/coretests/CMakeLists.txt b/tests/auto/qml/qmldesigner/coretests/CMakeLists.txt index e80627a00e1..1eaf90376d8 100644 --- a/tests/auto/qml/qmldesigner/coretests/CMakeLists.txt +++ b/tests/auto/qml/qmldesigner/coretests/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_test(tst_qml_testcore + NEEDS_GUI EXCLUDE_FROM_PRECHECK CONDITION TARGET QmlProjectManager DEPENDS diff --git a/tests/auto/texteditor/highlighter/CMakeLists.txt b/tests/auto/texteditor/highlighter/CMakeLists.txt index 76370bf8255..99fb136b320 100644 --- a/tests/auto/texteditor/highlighter/CMakeLists.txt +++ b/tests/auto/texteditor/highlighter/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_test(tst_highlighter + NEEDS_GUI DEPENDS TextEditor Utils Qt::Widgets SOURCES tst_highlighter.cpp ) diff --git a/tests/auto/tracing/flamegraphview/CMakeLists.txt b/tests/auto/tracing/flamegraphview/CMakeLists.txt index b1c53558a3a..22e5c9471d6 100644 --- a/tests/auto/tracing/flamegraphview/CMakeLists.txt +++ b/tests/auto/tracing/flamegraphview/CMakeLists.txt @@ -4,6 +4,7 @@ set(TSTFLAMEGRAPHVIEW_CPP_SOURCES ) add_qtc_test(tst_tracing_flamegraphview + NEEDS_GUI EXCLUDE_FROM_PRECHECK DEPENDS Tracing Qt::QuickWidgets Qt::Quick Utils ) diff --git a/tests/auto/tracing/timelineitemsrenderpass/CMakeLists.txt b/tests/auto/tracing/timelineitemsrenderpass/CMakeLists.txt index 5af1116952e..228fed76e68 100644 --- a/tests/auto/tracing/timelineitemsrenderpass/CMakeLists.txt +++ b/tests/auto/tracing/timelineitemsrenderpass/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_test(tst_tracing_timelineitemsrenderpass + NEEDS_GUI DEPENDS Tracing Qt::Quick SOURCES tst_timelineitemsrenderpass.cpp ) diff --git a/tests/auto/tracing/timelinenotesrenderpass/CMakeLists.txt b/tests/auto/tracing/timelinenotesrenderpass/CMakeLists.txt index f0d6f0397ad..6355651f13e 100644 --- a/tests/auto/tracing/timelinenotesrenderpass/CMakeLists.txt +++ b/tests/auto/tracing/timelinenotesrenderpass/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_test(tst_tracing_timelinenotesrenderpass + NEEDS_GUI DEPENDS Tracing Qt::Quick SOURCES tst_timelinenotesrenderpass.cpp ) diff --git a/tests/auto/tracing/timelineselectionrenderpass/CMakeLists.txt b/tests/auto/tracing/timelineselectionrenderpass/CMakeLists.txt index acb8f54220c..163400a4554 100644 --- a/tests/auto/tracing/timelineselectionrenderpass/CMakeLists.txt +++ b/tests/auto/tracing/timelineselectionrenderpass/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_test(tst_tracing_timelineselectionrenderpass + NEEDS_GUI DEPENDS Tracing Qt::Quick SOURCES tst_timelineselectionrenderpass.cpp ) diff --git a/tests/auto/treeviewfind/CMakeLists.txt b/tests/auto/treeviewfind/CMakeLists.txt index 6ce09aa2097..00ac4a52f31 100644 --- a/tests/auto/treeviewfind/CMakeLists.txt +++ b/tests/auto/treeviewfind/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_test(tst_treeviewfind + NEEDS_GUI DEPENDS Core SOURCES tst_treeviewfind.cpp ) diff --git a/tests/auto/utils/multicursor/CMakeLists.txt b/tests/auto/utils/multicursor/CMakeLists.txt index 7b8be63f836..9300e38b632 100644 --- a/tests/auto/utils/multicursor/CMakeLists.txt +++ b/tests/auto/utils/multicursor/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_test(tst_utils_multicursor + NEEDS_GUI DEPENDS Utils SOURCES tst_multicursor.cpp )