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 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 63\n")
42 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Style Standard\n")
43 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" " LabelType No_Label\n")
44 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" " Category MainText\n")
45 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "End\n")
46 file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Input ${bns}\n")
47 add_test(NAME "check_layout/${bns}"
48 COMMAND ${CMAKE_COMMAND}
49 "-DCheckLayout=$<TARGET_FILE:check_layout>"
50 "-DModule=${LYX_TESTS_USERDIR}/layouts/test${bn}"
51 "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}"
52 -P "${TOP_SRC_DIR}/src/tests/check_layout.cmake")
53 set_tests_properties("check_layout/${bns}" PROPERTIES ENVIRONMENT ${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR})
55 add_test(NAME "check_layout/${bns}"
56 COMMAND check_layout "${TOP_SRC_DIR}/lib/layouts/${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
58 settestlabel("check_layout/${bns}" "${_checktype}")
61 set(check_ExternalTransforms_SOURCES)
62 foreach(_f graphics/GraphicsParams.cpp insets/ExternalTransforms.cpp
63 Length.cpp lengthcommon.cpp tests/check_ExternalTransforms.cpp
64 tests/boost.cpp tests/dummy_functions.cpp)
65 list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f})
68 include_directories(${TOP_SRC_DIR}/src/tests)
69 add_executable(check_ExternalTransforms ${check_ExternalTransforms_SOURCES})
71 target_link_libraries(check_ExternalTransforms support
72 ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
73 lyx_target_link_libraries(check_ExternalTransforms Magic)
75 add_dependencies(lyx_run_tests check_ExternalTransforms)
76 set_target_properties(check_ExternalTransforms PROPERTIES FOLDER "tests/src")
77 target_link_libraries(check_ExternalTransforms ${ICONV_LIBRARY})
79 add_test(NAME "check_ExternalTransforms"
80 COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_ExternalTransforms>
81 "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/ExternalTransforms"
82 "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/ExternalTransforms_data"
83 -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
84 add_dependencies(lyx_run_tests check_ExternalTransforms)
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})
90 add_executable(check_Length ${check_Length_SOURCES})
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)
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})
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)
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})
112 add_executable(check_ListingsCaption ${check_ListingsCaption_SOURCES})
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)
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})
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)