aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2023-10-20 08:18:47 +0200
committerChristian Stenger <christian.stenger@qt.io>2023-10-20 12:52:05 +0000
commit73d0c4a29db71f8f95591f99023b3dc936346abc (patch)
tree40af803f5c76db6c9cb831801927f28114546435
parent531fe36ac56ec93d37fe9e554a987459d4528057 (diff)
AutoTest: Tweak Test Case wizard
We now support Catch2 in two different versions which means we need different include directives depending on the version. Let the user choose the correct version instead of providing a fixed one that may be correct or not. Change-Id: I0199070b4f4602b8e08b7ac60731071f0cd33141 Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--share/qtcreator/templates/wizards/files/testing/file.cpp6
-rw-r--r--share/qtcreator/templates/wizards/files/testing/wizard.json20
2 files changed, 25 insertions, 1 deletions
diff --git a/share/qtcreator/templates/wizards/files/testing/file.cpp b/share/qtcreator/templates/wizards/files/testing/file.cpp
index 981fd0478e..de5539dc02 100644
--- a/share/qtcreator/templates/wizards/files/testing/file.cpp
+++ b/share/qtcreator/templates/wizards/files/testing/file.cpp
@@ -24,8 +24,12 @@ BOOST_AUTO_TEST_CASE( %{TestCaseName} )
BOOST_AUTO_TEST_SUITE_END()
@endif
-@if "%{TestFrameWork}" == "Catch2"
+@if "%{TestFrameWork}" == "Catch2"
+@if "%{Catch2Version}" == "V2"
#include <catch2/catch.hpp>
+@else
+#include <catch2/catch_test_macros.hpp>
+@endif
TEST_CASE("Another test with Catch2", "[fancy]")
{
diff --git a/share/qtcreator/templates/wizards/files/testing/wizard.json b/share/qtcreator/templates/wizards/files/testing/wizard.json
index 8a5bb84bf5..e15997abf0 100644
--- a/share/qtcreator/templates/wizards/files/testing/wizard.json
+++ b/share/qtcreator/templates/wizards/files/testing/wizard.json
@@ -62,6 +62,26 @@
}
},
{
+ "name": "Catch2Version",
+ "trDisplayName": "Catch2 version:",
+ "visible": "%{JS: value('TestFrameWork') == 'Catch2'}",
+ "type": "ComboBox",
+ "data": {
+ "index": 1,
+ "items":
+ [
+ {
+ "trKey": "2.x",
+ "value": "V2"
+ },
+ {
+ "trKey": "3.x",
+ "value": "V3"
+ }
+ ]
+ }
+ },
+ {
"name": "TestSuiteName",
"trDisplayName": "Test suite name:",
"visible": "%{JS: ['BoostTest', 'GTest'].indexOf(value('TestFrameWork')) >= 0}",