]> git.lyx.org Git - lyx.git/blob - src/tex2lyx/test/CMakeLists.txt
Fix text direction issue for InsetInfo in RTL context
[lyx.git] / src / tex2lyx / test / 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) 2012 Kornel Benko, <kornel@lyx.org>
5 #
6
7 project(testTex2lyx)
8
9 #file(GLOB _tex_tests RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.ltx" "${CMAKE_CURRENT_SOURCE_DIR}/*.tex")
10 #
11 #list(REMOVE_ITEM _tex_tests DummyDocument.tex)
12
13 set(_tex_tests test.ltx
14                algo2e.tex
15                beamer.tex
16                box-color-size-space-align.tex
17                CJK.tex
18                CJKutf8.tex
19                tabular-x-test.tex
20                test-insets-basic.tex
21                test-insets.tex
22                test-memoir.tex
23                test-minted.tex
24                test-modules.tex
25                test-refstyle-theorems.tex
26                test-scr.tex
27                test-structure.tex
28                verbatim.tex
29                XeTeX-polyglossia.tex)
30
31 set(runtestsScript "${TOP_SRC_DIR}/src/tex2lyx/test/runtests.py")
32 set(scriptDir "${TOP_SRC_DIR}/lib/scripts")
33
34 foreach(_fl ${_tex_tests})
35   set(fl ${_fl})
36   add_test(NAME tex2lyx/roundtrip/${_fl}
37     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
38     COMMAND ${CMAKE_COMMAND}
39       -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}
40       -DLYX_USERDIR_VER=${LYX_USERDIR_VER}
41       -DLYX_PYTHON_EXECUTABLE=${LYX_PYTHON_EXECUTABLE}
42       -DPY_SCRIPT=${runtestsScript}
43       -DTEX2LYX_EXE=$<TARGET_FILE:${_tex2lyx}>
44       -DSCRIPT_DIR=${scriptDir}
45       -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
46       -DTESTFILE=${fl}
47       -P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
48   set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "roundtrip:tex2lyx")
49   add_test(NAME tex2lyx/cmplyx/${_fl}
50     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
51     COMMAND ${CMAKE_COMMAND}
52       -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}
53       -DLYX_USERDIR_VER=${LYX_USERDIR_VER}
54       -DLYX_PYTHON_EXECUTABLE=${LYX_PYTHON_EXECUTABLE}
55       -DPY_SCRIPT=${runtestsScript}
56       -DFIRST_PARAM=uselyx2lyx
57       -DTEX2LYX_EXE=$<TARGET_FILE:${_tex2lyx}>
58       -DSCRIPT_DIR=${scriptDir}
59       -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
60       -DTESTFILE=${fl}
61       -P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
62   set_tests_properties(tex2lyx/cmplyx/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "cmplyx:tex2lyx")
63 endforeach()
64
65 add_dependencies(lyx_run_tests ${_tex2lyx} ${_lyx})
66
67 set(LyxTestFiles "")            # "'" separated test-filenames
68 set(LyxRemoveFiles)             # Extra files created by runtests.py
69 foreach(_fl ${_tex_tests})
70   set(LyxTestFiles "${LyxTestFiles}'${_fl}")
71   if (_fl MATCHES "^\(.*\)\\.\([^\\.]+)$")
72     list(APPEND LyxRemoveFiles "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_MATCH_1}.lyx.tex")
73   endif()
74 endforeach()
75 foreach(_lrf "DummyDocument.lyx.tex" "Dummy~Document.lyx.tex" "foo.pdf" "xfigtest.pdf" "xfigtest.pdftex_t")
76   list(APPEND LyxRemoveFiles "${CMAKE_CURRENT_SOURCE_DIR}/${_lrf}")
77 endforeach()
78 list(APPEND LyxRemoveFiles "${TOP_SRC_DIR}/lib/examples/longsheet.tex")
79
80 add_custom_command(
81   OUTPUT Tex2lyxFilesUpdated
82   COMMAND ${CMAKE_COMMAND}
83   -DCOMMAND="${LYX_PYTHON_EXECUTABLE}"
84   -DENVIRON="${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR}"
85   -DPARAMS="${runtestsScript}'$<TARGET_FILE:${_tex2lyx}>'${scriptDir}'${CMAKE_CURRENT_SOURCE_DIR}"
86   -DSINGLEPARLIST="${LyxTestFiles}"
87   -P ${TOP_SRC_DIR}/src/tex2lyx/test/env_custom_command.cmake
88   COMMAND ${CMAKE_COMMAND} -E touch Tex2lyxFilesUpdated
89   WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
90   DEPENDS ${_tex2lyx} ${_lyx}
91   )
92
93 add_custom_target(updatetex2lyxtests DEPENDS Tex2lyxFilesUpdated)
94 set_target_properties(updatetex2lyxtests PROPERTIES FOLDER "tests/tex2lyx")
95
96 # In order to not pollute the source directory
97 # now remove some untracked files created by the target updatetex2lyxtests
98 add_custom_command(
99   OUTPUT UpdateFilesRemoved
100   COMMAND ${CMAKE_COMMAND} -E remove -f ${LyxRemoveFiles}
101   COMMAND ${CMAKE_COMMAND} -E touch UpdateFilesRemoved
102   DEPENDS Tex2lyxFilesUpdated
103 )
104
105 add_custom_target(cleanupdatetex2lyxtests DEPENDS UpdateFilesRemoved)
106 set_target_properties(cleanupdatetex2lyxtests PROPERTIES FOLDER "tests/tex2lyx")