CMakeLists.txt 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. set(KIT ${PROJECT_NAME})
  2. #
  3. # Tests
  4. #
  5. set(TEST_SOURCES
  6. ctkVTKColorTransferFunctionTest1.cpp
  7. ctkVTKDataSetArrayComboBoxTest1.cpp
  8. ctkVTKDataSetModelTest1.cpp
  9. ctkVTKErrorLogMessageHandlerWithThreadsTest1.cpp
  10. ctkVTKErrorLogModelFileLoggingTest1.cpp
  11. ctkVTKErrorLogModelTest1.cpp
  12. ctkVTKHistogramTest1.cpp
  13. ctkVTKHistogramTest2.cpp
  14. ctkVTKHistogramTest3.cpp
  15. ctkVTKHistogramTest4.cpp
  16. ctkVTKMatrixWidgetTest1.cpp
  17. ctkVTKMagnifyViewTest1.cpp
  18. ctkVTKScalarBarWidgetTest1.cpp
  19. ctkVTKThresholdWidgetTest1.cpp
  20. ctkTransferFunctionBarsItemTest1.cpp
  21. ctkTransferFunctionViewTest1.cpp
  22. ctkTransferFunctionViewTest2.cpp
  23. ctkTransferFunctionViewTest3.cpp
  24. ctkTransferFunctionViewTest4.cpp
  25. ctkTransferFunctionViewTest5.cpp
  26. ctkVTKPropertyWidgetTest.cpp
  27. ctkVTKRenderViewTest1.cpp
  28. ctkVTKScalarsToColorsComboBoxTest1.cpp
  29. ctkVTKScalarsToColorsUtilsTest1.cpp
  30. ctkVTKSliceViewTest1.cpp
  31. ctkVTKSurfaceMaterialPropertyWidgetTest1.cpp
  32. ctkVTKTextPropertyWidgetTest1.cpp
  33. ctkVTKThumbnailViewTest1.cpp
  34. ctkVTKTransferFunctionRepresentationTest1.cpp
  35. ctkVTKWidgetsUtilsTestGrabWidget.cpp
  36. )
  37. if(CTK_USE_CHARTS)
  38. set(TEST_SOURCES
  39. ctkVTKChartViewTest1.cpp
  40. ctkVTKVolumePropertyWidgetTest1.cpp
  41. ctkVTKDiscretizableColorTransferWidgetTest1.cpp
  42. ctkVTKScalarsToColorsViewTest1.cpp
  43. ctkVTKScalarsToColorsViewTest2.cpp
  44. ctkVTKScalarsToColorsViewTest3.cpp
  45. ctkVTKScalarsToColorsViewTest4.cpp
  46. ctkVTKScalarsToColorsWidgetTest1.cpp
  47. ctkVTKScalarsToColorsWidgetTest2.cpp
  48. ctkVTKScalarsToColorsWidgetTest3.cpp
  49. ${TEST_SOURCES})
  50. endif()
  51. #
  52. # Tests expecting CTKData to be set
  53. #
  54. if(EXISTS "${CTKData_DIR}")
  55. list(APPEND TEST_SOURCES
  56. ctkVTKMagnifyViewTest2.cpp
  57. ctkVTKSliceViewTest2.cpp
  58. ctkVTKRenderViewTest2.cpp
  59. )
  60. endif()
  61. #
  62. # Test expecting CTK_USE_QTTESTING to be ON
  63. #
  64. if(CTK_USE_QTTESTING)
  65. list(APPEND TEST_SOURCES
  66. ctkVTKDataSetArrayComboBoxEventTranslatorPlayerTest1.cpp
  67. ctkVTKDataSetModelEventTranslatorPlayerTest1.cpp
  68. # ctkVTKMagnifyViewEventTranslatorPlayerTest1.cpp
  69. ctkVTKMatrixWidgetEventTranslatorPlayerTest1.cpp
  70. ctkVTKRenderViewEventTranslatorPlayerTest1.cpp
  71. ctkVTKScalarBarWidgetEventTranslatorPlayerTest1.cpp
  72. # ctkVTKScalarsToColorsUtilsEventTranslatorPlayerTest1.cpp
  73. # ctkVTKScalarsToColorsViewEventTranslatorPlayerTest1.cpp
  74. # ctkVTKScalarsToColorsWidgetEventTranslatorPlayerTest1.cpp
  75. # ctkVTKSliceViewEventTranslatorPlayerTest1.cpp
  76. # ctkVTKSurfaceMaterialPropertyWidgetEventTranslatorPlayerTest1.cpp
  77. ctkVTKTextPropertyWidgetEventTranslatorPlayerTest1.cpp
  78. # ctkVTKThresholdWidgetEventTranslatorPlayerTest1.cpp
  79. # ctkVTKVolumePropertyWidgetEventTranslatorPlayerTest1.cpp
  80. )
  81. endif()
  82. include_directories(${CMAKE_SOURCE_DIR}/Libs/Testing
  83. ${CMAKE_CURRENT_BINARY_DIR})
  84. create_test_sourcelist(Tests ${KIT}CppTests.cpp
  85. ${TEST_SOURCES}
  86. #EXTRA_INCLUDE TestingMacros.h
  87. )
  88. SET (TestsToRun ${Tests})
  89. REMOVE (TestsToRun ${KIT}CppTests.cpp)
  90. set(LIBRARY_NAME ${PROJECT_NAME})
  91. if(CTK_USE_QTTESTING)
  92. include(${CMAKE_SOURCE_DIR}/Libs/QtTesting/CMake/ctkQtTesting.cmake)
  93. ctkQtTesting(Tests TEST_MOC_SOURCES TEST_UI_FORMS Tests_RESOURCES)
  94. endif()
  95. set(TEST_MOC_CPP)
  96. set(TEST_UI_CPP)
  97. set(Tests_RESOURCES_SRCS)
  98. if(CTK_QT_VERSION VERSION_GREATER "4")
  99. if(TEST_MOC_SOURCES)
  100. QT5_WRAP_CPP(TEST_MOC_CPP ${TEST_MOC_SOURCES})
  101. endif()
  102. QT5_GENERATE_MOCS(
  103. ctkVTKPropertyWidgetTest.cpp
  104. )
  105. if(TEST_UI_FORMS)
  106. QT5_WRAP_UI(TEST_UI_CPP ${TEST_UI_FORMS})
  107. endif()
  108. QT5_ADD_RESOURCES(Tests_RESOURCES_SRCS ${Tests_RESOURCES})
  109. else()
  110. if(TEST_MOC_SOURCES)
  111. QT4_WRAP_CPP(TEST_MOC_CPP ${TEST_MOC_SOURCES})
  112. endif()
  113. QT4_GENERATE_MOCS(
  114. ctkVTKPropertyWidgetTest.cpp
  115. )
  116. if(TEST_UI_FORMS)
  117. QT4_WRAP_UI(TEST_UI_CPP ${TEST_UI_FORMS})
  118. endif()
  119. QT4_ADD_RESOURCES(Tests_RESOURCES_SRCS ${Tests_RESOURCES})
  120. endif()
  121. add_executable(${KIT}CppTests ${Tests} ${TEST_MOC_CPP} ${TEST_UI_CPP} ${Tests_RESOURCES_SRCS})
  122. if(${VTK_VERSION_MAJOR} GREATER 5)
  123. set(VTK_CHARTS_LIB vtkChartsCore)
  124. else()
  125. set(VTK_CHARTS_LIB vtkCharts)
  126. endif()
  127. target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} ${VTK_CHARTS_LIB} ${CTK_BASE_LIBRARIES})
  128. if(CTK_QT_VERSION VERSION_GREATER "4")
  129. target_link_libraries(${KIT}CppTests ${Qt5Test_LIBRARIES})
  130. endif()
  131. if(CTK_USE_QTTESTING)
  132. target_link_libraries(${KIT}CppTests CTKQtTesting)
  133. endif()
  134. #
  135. # Add Tests
  136. #
  137. SIMPLE_TEST( ctkVTKColorTransferFunctionTest1 )
  138. SIMPLE_TEST( ctkVTKDataSetArrayComboBoxTest1 )
  139. SIMPLE_TEST( ctkVTKDataSetModelTest1 )
  140. SIMPLE_TEST( ctkVTKErrorLogMessageHandlerWithThreadsTest1 )
  141. SIMPLE_TEST( ctkVTKErrorLogModelFileLoggingTest1 )
  142. SIMPLE_TEST( ctkVTKErrorLogModelTest1 )
  143. SIMPLE_TEST( ctkVTKHistogramTest1 )
  144. SIMPLE_TEST( ctkVTKHistogramTest2 )
  145. SIMPLE_TEST( ctkVTKHistogramTest3 )
  146. SIMPLE_TEST( ctkVTKHistogramTest4 )
  147. SIMPLE_TEST( ctkVTKMagnifyViewTest1 )
  148. SIMPLE_TEST( ctkVTKMatrixWidgetTest1 )
  149. SIMPLE_TEST( ctkVTKPropertyWidgetTest )
  150. SIMPLE_TEST( ctkVTKScalarBarWidgetTest1 )
  151. SIMPLE_TEST( ctkVTKScalarsToColorsUtilsTest1 )
  152. SIMPLE_TEST( ctkVTKThresholdWidgetTest1 )
  153. SIMPLE_TEST( ctkTransferFunctionBarsItemTest1 )
  154. SIMPLE_TEST( ctkTransferFunctionViewTest1 )
  155. SIMPLE_TEST( ctkTransferFunctionViewTest2 )
  156. SIMPLE_TEST( ctkTransferFunctionViewTest3 )
  157. SIMPLE_TEST( ctkTransferFunctionViewTest4 )
  158. SIMPLE_TEST( ctkTransferFunctionViewTest5 )
  159. if(CTK_USE_CHARTS)
  160. SIMPLE_TEST( ctkVTKChartViewTest1 )
  161. SIMPLE_TEST( ctkVTKVolumePropertyWidgetTest1 )
  162. SIMPLE_TEST( ctkVTKDiscretizableColorTransferWidgetTest1 )
  163. SIMPLE_TEST( ctkVTKScalarsToColorsViewTest1 )
  164. SIMPLE_TEST( ctkVTKScalarsToColorsViewTest2 )
  165. SIMPLE_TEST( ctkVTKScalarsToColorsViewTest3 )
  166. SIMPLE_TEST( ctkVTKScalarsToColorsViewTest4 )
  167. SIMPLE_TEST( ctkVTKScalarsToColorsWidgetTest1 )
  168. SIMPLE_TEST( ctkVTKScalarsToColorsWidgetTest2 )
  169. SIMPLE_TEST( ctkVTKScalarsToColorsWidgetTest3 )
  170. endif()
  171. SIMPLE_TEST( ctkVTKRenderViewTest1 )
  172. SIMPLE_TEST( ctkVTKScalarsToColorsComboBoxTest1 )
  173. SIMPLE_TEST( ctkVTKSliceViewTest1 )
  174. SIMPLE_TEST( ctkVTKSurfaceMaterialPropertyWidgetTest1 )
  175. SIMPLE_TEST( ctkVTKTextPropertyWidgetTest1 )
  176. SIMPLE_TEST( ctkVTKThumbnailViewTest1 )
  177. SIMPLE_TEST( ctkVTKTransferFunctionRepresentationTest1 )
  178. SIMPLE_TEST( ctkVTKWidgetsUtilsTestGrabWidget )
  179. #
  180. # Add Tests expecting CTKData to be set
  181. #
  182. if(EXISTS "${CTKData_DIR}")
  183. set(baseline_relative_location Libs/Visualization/VTK/Widgets)
  184. macro(MAGNIFY_WIDGET_TEST TESTNAME TESTTYPE SIZE MAGNIFICATION)
  185. SIMPLE_TEST_WITH_DATA(${TESTNAME}${TESTTYPE} ${baseline_relative_location}
  186. -T "${TESTTYPE}"
  187. -S "${SIZE}"
  188. -M "${MAGNIFICATION}"
  189. )
  190. endmacro()
  191. #
  192. # Dependencies required so that these tests won't run in parallel
  193. #
  194. MAGNIFY_WIDGET_TEST( ctkVTKMagnifyViewTest2 OddOdd 341 17 )
  195. MAGNIFY_WIDGET_TEST( ctkVTKMagnifyViewTest2 EvenEven 340 18 )
  196. set_tests_properties( ctkVTKMagnifyViewTest2EvenEven
  197. PROPERTIES DEPENDS
  198. ctkVTKMagnifyViewTest2OddOdd )
  199. MAGNIFY_WIDGET_TEST( ctkVTKMagnifyViewTest2 OddEven 341 18 )
  200. set_tests_properties( ctkVTKMagnifyViewTest2OddEven
  201. PROPERTIES DEPENDS
  202. ctkVTKMagnifyViewTest2EvenEven )
  203. MAGNIFY_WIDGET_TEST( ctkVTKMagnifyViewTest2 EvenOdd 340 17 )
  204. set_tests_properties( ctkVTKMagnifyViewTest2EvenOdd
  205. PROPERTIES DEPENDS
  206. ctkVTKMagnifyViewTest2OddEven )
  207. SIMPLE_TEST_WITH_DATA( ctkVTKRenderViewTest2 ${baseline_relative_location})
  208. SIMPLE_TEST_WITH_DATA( ctkVTKSliceViewTest2 ${baseline_relative_location})
  209. endif()
  210. #
  211. # Add Tests expecting CTK_USE_QTTESTING to be set
  212. #
  213. if(CTK_USE_QTTESTING)
  214. SIMPLE_TEST( ctkVTKDataSetArrayComboBoxEventTranslatorPlayerTest1 )
  215. SIMPLE_TEST( ctkVTKDataSetModelEventTranslatorPlayerTest1 )
  216. # SIMPLE_TEST( ctkVTKMagnifyViewEventTranslatorPlayerTest1 )
  217. SIMPLE_TEST( ctkVTKMatrixWidgetEventTranslatorPlayerTest1 )
  218. SIMPLE_TEST( ctkVTKRenderViewEventTranslatorPlayerTest1 )
  219. SIMPLE_TEST( ctkVTKScalarBarWidgetEventTranslatorPlayerTest1 )
  220. # SIMPLE_TEST( ctkVTKScalarsToColorsUtilsEventTranslatorPlayerTest1 )
  221. # SIMPLE_TEST( ctkVTKScalarsToColorsViewEventTranslatorPlayerTest1 )
  222. # SIMPLE_TEST( ctkVTKScalarsToColorsWidgetEventTranslatorPlayerTest1 )
  223. # SIMPLE_TEST( ctkVTKSliceViewEventTranslatorPlayerTest1 )
  224. # SIMPLE_TEST( ctkVTKSurfaceMaterialPropertyWidgetEventTranslatorPlayerTest1 )
  225. SIMPLE_TEST( ctkVTKTextPropertyWidgetEventTranslatorPlayerTest1 )
  226. # SIMPLE_TEST( ctkVTKThresholdWidgetEventTranslatorPlayerTest1 )
  227. # SIMPLE_TEST( ctkVTKVolumePropertyWidgetEventTranslatorPlayerTest1 )
  228. endif()