1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
# To add a new unittest
# 1. Add its name to kvocdoc_unittests or kvocdoc_api_unittests
include(ECMMarkAsTest)
include(ECMAddTests)
include(CTest)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR}/..
../readerwriters
)
find_package(Qt5 5.2.0 CONFIG REQUIRED Test)
#API interface unit tests linked to exported shared library
set(kvocdoc_api_unittests
# keduvocdocumentvalidatortest
# keduvocdocumentfilelockingtest
# openAPItest
keduvocdocumenttest
emptydocumenttest
)
#Unit Tests linked to objects behind the API wall
set(kvocdoc_unittests
readerkvtml2test
readerwordquiztest
readerpaukertest
readervokabelntest
readerxdxftest
)
#Helper Clases for unit tests
set(kvocdoc_unittests_helpers
readerTestHelpers
)
macro(KEDUVOCDOCUMENT_NON_GUI_UNIT_TESTS staticOrAPILib)
foreach(_testname ${ARGN})
ecm_add_test( ${_testname} ${kvocdoc_unittests_helpers}
LINK_LIBRARIES ${staticOrAPILib} KF5::CoreAddons KF5::KIOCore Qt5::Test Qt5::Xml
TEST_NAME ${_testname}
)
endforeach()
endmacro()
macro(KEDUVOCDOCUMENT_GUI_UNIT_TESTS staticOrAPILib)
foreach(_testname ${ARGN})
ecm_add_test( ${_testname} ${kvocdoc_unittests_helpers}
LINK_LIBRARIES ${staticOrAPILib} KF5::CoreAddons KF5::KIOCore Qt5::Test Qt5::Xml
TEST_NAME ${_testname}
GUI)
endforeach()
endmacro()
macro(KEDUVOCDOCUMENT_GUI_UNIT_TESTS_STATIC staticOrAPILib)
foreach(_testname ${ARGN})
ecm_add_test( ${_testname} ${kvocdoc_unittests_helpers}
LINK_LIBRARIES ${staticOrAPILib} KF5::CoreAddons KF5::KIOCore Qt5::Test Qt5::Xml
TEST_NAME ${_testname}
GUI)
set_target_properties(${_testname} PROPERTIES COMPILE_FLAGS -DKEDUVOCDOCUMENT_STATIC_DEFINE)
endforeach()
endmacro()
keduvocdocument_non_gui_unit_tests(KEduVocDocument ${kvocdoc_api_unittests})
keduvocdocument_gui_unit_tests_static(keduvocdocument_static ${kvocdoc_unittests})
|