2015-09-03 17:10:50 -03:00
|
|
|
# QTest based tests
|
2016-04-05 14:22:00 -03:00
|
|
|
qt5_add_resources(SUBSURFACE_TEST_RESOURCES ../subsurface.qrc)
|
|
|
|
|
2017-02-24 13:52:07 +07:00
|
|
|
# Access test data (dive folder) from SUBSURFACE_SOURCE by default.
|
|
|
|
# In cross compilation cases or when test will not be executed at build time
|
|
|
|
# a differnt value can be set via cmake -DSUBSURFACE_TEST_DATA.
|
|
|
|
if(NOT SUBSURFACE_TEST_DATA)
|
|
|
|
set(SUBSURFACE_TEST_DATA ${SUBSURFACE_SOURCE})
|
|
|
|
endif()
|
|
|
|
|
2016-04-05 14:22:00 -03:00
|
|
|
add_library(RESOURCE_LIBRARY STATIC ${SUBSURFACE_TEST_RESOURCES})
|
|
|
|
|
2015-09-03 17:10:50 -03:00
|
|
|
macro(TEST NAME FILE)
|
2016-04-05 14:22:00 -03:00
|
|
|
add_executable(${NAME} ${FILE} )
|
|
|
|
target_link_libraries(${NAME} subsurface_corelib RESOURCE_LIBRARY ${QT_TEST_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES} )
|
2015-09-03 17:10:50 -03:00
|
|
|
add_test(NAME ${NAME} COMMAND $<TARGET_FILE:${NAME}>)
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
add_definitions(-g)
|
2017-02-24 13:52:07 +07:00
|
|
|
add_definitions(-DSUBSURFACE_TEST_DATA="${SUBSURFACE_TEST_DATA}")
|
2015-09-03 17:10:50 -03:00
|
|
|
TEST(TestUnitConversion testunitconversion.cpp)
|
|
|
|
TEST(TestProfile testprofile.cpp)
|
|
|
|
TEST(TestGpsCoords testgpscoords.cpp)
|
|
|
|
TEST(TestParse testparse.cpp)
|
|
|
|
TEST(TestPlan testplan.cpp)
|
|
|
|
TEST(TestDiveSiteDuplication testdivesiteduplication.cpp)
|
|
|
|
TEST(TestRenumber testrenumber.cpp)
|
|
|
|
TEST(TestGitStorage testgitstorage.cpp)
|
2016-08-28 20:11:29 -03:00
|
|
|
TEST(TestPreferences testpreferences.cpp)
|
2017-02-21 10:27:31 +01:00
|
|
|
TEST(TestPicture testpicture.cpp)
|
2017-02-21 17:23:19 -08:00
|
|
|
TEST(TestMerge testmerge.cpp)
|
2017-02-21 10:27:31 +01:00
|
|
|
|
2015-09-03 17:10:50 -03:00
|
|
|
|
|
|
|
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
|
|
|
|
DEPENDS
|
|
|
|
TestUnitConversion
|
|
|
|
TestProfile
|
|
|
|
TestGpsCoords
|
|
|
|
TestParse
|
|
|
|
TestGitStorage
|
|
|
|
TestPlan
|
|
|
|
TestDiveSiteDuplication
|
2016-08-28 20:11:29 -03:00
|
|
|
TestPreferences
|
2016-08-28 19:26:42 -03:00
|
|
|
TestRenumber
|
2017-02-21 10:27:31 +01:00
|
|
|
TestPicture
|
2017-02-21 17:23:19 -08:00
|
|
|
TestMerge
|
2016-08-28 19:26:42 -03:00
|
|
|
)
|