]> git.lyx.org Git - features.git/blob - src/tests/CMakeLists.txt
Add unit test for InsetListings::getCaption()
[features.git] / src / tests / CMakeLists.txt
1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
3 #
4 # Copyright (c) 2013 Kornel Benko kornel@lyx.org
5 #
6
7 set(check_layout_SOURCES)
8 foreach(_f insets/InsetLayout.cpp Color.cpp Counters.cpp Floating.cpp
9        FloatList.cpp FontInfo.cpp Layout.cpp LayoutFile.cpp Lexer.cpp
10        ModuleList.cpp Spacing.cpp TextClass.cpp tests/check_layout.cpp
11        tests/boost.cpp tests/dummy_functions.cpp)
12   list(APPEND check_layout_SOURCES "${TOP_SRC_DIR}/src/${_f}")
13 endforeach()
14
15 include_directories(${TOP_SRC_DIR}/src/support/tests)
16
17 add_executable(check_layout ${check_layout_SOURCES})
18
19 target_link_libraries(check_layout support
20   ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
21   ${ZLIB_LIBRARY} ${ICONV_LIBRARY})
22 if(CYGWIN)
23     target_link_libraries(check_layout shlwapi)
24 endif()
25 lyx_target_link_libraries(check_layout Magic)
26
27 add_dependencies(lyx_run_tests check_layout)
28 set_target_properties(check_layout PROPERTIES FOLDER "tests/src")
29
30 file(GLOB layout_files RELATIVE "${TOP_SRC_DIR}/lib/layouts" "${TOP_SRC_DIR}/lib/layouts/*.layout")
31 file(GLOB module_files RELATIVE "${TOP_SRC_DIR}/lib/layouts" "${TOP_SRC_DIR}/lib/layouts/*.module")
32 list(SORT layout_files)
33 list(SORT module_files)
34
35 foreach(bns ${layout_files} ${module_files})
36   string(REGEX REPLACE "\\.(layout|module)" "" bn ${bns})
37   set(_checktype ${CMAKE_MATCH_1})
38   if("${_checktype}" STREQUAL "module")
39     file(WRITE "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "#% Do not delete the line below; configure depends on this\n")
40     file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "#  \\DeclareLaTeXClass{test${bn}}\n")
41     file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Format 55\n")
42     file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Input ${bns}\n")
43     add_test(NAME "check_layout/${bns}"
44       COMMAND $<TARGET_FILE:check_layout> "${LYX_TESTS_USERDIR}/layouts/test${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
45     set_tests_properties("check_layout/${bns}" PROPERTIES ENVIRONMENT ${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR})
46   else()
47     add_test(NAME "check_layout/${bns}"
48       COMMAND check_layout "${TOP_SRC_DIR}/lib/layouts/${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
49   endif()
50   settestlabel("check_layout/${bns}" "${_checktype}")
51 endforeach()
52
53 set(check_ExternalTransforms_SOURCES)
54 foreach(_f graphics/GraphicsParams.cpp insets/ExternalTransforms.cpp
55         Length.cpp lengthcommon.cpp tests/check_ExternalTransforms.cpp
56         tests/boost.cpp tests/dummy_functions.cpp)
57     list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f})
58 endforeach()
59
60 include_directories(${TOP_SRC_DIR}/src/tests)
61 add_executable(check_ExternalTransforms ${check_ExternalTransforms_SOURCES})
62
63 target_link_libraries(check_ExternalTransforms support
64         ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
65 lyx_target_link_libraries(check_ExternalTransforms Magic)
66
67 add_dependencies(lyx_run_tests check_ExternalTransforms)
68 set_target_properties(check_ExternalTransforms PROPERTIES FOLDER "tests/src")
69 target_link_libraries(check_ExternalTransforms ${ICONV_LIBRARY})
70
71 add_test(NAME "check_ExternalTransforms"
72   COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_ExternalTransforms>
73         "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/ExternalTransforms"
74         "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/ExternalTransforms_data"
75         -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
76 add_dependencies(lyx_run_tests check_ExternalTransforms)
77
78 set(check_ExternalTransforms_SOURCES)
79 foreach(_f graphics/GraphicsParams.cpp insets/ExternalTransforms.cpp
80         Length.cpp lengthcommon.cpp tests/check_ExternalTransforms.cpp
81         tests/boost.cpp tests/dummy_functions.cpp)
82     list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f})
83 endforeach()
84
85 include_directories(${TOP_SRC_DIR}/src/tests)
86 set(check_Length_SOURCES)
87 foreach(_f Length.cpp lengthcommon.cpp tests/check_Length.cpp tests/boost.cpp tests/dummy_functions.cpp)
88   list(APPEND check_Length_SOURCES ${TOP_SRC_DIR}/src/${_f})
89 endforeach()
90 add_executable(check_Length ${check_Length_SOURCES})
91
92 target_link_libraries(check_Length support
93         ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
94 lyx_target_link_libraries(check_Length Magic)
95
96 add_dependencies(lyx_run_tests check_Length)
97 set_target_properties(check_Length PROPERTIES FOLDER "tests/src")
98 target_link_libraries(check_Length ${ICONV_LIBRARY})
99
100 add_test(NAME "check_Length"
101   COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_Length>
102         "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/Length"
103         "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/Length_data"
104         -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
105 add_dependencies(lyx_run_tests check_Length)
106
107 include_directories(${TOP_SRC_DIR}/src/tests)
108 set(check_ListingsCaption_SOURCES)
109 foreach(_f tests/check_ListingsCaption.cpp tests/boost.cpp tests/dummy_functions.cpp)
110   list(APPEND check_ListingsCaption_SOURCES ${TOP_SRC_DIR}/src/${_f})
111 endforeach()
112 add_executable(check_ListingsCaption ${check_ListingsCaption_SOURCES})
113
114 target_link_libraries(check_ListingsCaption support
115         ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
116 lyx_target_link_libraries(check_ListingsCaption Magic)
117
118 add_dependencies(lyx_run_tests check_ListingsCaption)
119 set_target_properties(check_ListingsCaption PROPERTIES FOLDER "tests/src")
120 target_link_libraries(check_ListingsCaption ${ICONV_LIBRARY})
121
122 add_test(NAME "check_ListingsCaption"
123   COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_ListingsCaption>
124         "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/ListingsCaption"
125         "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/ListingsCaption_data"
126         -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
127 add_dependencies(lyx_run_tests check_ListingsCaption)
128