1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
4 # Copyright (c) 2013 Kornel Benko kornel@lyx.org
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 support/tests/dummy_functions.cpp)
12 list(APPEND check_layout_SOURCES "${TOP_SRC_DIR}/src/${_f}")
15 include_directories(${TOP_SRC_DIR}/src/support/tests)
17 add_executable(check_layout ${check_layout_SOURCES})
19 target_link_libraries(check_layout support
20 ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
21 ${ZLIB_LIBRARY} ${ICONV_LIBRARY})
23 target_link_libraries(check_layout shlwapi)
25 lyx_target_link_libraries(check_layout Magic)
27 add_dependencies(lyx_run_tests check_layout)
28 set_target_properties(check_layout PROPERTIES FOLDER "tests/src")
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)
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})
47 add_test(NAME "check_layout/${bns}"
48 COMMAND check_layout "${TOP_SRC_DIR}/lib/layouts/${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
50 settestlabel("check_layout/${bns}" "${_checktype}")
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 support/tests/dummy_functions.cpp)
57 list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f})
60 include_directories(${TOP_SRC_DIR}/src/tests)
61 add_executable(check_ExternalTransforms ${check_ExternalTransforms_SOURCES})
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)
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})
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)
78 set(check_Length_SOURCES)
79 foreach(_f Length.cpp lengthcommon.cpp tests/check_Length.cpp tests/boost.cpp support/tests/dummy_functions.cpp)
80 list(APPEND check_Length_SOURCES ${TOP_SRC_DIR}/src/${_f})
82 add_executable(check_Length ${check_Length_SOURCES})
84 target_link_libraries(check_Length support
85 ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
86 lyx_target_link_libraries(check_Length Magic)
88 add_dependencies(lyx_run_tests check_Length)
89 set_target_properties(check_Length PROPERTIES FOLDER "tests/src")
90 target_link_libraries(check_Length ${ICONV_LIBRARY})
92 add_test(NAME "check_Length"
93 COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_Length>
94 "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/Length"
95 "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/Length_data"
96 -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
97 add_dependencies(lyx_run_tests check_Length)
99 include_directories(${TOP_SRC_DIR}/src/tests)
100 set(check_ListingsCaption_SOURCES)
101 foreach(_f tests/check_ListingsCaption.cpp tests/boost.cpp support/tests/dummy_functions.cpp)
102 list(APPEND check_ListingsCaption_SOURCES ${TOP_SRC_DIR}/src/${_f})
104 add_executable(check_ListingsCaption ${check_ListingsCaption_SOURCES})
106 target_link_libraries(check_ListingsCaption support
107 ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
108 lyx_target_link_libraries(check_ListingsCaption Magic)
110 add_dependencies(lyx_run_tests check_ListingsCaption)
111 set_target_properties(check_ListingsCaption PROPERTIES FOLDER "tests/src")
112 target_link_libraries(check_ListingsCaption ${ICONV_LIBRARY})
114 add_test(NAME "check_ListingsCaption"
115 COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_ListingsCaption>
116 "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/ListingsCaption"
117 "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/ListingsCaption_data"
118 -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
119 add_dependencies(lyx_run_tests check_ListingsCaption)