CMakeLists.txt 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} vtkCharts ${CTK_BASE_LIBRARIES})
  101. #
  102. # Add Tests
  103. #
  104. SIMPLE_TEST( ctkVTKDataSetArrayComboBoxTest1 )
  105. SIMPLE_TEST( ctkVTKDataSetModelTest1 )
  106. SIMPLE_TEST( ctkVTKMagnifyViewTest1 )
  107. SIMPLE_TEST( ctkVTKMatrixWidgetTest1 )
  108. SIMPLE_TEST( ctkVTKPropertyWidgetTest )
  109. SIMPLE_TEST( ctkVTKScalarBarWidgetTest1 )
  110. SIMPLE_TEST( ctkVTKScalarsToColorsUtilsTest1 )
  111. SIMPLE_TEST( ctkVTKThresholdWidgetTest1 )
  112. SIMPLE_TEST( ctkTransferFunctionBarsItemTest1 )
  113. SIMPLE_TEST( ctkTransferFunctionViewTest1 )
  114. SIMPLE_TEST( ctkTransferFunctionViewTest2 )
  115. SIMPLE_TEST( ctkTransferFunctionViewTest3 )
  116. SIMPLE_TEST( ctkTransferFunctionViewTest4 )
  117. SIMPLE_TEST( ctkTransferFunctionViewTest5 )
  118. if(CTK_USE_CHARTS)
  119. SIMPLE_TEST( ctkVTKChartViewTest1 )
  120. SIMPLE_TEST( ctkVTKVolumePropertyWidgetTest1 )
  121. SIMPLE_TEST( ctkVTKScalarsToColorsViewTest1 )
  122. SIMPLE_TEST( ctkVTKScalarsToColorsViewTest2 )
  123. SIMPLE_TEST( ctkVTKScalarsToColorsViewTest3 )
  124. SIMPLE_TEST( ctkVTKScalarsToColorsViewTest4 )
  125. SIMPLE_TEST( ctkVTKScalarsToColorsWidgetTest1 )
  126. SIMPLE_TEST( ctkVTKScalarsToColorsWidgetTest2 )
  127. SIMPLE_TEST( ctkVTKScalarsToColorsWidgetTest3 )
  128. endif()
  129. SIMPLE_TEST( ctkVTKRenderViewTest1 )
  130. SIMPLE_TEST( ctkVTKSliceViewTest1 )
  131. SIMPLE_TEST( ctkVTKSurfaceMaterialPropertyWidgetTest1 )
  132. SIMPLE_TEST( ctkVTKTextPropertyWidgetTest1 )
  133. SIMPLE_TEST( ctkVTKThumbnailViewTest1 )
  134. SIMPLE_TEST( ctkVTKWidgetsUtilsTestGrabWidget )
  135. #
  136. # Add Tests expecting CTKData to be set
  137. #
  138. if(EXISTS "${CTKData_DIR}")
  139. set(baseline_relative_location Libs/Visualization/VTK/Widgets)
  140. macro(MAGNIFY_WIDGET_TEST TESTNAME TESTTYPE SIZE MAGNIFICATION)
  141. SIMPLE_TEST_WITH_DATA(${TESTNAME}${TESTTYPE} ${baseline_relative_location}
  142. -T "${TESTTYPE}"
  143. -S "${SIZE}"
  144. -M "${MAGNIFICATION}"
  145. )
  146. endmacro()
  147. #
  148. # Dependencies required so that these tests won't run in parallel
  149. #
  150. MAGNIFY_WIDGET_TEST( ctkVTKMagnifyViewTest2 OddOdd 341 17 )
  151. MAGNIFY_WIDGET_TEST( ctkVTKMagnifyViewTest2 EvenEven 340 18 )
  152. set_tests_properties( ctkVTKMagnifyViewTest2EvenEven
  153. PROPERTIES DEPENDS
  154. ctkVTKMagnifyViewTest2OddOdd )
  155. MAGNIFY_WIDGET_TEST( ctkVTKMagnifyViewTest2 OddEven 341 18 )
  156. set_tests_properties( ctkVTKMagnifyViewTest2OddEven
  157. PROPERTIES DEPENDS
  158. ctkVTKMagnifyViewTest2EvenEven )
  159. MAGNIFY_WIDGET_TEST( ctkVTKMagnifyViewTest2 EvenOdd 340 17 )
  160. set_tests_properties( ctkVTKMagnifyViewTest2EvenOdd
  161. PROPERTIES DEPENDS
  162. ctkVTKMagnifyViewTest2OddEven )
  163. SIMPLE_TEST_WITH_DATA( ctkVTKRenderViewTest2 ${baseline_relative_location})
  164. SIMPLE_TEST_WITH_DATA( ctkVTKSliceViewTest2 ${baseline_relative_location})
  165. endif()
  166. #
  167. # Add Tests expecting CTK_USE_QTTESTING to be set
  168. #
  169. if(CTK_USE_QTTESTING)
  170. SIMPLE_TEST( ctkVTKDataSetArrayComboBoxEventTranslatorPlayerTest1 )
  171. SIMPLE_TEST( ctkVTKDataSetModelEventTranslatorPlayerTest1 )
  172. # SIMPLE_TEST( ctkVTKMagnifyViewEventTranslatorPlayerTest1 )
  173. SIMPLE_TEST( ctkVTKMatrixWidgetEventTranslatorPlayerTest1 )
  174. SIMPLE_TEST( ctkVTKRenderViewEventTranslatorPlayerTest1 )
  175. SIMPLE_TEST( ctkVTKScalarBarWidgetEventTranslatorPlayerTest1 )
  176. # SIMPLE_TEST( ctkVTKScalarsToColorsUtilsEventTranslatorPlayerTest1 )
  177. # SIMPLE_TEST( ctkVTKScalarsToColorsViewEventTranslatorPlayerTest1 )
  178. # SIMPLE_TEST( ctkVTKScalarsToColorsWidgetEventTranslatorPlayerTest1 )
  179. # SIMPLE_TEST( ctkVTKSliceViewEventTranslatorPlayerTest1 )
  180. # SIMPLE_TEST( ctkVTKSurfaceMaterialPropertyWidgetEventTranslatorPlayerTest1 )
  181. SIMPLE_TEST( ctkVTKTextPropertyWidgetEventTranslatorPlayerTest1 )
  182. # SIMPLE_TEST( ctkVTKThresholdWidgetEventTranslatorPlayerTest1 )
  183. # SIMPLE_TEST( ctkVTKVolumePropertyWidgetEventTranslatorPlayerTest1 )
  184. endif()