Improve testing framework, add stub for GUI tests

This commit is contained in:
Dmitry Marakasov 2014-02-11 06:15:01 +04:00
parent f6d6572602
commit 820813b79f
10 changed files with 28 additions and 13 deletions

View File

@ -36,6 +36,7 @@ IF(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
TARGET_LINK_LIBRARIES(SDL2pp ${SDL2_LIBRARY}) TARGET_LINK_LIBRARIES(SDL2pp ${SDL2_LIBRARY})
# demos and tests # demos and tests
OPTION(RUN_GUI_TESTS "Run GUI tests (requires X11 display)" ON)
ENABLE_TESTING() ENABLE_TESTING()
ADD_SUBDIRECTORY(demos) ADD_SUBDIRECTORY(demos)

View File

@ -2,26 +2,40 @@
# they are compilable (e.g., includes and forward declarations are # they are compilable (e.g., includes and forward declarations are
# complete and do not require extra includes) # complete and do not require extra includes)
SET(HEADER_TESTS SET(HEADER_TESTS
hdr_exception header_exception
hdr_point header_point
hdr_rect header_rect
hdr_renderer header_renderer
hdr_sdl header_sdl
hdr_sdl2pp header_sdl2pp
hdr_texture header_texture
hdr_window header_window
)
# simple command-line tests
SET(CLI_TESTS
test_pointrect
)
# tests which test graphics functionality and thus requre working
# and OpenGL-enabled X11 display
SET(GUI_TESTS
) )
FOREACH(TEST ${HEADER_TESTS}) FOREACH(TEST ${HEADER_TESTS})
ADD_EXECUTABLE(${TEST} ${TEST}.cc) ADD_EXECUTABLE(${TEST} ${TEST}.cc)
ENDFOREACH(TEST ${TESTS}) ENDFOREACH(TEST ${TESTS})
SET(TESTS FOREACH(TEST ${CLI_TESTS})
test_pointrect
)
FOREACH(TEST ${TESTS})
ADD_EXECUTABLE(${TEST} ${TEST}.cc) ADD_EXECUTABLE(${TEST} ${TEST}.cc)
TARGET_LINK_LIBRARIES(${TEST} SDL2pp) TARGET_LINK_LIBRARIES(${TEST} SDL2pp)
ADD_TEST(${TEST} ${TEST}) ADD_TEST(${TEST} ${TEST})
ENDFOREACH(TEST ${TESTS}) ENDFOREACH(TEST ${TESTS})
FOREACH(TEST ${GUI_TESTS})
ADD_EXECUTABLE(${TEST} ${TEST}.cc)
TARGET_LINK_LIBRARIES(${TEST} SDL2pp)
IF(RUN_GUI_TESTS)
ADD_TEST(${TEST} ${TEST})
ENDIF(RUN_GUI_TESTS)
ENDFOREACH(TEST ${TESTS})