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 CiteEnginesList.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}")
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 file(GLOB citeengine_files RELATIVE "${TOP_SRC_DIR}/lib/citeengines" "${TOP_SRC_DIR}/lib/citeengines/*.citeengine")
33 list(SORT layout_files)
34 list(SORT module_files)
35 list(SORT citeengine_files)
37 foreach(bns ${layout_files} ${module_files} ${citeengine_files})
38 string(REGEX REPLACE "\\.(layout|module|citeengine)" "" bn ${bns})
39 set(_checktype ${CMAKE_MATCH_1})
40 if("${_checktype}" MATCHES "module|citeengine")
41 file(WRITE "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "#% Do not delete the line below; configure depends on this\n")
42 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "# \\DeclareLaTeXClass{test${bn}}\n")
43 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Format 74\n")
44 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Style Standard\n")
45 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" " LabelType No_Label\n")
46 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" " Category MainText\n")
47 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "End\n")
48 if ("${_checktype}" STREQUAL "citeengine")
49 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Input \"${TOP_SRC_DIR}/lib/citeengines/${bns}\"\n")
51 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Input ${bns}\n")
53 add_test(NAME "check_layout/${bns}"
54 COMMAND ${CMAKE_COMMAND}
55 "-DCheckLayout=$<TARGET_FILE:check_layout>"
56 "-DModule=${LYX_TESTS_USERDIR}/layouts/test${bn}"
57 "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}"
58 -P "${TOP_SRC_DIR}/src/tests/check_layout.cmake")
59 set_tests_properties("check_layout/${bns}" PROPERTIES ENVIRONMENT ${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR})
61 add_test(NAME "check_layout/${bns}"
62 COMMAND check_layout "${TOP_SRC_DIR}/lib/layouts/${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
64 settestlabel("check_layout/${bns}" "${_checktype}")
67 set(check_ExternalTransforms_SOURCES)
68 foreach(_f graphics/GraphicsParams.cpp insets/ExternalTransforms.cpp
69 tests/check_ExternalTransforms.cpp
70 tests/boost.cpp tests/dummy_functions.cpp)
71 list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f})
74 include_directories(${TOP_SRC_DIR}/src/tests)
75 add_executable(check_ExternalTransforms ${check_ExternalTransforms_SOURCES})
77 target_link_libraries(check_ExternalTransforms support
78 ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
79 lyx_target_link_libraries(check_ExternalTransforms Magic)
81 add_dependencies(lyx_run_tests check_ExternalTransforms)
82 set_target_properties(check_ExternalTransforms PROPERTIES FOLDER "tests/src")
83 target_link_libraries(check_ExternalTransforms ${ICONV_LIBRARY})
85 add_test(NAME "check_ExternalTransforms"
86 COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_ExternalTransforms>
87 "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/ExternalTransforms"
88 "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/ExternalTransforms_data"
89 -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
90 add_dependencies(lyx_run_tests check_ExternalTransforms)
92 set(check_Length_SOURCES)
93 foreach(_f tests/check_Length.cpp tests/boost.cpp tests/dummy_functions.cpp)
94 list(APPEND check_Length_SOURCES ${TOP_SRC_DIR}/src/${_f})
96 add_executable(check_Length ${check_Length_SOURCES})
98 target_link_libraries(check_Length support
99 ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
100 lyx_target_link_libraries(check_Length Magic)
102 add_dependencies(lyx_run_tests check_Length)
103 set_target_properties(check_Length PROPERTIES FOLDER "tests/src")
104 target_link_libraries(check_Length ${ICONV_LIBRARY})
106 add_test(NAME "check_Length"
107 COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_Length>
108 "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/Length"
109 "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/Length_data"
110 -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
111 add_dependencies(lyx_run_tests check_Length)
113 include_directories(${TOP_SRC_DIR}/src/tests)
114 set(check_ListingsCaption_SOURCES)
115 foreach(_f tests/check_ListingsCaption.cpp tests/boost.cpp tests/dummy_functions.cpp)
116 list(APPEND check_ListingsCaption_SOURCES ${TOP_SRC_DIR}/src/${_f})
118 add_executable(check_ListingsCaption ${check_ListingsCaption_SOURCES})
120 target_link_libraries(check_ListingsCaption support
121 ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
122 lyx_target_link_libraries(check_ListingsCaption Magic)
124 add_dependencies(lyx_run_tests check_ListingsCaption)
125 set_target_properties(check_ListingsCaption PROPERTIES FOLDER "tests/src")
126 target_link_libraries(check_ListingsCaption ${ICONV_LIBRARY})
128 add_test(NAME "check_ListingsCaption"
129 COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_ListingsCaption>
130 "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/ListingsCaption"
131 "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/ListingsCaption_data"
132 -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
133 add_dependencies(lyx_run_tests check_ListingsCaption)