CMakeLists.txt 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. ctkVTKErrorLogModelTest1.cpp
  11. ctkVTKHistogramTest1.cpp
  12. ctkVTKHistogramTest2.cpp
  13. ctkVTKHistogramTest3.cpp
  14. ctkVTKHistogramTest4.cpp
  15. ctkVTKMatrixWidgetTest1.cpp
  16. ctkVTKMagnifyViewTest1.cpp
  17. ctkVTKScalarBarWidgetTest1.cpp
  18. ctkVTKThresholdWidgetTest1.cpp
  19. ctkTransferFunctionBarsItemTest1.cpp
  20. ctkTransferFunctionViewTest1.cpp
  21. ctkTransferFunctionViewTest2.cpp
  22. ctkTransferFunctionViewTest3.cpp
  23. ctkTransferFunctionViewTest4.cpp
  24. ctkTransferFunctionViewTest5.cpp
  25. ctkVTKPropertyWidgetTest.cpp
  26. ctkVTKRenderViewTest1.cpp
  27. ctkVTKScalarsToColorsUtilsTest1.cpp
  28. ctkVTKSliceViewTest1.cpp
  29. ctkVTKSurfaceMaterialPropertyWidgetTest1.cpp
  30. ctkVTKTextPropertyWidgetTest1.cpp
  31. ctkVTKThumbnailViewTest1.cpp
  32. ctkVTKTransferFunctionRepresentationTest1.cpp
  33. ctkVTKWidgetsUtilsTestGrabWidget.cpp
  34. )
  35. if(CTK_USE_CHARTS)
  36. set(TEST_SOURCES
  37. ctkVTKChartViewTest1.cpp
  38. ctkVTKVolumePropertyWidgetTest1.cpp
  39. ctkVTKScalarsToColorsViewTest1.cpp
  40. ctkVTKScalarsToColorsViewTest2.cpp
  41. ctkVTKScalarsToColorsViewTest3.cpp
  42. ctkVTKScalarsToColorsViewTest4.cpp
  43. ctkVTKScalarsToColorsWidgetTest1.cpp
  44. ctkVTKScalarsToColorsWidgetTest2.cpp
  45. ctkVTKScalarsToColorsWidgetTest3.cpp
  46. ${TEST_SOURCES})
  47. endif()
  48. #
  49. # Tests expecting CTKData to be set
  50. #
  51. if(EXISTS "${CTKData_DIR}")
  52. list(APPEND TEST_SOURCES
  53. ctkVTKMagnifyViewTest2.cpp
  54. ctkVTKSliceViewTest2.cpp
  55. ctkVTKRenderViewTest2.cpp
  56. )
  57. endif()
  58. #
  59. # Test expecting CTK_USE_QTTESTING to be ON
  60. #
  61. if(CTK_USE_QTTESTING)
  62. list(APPEND TEST_SOURCES
  63. ctkVTKDataSetArrayComboBoxEventTranslatorPlayerTest1.cpp
  64. ctkVTKDataSetModelEventTranslatorPlayerTest1.cpp
  65. # ctkVTKMagnifyViewEventTranslatorPlayerTest1.cpp
  66. ctkVTKMatrixWidgetEventTranslatorPlayerTest1.cpp
  67. ctkVTKRenderViewEventTranslatorPlayerTest1.cpp
  68. ctkVTKScalarBarWidgetEventTranslatorPlayerTest1.cpp
  69. # ctkVTKScalarsToColorsUtilsEventTranslatorPlayerTest1.cpp
  70. # ctkVTKScalarsToColorsViewEventTranslatorPlayerTest1.cpp
  71. # ctkVTKScalarsToColorsWidgetEventTranslatorPlayerTest1.cpp
  72. # ctkVTKSliceViewEventTranslatorPlayerTest1.cpp
  73. # ctkVTKSurfaceMaterialPropertyWidgetEventTranslatorPlayerTest1.cpp
  74. ctkVTKTextPropertyWidgetEventTranslatorPlayerTest1.cpp
  75. # ctkVTKThresholdWidgetEventTranslatorPlayerTest1.cpp
  76. # ctkVTKVolumePropertyWidgetEventTranslatorPlayerTest1.cpp
  77. )
  78. endif()
  79. include_directories(${CMAKE_SOURCE_DIR}/Libs/Testing
  80. ${CMAKE_CURRENT_BINARY_DIR})
  81. create_test_sourcelist(Tests ${KIT}CppTests.cpp
  82. ${TEST_SOURCES}
  83. #EXTRA_INCLUDE TestingMacros.h
  84. )
  85. SET (TestsToRun ${Tests})
  86. REMOVE (TestsToRun ${KIT}CppTests.cpp)
  87. set(LIBRARY_NAME ${PROJECT_NAME})
  88. #
  89. # If CTK_USE_QTTESTING is ON
  90. #
  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. #
  129. # Add Tests
  130. #
  131. SIMPLE_TEST( ctkVTKColorTransferFunctionTest1 )
  132. SIMPLE_TEST( ctkVTKDataSetArrayComboBoxTest1 )
  133. SIMPLE_TEST( ctkVTKDataSetModelTest1 )
  134. SIMPLE_TEST( ctkVTKErrorLogMessageHandlerWithThreadsTest1 )
  135. SIMPLE_TEST( ctkVTKErrorLogModelTest1 )
  136. SIMPLE_TEST( ctkVTKHistogramTest1 )
  137. SIMPLE_TEST( ctkVTKHistogramTest2 )
  138. SIMPLE_TEST( ctkVTKHistogramTest3 )
  139. SIMPLE_TEST( ctkVTKHistogramTest4 )
  140. SIMPLE_TEST( ctkVTKMagnifyViewTest1 )
  141. SIMPLE_TEST( ctkVTKMatrixWidgetTest1 )
  142. SIMPLE_TEST( ctkVTKPropertyWidgetTest )
  143. SIMPLE_TEST( ctkVTKScalarBarWidgetTest1 )
  144. SIMPLE_TEST( ctkVTKScalarsToColorsUtilsTest1 )
  145. SIMPLE_TEST( ctkVTKThresholdWidgetTest1 )
  146. SIMPLE_TEST( ctkTransferFunctionBarsItemTest1 )
  147. SIMPLE_TEST( ctkTransferFunctionViewTest1 )
  148. SIMPLE_TEST( ctkTransferFunctionViewTest2 )
  149. SIMPLE_TEST( ctkTransferFunctionViewTest3 )
  150. SIMPLE_TEST( ctkTransferFunctionViewTest4 )
  151. SIMPLE_TEST( ctkTransferFunctionViewTest5 )
  152. if(CTK_USE_CHARTS)
  153. SIMPLE_TEST( ctkVTKChartViewTest1 )
  154. SIMPLE_TEST( ctkVTKVolumePropertyWidgetTest1 )
  155. SIMPLE_TEST( ctkVTKScalarsToColorsViewTest1 )
  156. SIMPLE_TEST( ctkVTKScalarsToColorsViewTest2 )
  157. SIMPLE_TEST( ctkVTKScalarsToColorsViewTest3 )
  158. SIMPLE_TEST( ctkVTKScalarsToColorsViewTest4 )
  159. SIMPLE_TEST( ctkVTKScalarsToColorsWidgetTest1 )
  160. SIMPLE_TEST( ctkVTKScalarsToColorsWidgetTest2 )
  161. SIMPLE_TEST( ctkVTKScalarsToColorsWidgetTest3 )
  162. endif()
  163. SIMPLE_TEST( ctkVTKRenderViewTest1 )
  164. SIMPLE_TEST( ctkVTKSliceViewTest1 )
  165. SIMPLE_TEST( ctkVTKSurfaceMaterialPropertyWidgetTest1 )
  166. SIMPLE_TEST( ctkVTKTextPropertyWidgetTest1 )
  167. SIMPLE_TEST( ctkVTKThumbnailViewTest1 )
  168. SIMPLE_TEST( ctkVTKTransferFunctionRepresentationTest1 )
  169. SIMPLE_TEST( ctkVTKWidgetsUtilsTestGrabWidget )
  170. #
  171. # Add Tests expecting CTKData to be set
  172. #
  173. if(EXISTS "${CTKData_DIR}")
  174. set(baseline_relative_location Libs/Visualization/VTK/Widgets)
  175. macro(MAGNIFY_WIDGET_TEST TESTNAME TESTTYPE SIZE MAGNIFICATION)
  176. SIMPLE_TEST_WITH_DATA(${TESTNAME}${TESTTYPE} ${baseline_relative_location}
  177. -T "${TESTTYPE}"
  178. -S "${SIZE}"
  179. -M "${MAGNIFICATION}"
  180. )
  181. endmacro()
  182. #
  183. # Dependencies required so that these tests won't run in parallel
  184. #
  185. MAGNIFY_WIDGET_TEST( ctkVTKMagnifyViewTest2 OddOdd 341 17 )
  186. MAGNIFY_WIDGET_TEST( ctkVTKMagnifyViewTest2 EvenEven 340 18 )
  187. set_tests_properties( ctkVTKMagnifyViewTest2EvenEven
  188. PROPERTIES DEPENDS
  189. ctkVTKMagnifyViewTest2OddOdd )
  190. MAGNIFY_WIDGET_TEST( ctkVTKMagnifyViewTest2 OddEven 341 18 )
  191. set_tests_properties( ctkVTKMagnifyViewTest2OddEven
  192. PROPERTIES DEPENDS
  193. ctkVTKMagnifyViewTest2EvenEven )
  194. MAGNIFY_WIDGET_TEST( ctkVTKMagnifyViewTest2 EvenOdd 340 17 )
  195. set_tests_properties( ctkVTKMagnifyViewTest2EvenOdd
  196. PROPERTIES DEPENDS
  197. ctkVTKMagnifyViewTest2OddEven )
  198. SIMPLE_TEST_WITH_DATA( ctkVTKRenderViewTest2 ${baseline_relative_location})
  199. SIMPLE_TEST_WITH_DATA( ctkVTKSliceViewTest2 ${baseline_relative_location})
  200. endif()
  201. #
  202. # Add Tests expecting CTK_USE_QTTESTING to be set
  203. #
  204. if(CTK_USE_QTTESTING)
  205. SIMPLE_TEST( ctkVTKDataSetArrayComboBoxEventTranslatorPlayerTest1 )
  206. SIMPLE_TEST( ctkVTKDataSetModelEventTranslatorPlayerTest1 )
  207. # SIMPLE_TEST( ctkVTKMagnifyViewEventTranslatorPlayerTest1 )
  208. SIMPLE_TEST( ctkVTKMatrixWidgetEventTranslatorPlayerTest1 )
  209. SIMPLE_TEST( ctkVTKRenderViewEventTranslatorPlayerTest1 )
  210. SIMPLE_TEST( ctkVTKScalarBarWidgetEventTranslatorPlayerTest1 )
  211. # SIMPLE_TEST( ctkVTKScalarsToColorsUtilsEventTranslatorPlayerTest1 )
  212. # SIMPLE_TEST( ctkVTKScalarsToColorsViewEventTranslatorPlayerTest1 )
  213. # SIMPLE_TEST( ctkVTKScalarsToColorsWidgetEventTranslatorPlayerTest1 )
  214. # SIMPLE_TEST( ctkVTKSliceViewEventTranslatorPlayerTest1 )
  215. # SIMPLE_TEST( ctkVTKSurfaceMaterialPropertyWidgetEventTranslatorPlayerTest1 )
  216. SIMPLE_TEST( ctkVTKTextPropertyWidgetEventTranslatorPlayerTest1 )
  217. # SIMPLE_TEST( ctkVTKThresholdWidgetEventTranslatorPlayerTest1 )
  218. # SIMPLE_TEST( ctkVTKVolumePropertyWidgetEventTranslatorPlayerTest1 )
  219. endif()