CMakeLists.txt 8.5 KB

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