CMakeLists.txt 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # Dummy plugin used by ctkAbstractPluginFactoryTest1
  2. ADD_DEFINITIONS( -DCTKDummyPlugin)
  3. ctkMacroBuildLib(
  4. NAME "CTKDummyPlugin"
  5. EXPORT_DIRECTIVE "CTK_DUMMY_EXPORT"
  6. SRCS ctkDummyPlugin.h ctkDummyPlugin.cpp
  7. MOC_SRCS "ctkDummyPlugin.h"
  8. TARGET_LIBRARIES ${CTK_BASE_LIBRARIES}
  9. LIBRARY_TYPE "SHARED"
  10. DISABLE_WRAP_PYTHONQT
  11. )
  12. GET_TARGET_PROPERTY(ctkDummyPluginPATH "CTKDummyPlugin" LOCATION)
  13. REMOVE_DEFINITIONS(-DCTKDummyPlugin)
  14. SET(KIT ${PROJECT_NAME})
  15. #
  16. # Test sources
  17. #
  18. SET(KITTests_SRCS
  19. ctkAbstractFactoryTest1.cpp
  20. ctkAbstractLibraryFactoryTest1.cpp
  21. ctkAbstractObjectFactoryTest1.cpp
  22. ctkAbstractPluginFactoryTest1.cpp
  23. ctkAbstractQObjectFactoryTest1.cpp
  24. ctkCommandLineParserTest1.cpp
  25. ctkErrorLogModelTest1.cpp
  26. ctkErrorLogModelTest2.cpp
  27. ctkErrorLogModelTest3.cpp
  28. ctkModelTesterTest1.cpp
  29. ctkUtilsTest1.cpp
  30. ctkUtilsTest2.cpp
  31. ctkDependencyGraphTest1.cpp
  32. ctkDependencyGraphTest2.cpp
  33. ctkPimplTest1.cpp
  34. ctkSingletonTest1.cpp
  35. ctkWorkflowTest1.cpp
  36. ctkWorkflowTest2.cpp
  37. ctkWorkflowTest3.cpp
  38. )
  39. IF(HAVE_BFD)
  40. LIST(APPEND KITTests_SRCS
  41. ctkBinaryFileDescriptorTest1.cpp
  42. )
  43. ENDIF()
  44. CREATE_TEST_SOURCELIST(Tests ${KIT}CppTests.cpp
  45. ${KITTests_SRCS}
  46. #EXTRA_INCLUDE TestingMacros.h
  47. )
  48. SET (TestsToRun ${Tests})
  49. REMOVE (TestsToRun ${KIT}CppTests.cpp)
  50. SET(LIBRARY_NAME ${PROJECT_NAME})
  51. #
  52. # Tests Helpers sources
  53. #
  54. SET(Tests_Helpers_SRCS
  55. ctkBranchingWorkflowStep.h
  56. ctkExampleDerivedWorkflowStep.cpp
  57. ctkExampleDerivedWorkflowStep.h
  58. ctkExampleWorkflowStepUsingSignalsAndSlots.cpp
  59. ctkExampleWorkflowStepUsingSignalsAndSlots.h
  60. ctkSingletonTestHelper.cpp
  61. ctkSingletonTestHelper.h
  62. )
  63. SET(Tests_Helpers_MOC_SRCS
  64. ctkExampleWorkflowStepUsingSignalsAndSlots.h
  65. )
  66. SET(Tests_Helpers_MOC_CPP)
  67. QT4_WRAP_CPP(Tests_Helpers_MOC_CPP ${Tests_Helpers_MOC_SRCS})
  68. IF(HAVE_BFD)
  69. ADD_EXECUTABLE(ctkBinaryFileDescriptorTestHelper ctkBinaryFileDescriptorTestHelper.cpp)
  70. ENDIF()
  71. #
  72. # Test executable
  73. #
  74. ADD_EXECUTABLE(${KIT}CppTests ${Tests} ${Tests_Helpers_SRCS} ${Tests_Helpers_MOC_CPP})
  75. TARGET_LINK_LIBRARIES(${KIT}CppTests ${LIBRARY_NAME} ${CTK_BASE_LIBRARIES} CTKDummyPlugin)
  76. SET( KIT_TESTS ${CPP_TEST_PATH}/${KIT}CppTests)
  77. MACRO( SIMPLE_TEST TESTNAME )
  78. ADD_TEST( ${TESTNAME} ${KIT_TESTS} ${TESTNAME} )
  79. SET_PROPERTY(TEST ${TESTNAME} PROPERTY LABELS ${PROJECT_NAME})
  80. ENDMACRO( SIMPLE_TEST )
  81. #
  82. # Add Tests
  83. #
  84. SIMPLE_TEST( ctkAbstractFactoryTest1 )
  85. ADD_TEST( ctkAbstractLibraryFactoryTest1 ${KIT_TESTS} ctkAbstractLibraryFactoryTest1 ${ctkDummyPluginPATH})
  86. SET_PROPERTY(TEST ctkAbstractLibraryFactoryTest1 PROPERTY LABELS ${PROJECT_NAME})
  87. SIMPLE_TEST( ctkAbstractObjectFactoryTest1 )
  88. ADD_TEST( ctkAbstractPluginFactoryTest1 ${KIT_TESTS} ctkAbstractPluginFactoryTest1 ${ctkDummyPluginPATH})
  89. SET_PROPERTY(TEST ctkAbstractPluginFactoryTest1 PROPERTY LABELS ${PROJECT_NAME})
  90. SIMPLE_TEST( ctkAbstractQObjectFactoryTest1 )
  91. IF(HAVE_BFD)
  92. ADD_TEST(NAME ctkBinaryFileDescriptorTest1 COMMAND ${KIT_TESTS} ctkBinaryFileDescriptorTest1 $<TARGET_FILE:ctkBinaryFileDescriptorTestHelper>)
  93. SET_PROPERTY(TEST ctkBinaryFileDescriptorTest1 PROPERTY LABELS ${PROJECT_NAME})
  94. ENDIF()
  95. SIMPLE_TEST( ctkCommandLineParserTest1 )
  96. SIMPLE_TEST( ctkDependencyGraphTest1 )
  97. SIMPLE_TEST( ctkDependencyGraphTest2 )
  98. SIMPLE_TEST( ctkErrorLogModelTest1 )
  99. SIMPLE_TEST( ctkErrorLogModelTest2 )
  100. SIMPLE_TEST( ctkErrorLogModelTest3 )
  101. SET_TESTS_PROPERTIES(ctkErrorLogModelTest3 PROPERTIES PASS_REGULAR_EXPRESSION
  102. "This is a qDebug message\nThis is a std::cerr message\nThis is a qWarning message\nThis is a std::cout message\nThis is a qCritical message\n")
  103. SIMPLE_TEST( ctkModelTesterTest1 )
  104. SIMPLE_TEST( ctkPimplTest1 )
  105. SIMPLE_TEST( ctkSingletonTest1 )
  106. SIMPLE_TEST( ctkUtilsTest1 )
  107. SIMPLE_TEST( ctkUtilsTest2 )
  108. SIMPLE_TEST( ctkWorkflowTest1 )
  109. SIMPLE_TEST( ctkWorkflowTest2 )
  110. SIMPLE_TEST( ctkWorkflowTest3 )