Cmake lyx2lyx tests: Correct use of value for \use_non_tex_fonts

Amend eec3d1eb,7568571a
We are trying to check if the resulting file after lyx2lyx
is compilable, we have to ensure that copying the original file
to the test directory does not mangle use_non_tex_fonts-entry.

(cherry picked from commit c9e62dec53)
This commit is contained in:
Kornel Benko 2019-01-05 08:34:00 +01:00
parent 410054ba5e
commit db5fb78cfd
2 changed files with 17 additions and 5 deletions

View File

@ -68,7 +68,7 @@ else()
set(LYX_SOURCE "${TempDir}/${file}.lyx")
message(STATUS "Using source \"${LYX_ROOT}/${file}.lyx\"")
message(STATUS "Using dest \"${LYX_SOURCE}\"")
execute_process(COMMAND ${PERL_EXECUTABLE} "${Perl_Script}" "${LYX_ROOT}/${file}.lyx" "${LYX_SOURCE}" ${format} "default" "default" ${LanguageFile}
execute_process(COMMAND ${PERL_EXECUTABLE} "${Perl_Script}" "${LYX_ROOT}/${file}.lyx" "${LYX_SOURCE}" ${format} "dontChange" "default" ${LanguageFile}
RESULT_VARIABLE _err)
string(COMPARE EQUAL ${_err} 0 _erg)
if(NOT _erg)

View File

@ -56,6 +56,9 @@ sub initLyxStack($$$)
if ($_[1] eq "systemF") {
$useNonTexFont = "true";
}
elsif ($_[1] eq "dontChange") {
$useNonTexFont = "dontChange";
}
else {
$useNonTexFont = "false";
$inputEncoding = $_[2];
@ -144,6 +147,13 @@ sub newMatch(%)
if (! defined($elem{"fileidx"})) {
$elem{"fileidx"} = 1;
}
if (exists($elem{"search"})) {
my $ref = ref($elem{"search"});
diestack("Wrong or invalid regex (ref == $ref) specified") if ($ref ne "Regexp");
}
else {
diestack("No search defined");
}
diestack("No result defined") if (! defined($elem{"result"}));
return(\%elem);
}
@ -213,10 +223,12 @@ sub checkForHeader($)
push(@rElems, $elem, $elem1, $elem2);
}
}
my $elemntf = newMatch("search" => '^\\\\use_non_tex_fonts\s+(false|true)',
if ($useNonTexFont ne "dontChange") {
my $elemntf = newMatch("search" => qr/^\\use_non_tex_fonts\s+(false|true)/,
"filetype" => "replace_only",
"result" => ["\\use_non_tex_fonts $useNonTexFont"]);
push(@rElems, $elemntf);
}
if (defined($inputEncoding)) {
my $inputenc = newMatch("search" => '^\\\\inputencoding\s+(' . $inputEncoding->{search} . ')',
"filetype" => "replace_only",