From: Kornel Benko Date: Wed, 9 Nov 2016 23:56:49 +0000 (+0100) Subject: Cmake export tests: Check exports also for different possible input encodigs X-Git-Tag: 2.3.0alpha1~750 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=3ade00683c6c6a2d1a096a6b5098a4636f883f33;p=features.git Cmake export tests: Check exports also for different possible input encodigs Affected are all lyx files in "autotests/export/latex/Unicode-characters" directory. This completes the commit 6674a91573477e4716869ba728a9932e0a00e9e3 Thanks Günter. --- diff --git a/development/autotests/ExportTests.cmake b/development/autotests/ExportTests.cmake index 1ac487947e..a0fae3a0f9 100644 --- a/development/autotests/ExportTests.cmake +++ b/development/autotests/ExportTests.cmake @@ -381,31 +381,60 @@ foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates autote set(fonttypes "defaultF") endif() foreach(fonttype ${fonttypes}) - if(fonttype MATCHES "defaultF") - set(TestName "export/${libsubfolder}/${f}_${format}") + if (format MATCHES "pdf2" AND f MATCHES "Unicode-characters") + #message(STATUS "Test ${TestName} matches Unicode encodings") + set(test_encodings "default" "ascii" "utf8x" "armscii8" "applemac" + "cp437" "cp437de" "cp850" "cp852" + "cp855" "cp858" "cp862" "cp865" + "cp866" "cp1250" "cp1251" "cp1252" + "cp1255" "cp1256" "cp1257" + "koi8-r" "koi8-u" + "iso8859-1" "iso8859-2" "iso8859-3" + "iso8859-4" "iso8859-5" "iso8859-6" + "iso8859-7" "iso8859-8" "iso8859-9" + "iso8859-13" "iso8859-15" "iso8859-16" + "pt154" "pt254" "big5" "shift-jis" + "euc-cn" "gbk" "jis" "euc-kr" + "utf8-cjk" "euc-tw" "euc-jp" + "euc-jp-platex" "jis-platex" + "shift-jis-platex" "utf8-platex" + "tis620-0") else() - set(TestName "export/${libsubfolder}/${f}_${format}_${fonttype}") - endif() - set(mytestlabel ${testlabel}) - maketestname(TestName inverted invertedTests ignoredTests unreliableTests mytestlabel) - if(TestName) - add_test(NAME ${TestName} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}" - COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR} - -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} - -Dlyx=$ - -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME} - -Dformat=${format} - -Dfonttype=${fonttype} - -Dextension=${format} - -Dfile=${f} - -Dinverted=${inverted} - -DTOP_SRC_DIR=${TOP_SRC_DIR} - -DPERL_EXECUTABLE=${PERL_EXECUTABLE} - -DXMLLINT_EXECUTABLE=${XMLLINT_EXECUTABLE} - -P "${TOP_SRC_DIR}/development/autotests/export.cmake") - setmarkedtestlabel(${TestName} ${mytestlabel}) # check for suspended pdf/dvi exports + set(test_encodings "default") endif() + foreach (_enc2 ${test_encodings}) + if ("${_enc2}" STREQUAL "default") + set(_enc "") + else() + set(_enc "_${_enc2}") + endif() + if(fonttype MATCHES "defaultF") + set(TestName "export/${libsubfolder}/${f}${_enc}_${format}") + else() + set(TestName "export/${libsubfolder}/${f}${_enc}_${format}_${fonttype}") + endif() + set(mytestlabel ${testlabel}) + maketestname(TestName inverted invertedTests ignoredTests unreliableTests mytestlabel) + if(TestName) + add_test(NAME ${TestName} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}" + COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR} + -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} + -Dlyx=$ + -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME} + -Dformat=${format} + -Dfonttype=${fonttype} + -Dextension=${format} + -Dfile=${f} + -Dinverted=${inverted} + -DTOP_SRC_DIR=${TOP_SRC_DIR} + -DPERL_EXECUTABLE=${PERL_EXECUTABLE} + -DXMLLINT_EXECUTABLE=${XMLLINT_EXECUTABLE} + -DENCODING=${_enc2} + -P "${TOP_SRC_DIR}/development/autotests/export.cmake") + setmarkedtestlabel(${TestName} ${mytestlabel}) # check for suspended pdf/dvi exports + endif() + endforeach() endforeach() endforeach() endforeach() diff --git a/development/autotests/export.cmake b/development/autotests/export.cmake index fea5e25fe1..08fd86e30b 100755 --- a/development/autotests/export.cmake +++ b/development/autotests/export.cmake @@ -23,9 +23,10 @@ # -DLYX_FORMAT_NUM=${_lyx_format_num} \ # -Dfile=xxx \ # -Dinverted=[01] \ -# -DTOP_SRC_DIR=${TOP_SRC_DIR} -# -DPERL_EXECUTABLE=${PERL_EXECUTABLE} -# -DXMLLINT_EXECUTABLE=${XMLLINT_EXECUTABLE} +# -DTOP_SRC_DIR=${TOP_SRC_DIR} \ +# -DPERL_EXECUTABLE=${PERL_EXECUTABLE} \ +# -DXMLLINT_EXECUTABLE=${XMLLINT_EXECUTABLE} \ +# -DENCODING=xxx \ # -P "${TOP_SRC_DIR}/development/autotests/export.cmake" # @@ -36,13 +37,24 @@ set(GetTempDir "${TOP_SRC_DIR}/development/autotests/getTempDir.pl") set(_ft ${fonttype}) execute_process(COMMAND ${PERL_EXECUTABLE} "${GetTempDir}" "${WORKDIR}" OUTPUT_VARIABLE TempDir) message(STATUS "using fonttype = ${_ft}") +if(NOT ENCODING) + set(ENCODING "default") +endif() +if(ENCODING STREQUAL "default") + set(_enc) +else() + set(_enc "_${ENCODING}") +endif() if(format MATCHES "dvi|pdf") message(STATUS "LYX_TESTS_USERDIR = ${LYX_TESTS_USERDIR}") message(STATUS "Converting with perl ${Perl_Script}") - set(LYX_SOURCE "${TempDir}/${file}_${format}_${_ft}.lyx") + set(LYX_SOURCE "${TempDir}/${file}_${format}_${_ft}${_enc}.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} ${_ft} ${LanguageFile} + if(NOT "${ENCODING}" STREQUAL "default") + # message(STATUS "ENCODING = ${ENCODING}") + endif() + execute_process(COMMAND ${PERL_EXECUTABLE} "${Perl_Script}" "${LYX_ROOT}/${file}.lyx" "${LYX_SOURCE}" ${format} ${_ft} ${ENCODING} ${LanguageFile} RESULT_VARIABLE _err) string(COMPARE EQUAL ${_err} 0 _erg) if(NOT _erg) diff --git a/development/autotests/useSystemFonts.pl b/development/autotests/useSystemFonts.pl index c68686b00a..58006b097e 100644 --- a/development/autotests/useSystemFonts.pl +++ b/development/autotests/useSystemFonts.pl @@ -65,7 +65,7 @@ sub getLangEntry(); # convert lyx file to be compilable with xetex -my ($source, $dest, $format, $fontT, $languageFile, $rest) = @ARGV; +my ($source, $dest, $format, $fontT, $encodingT, $languageFile, $rest) = @ARGV; my %encodings = (); # Encoding with TeX fonts, depending on language tag diestack("Too many arguments") if (defined($rest)); @@ -73,6 +73,7 @@ diestack("Sourcefilename not defined") if (! defined($source)); diestack("Destfilename not defined") if (! defined($dest)); diestack("Format (e.g. pdf4) not defined") if (! defined($format)); diestack("Font type (e.g. texF) not defined") if (! defined($fontT)); +diestack("Encoding (e.g. ascii) not defined") if (! defined($encodingT)); $source = File::Spec->rel2abs($source); $dest = File::Spec->rel2abs($dest); @@ -123,6 +124,13 @@ if ($fontT eq "systemF") { $font{typewriter} = "FreeMono"; } } +elsif ($encodingT ne "default") { + # set input encoding to the requested value + $inputEncoding = { + "search" => '.*', # this will be substituted from '\inputencoding'-line + "out" => $encodingT, + }; +} elsif (0) { # set to '1' to enable setting of inputencoding # use tex font here my %encoding = (); @@ -165,7 +173,7 @@ my $destdirOfSubdocuments; if(-d $destdirOfSubdocuments) { rmtree($destdirOfSubdocuments); } -mkdir($destdirOfSubdocuments); # for possibly included files +mkpath($destdirOfSubdocuments); # for possibly included files my %IncludedFiles = (); my %type2hash = (