CMakeLists.txt 6.9 KB

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