浏览代码

BUG: Improve simple_test_with_data macro to ensure MagnifyView tests are executed

Jean-Christophe Fillion-Robin 6 年之前
父节点
当前提交
78632c02f9
共有 2 个文件被更改,包括 9 次插入1 次删除
  1. 8 1
      CMake/ctkMacroSimpleTestWithData.cmake
  2. 1 0
      Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt

+ 8 - 1
CMake/ctkMacroSimpleTestWithData.cmake

@@ -18,6 +18,9 @@
 #!
 #!
 #! The macro also associates a label to the test based on the current value of KIT.
 #! The macro also associates a label to the test based on the current value of KIT.
 #!
 #!
+#! By default, the name of the test to execute is expected to match <testname>, setting
+#! variable <testname>_TEST allows to change that.
+#!
 #! The following parameter will be passed to the test:
 #! The following parameter will be passed to the test:
 #! <ul>
 #! <ul>
 #!   <li>-D <CTKData_DIR>/Data</li>
 #!   <li>-D <CTKData_DIR>/Data</li>
@@ -45,8 +48,12 @@ macro(SIMPLE_TEST_WITH_DATA testname baseline_relative_location)
   if(NOT EXISTS "${CTKData_DIR}/Baseline/${baseline_relative_location}")
   if(NOT EXISTS "${CTKData_DIR}/Baseline/${baseline_relative_location}")
     message(FATAL_ERROR "error: <CTKData_DIR>/Baseline/<baseline_relative_location> corresponds to an non-existing file or directory. [<CTKData_DIR>/Baseline/<baseline_relative_location>: ${CTKData_DIR}/Baseline/${baseline_relative_location}]")
     message(FATAL_ERROR "error: <CTKData_DIR>/Baseline/<baseline_relative_location> corresponds to an non-existing file or directory. [<CTKData_DIR>/Baseline/<baseline_relative_location>: ${CTKData_DIR}/Baseline/${baseline_relative_location}]")
   endif()
   endif()
+
+  if(NOT DEFINED ${testname}_TEST)
+    set(${testname}_TEST ${testname})
+  endif()
   
   
-  add_test(NAME ${testname} COMMAND $<TARGET_FILE:${KIT}CppTests> ${testname}
+  add_test(NAME ${testname} COMMAND $<TARGET_FILE:${KIT}CppTests> ${${testname}_TEST}
             -D "${CTKData_DIR}/Data"
             -D "${CTKData_DIR}/Data"
             -V "${CTKData_DIR}/Baseline/${baseline_relative_location}"
             -V "${CTKData_DIR}/Baseline/${baseline_relative_location}"
             -T "${PROJECT_BINARY_DIR}/Testing/Temporary"
             -T "${PROJECT_BINARY_DIR}/Testing/Temporary"

+ 1 - 0
Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt

@@ -203,6 +203,7 @@ if(EXISTS "${CTKData_DIR}")
   set(baseline_relative_location Libs/Visualization/VTK/Widgets)
   set(baseline_relative_location Libs/Visualization/VTK/Widgets)
 
 
   macro(MAGNIFY_WIDGET_TEST TESTNAME TESTTYPE SIZE MAGNIFICATION)
   macro(MAGNIFY_WIDGET_TEST TESTNAME TESTTYPE SIZE MAGNIFICATION)
+    set(${TESTNAME}${TESTTYPE}_TEST ${TESTNAME})
     SIMPLE_TEST_WITH_DATA(${TESTNAME}${TESTTYPE} ${baseline_relative_location}
     SIMPLE_TEST_WITH_DATA(${TESTNAME}${TESTTYPE} ${baseline_relative_location}
       -T "${TESTTYPE}"
       -T "${TESTTYPE}"
       -S "${SIZE}"
       -S "${SIZE}"