commit 997035fe66f76e327bfbe0fac4028f4cf2d59070
Author: Kornel Benko <[email protected]>
Date:   Mon Dec 16 11:36:36 2013 +0100

    Cmake tests: Expand export tests for luatex and xetex
    
    Citing Scott:
    In our current set up, we are currently testing XeTeX and LuaTeX
    either with system fonts or with TeX fonts but never both. We should
    test with both in my opinion. We will have to ignore/invert many tests
    but it still seems useful. For example Günter fixed babel-greek so
    that it works now with TeX fonts; and Jürgen found some errors in LyX
    that were causing some of the English docs to fail with system fonts.
    Currently we only test greek documents with system fonts and we only
    test English documents with TeX fonts.
    
    This change adds the missing test-cases.

diff --git a/development/autotests/CMakeLists.txt 
b/development/autotests/CMakeLists.txt
index 43e1a63..9f07748 100644
--- a/development/autotests/CMakeLists.txt
+++ b/development/autotests/CMakeLists.txt
@@ -218,24 +218,36 @@ foreach(libsubfolder doc examples templates)
     endif()
     getoutputformats("${LIBSUB_SRC_DIR}/${f}.lyx" formatlist)
     foreach(format ${formatlist})
-      set(TestName "export/${libsubfolder}/${f}_${format}")
-      maketestname(TestName reverted revertedTests ignoredTests)
-      if(TestName)
-        add_test(NAME ${TestName}
-          WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
-          COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR}
+      if(format MATCHES "dvi3|pdf4|pdf5")
+        set(fonttypes "texF" "systemF")
+      else()
+        set(fonttypes "defaultF")
+      endif()
+      foreach(fonttype ${fonttypes})
+        if(fonttype MATCHES "defaultF")
+          set(TestName "export/${libsubfolder}/${f}_${format}")
+        else()
+          set(TestName "export/${libsubfolder}/${f}_${format}_${fonttype}")
+        endif()
+        maketestname(TestName reverted revertedTests ignoredTests)
+        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=$<TARGET_FILE:${_lyx}>
             -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
             -Dformat=${format}
+            -Dfonttype=${fonttype}
             -Dextension=${format}
             -Dfile=${f}
             -Dreverted=${reverted}
             -DTOP_SRC_DIR=${TOP_SRC_DIR}
             -DPERL_EXECUTABLE=${PERL_EXECUTABLE}
             -P "${TOP_SRC_DIR}/development/autotests/export.cmake")
-        setmarkedtestlabel(${TestName} ${reverted} "export")
-      endif()
+          setmarkedtestlabel(${TestName} ${reverted} "export")
+        endif()
+      endforeach()
     endforeach()
   endforeach()
 endforeach()
diff --git a/development/autotests/export.cmake 
b/development/autotests/export.cmake
index 90d1a66..647b9dd 100755
--- a/development/autotests/export.cmake
+++ b/development/autotests/export.cmake
@@ -18,6 +18,7 @@
 #       -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
 #       -Dlyx=xxx \
 #       -Dformat=xxx \
+#       -Dfonttype=xxx \
 #       -Dextension=xxx \
 #       -Dfile=xxx \
 #       -Dreverted=[01] \
@@ -27,13 +28,15 @@
 #
 
 set(Perl_Script "${TOP_SRC_DIR}/development/autotests/useSystemFonts.pl")
+set(_ft ${fonttype})
+message(STATUS "using fonttype = ${_ft}")
 if(format MATCHES "dvi3|pdf4|pdf5")
   message(STATUS "LYX_TESTS_USERDIR = ${LYX_TESTS_USERDIR}")
   message(STATUS "Converting with perl ${Perl_Script}")
-  set(LYX_SOURCE "${WORKDIR}/${file}_${format}.lyx")
+  set(LYX_SOURCE "${WORKDIR}/${file}_${format}_${_ft}.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}
+  execute_process(COMMAND ${PERL_EXECUTABLE} "${Perl_Script}" 
"${LYX_ROOT}/${file}.lyx" "${LYX_SOURCE}" ${format} ${_ft}
     RESULT_VARIABLE _err)
   string(COMPARE EQUAL  ${_err} 0 _erg)
   if(NOT _erg)
diff --git a/development/autotests/ignoredTests 
b/development/autotests/ignoredTests
index 8d45882..2ae8b8e 100644
--- a/development/autotests/ignoredTests
+++ b/development/autotests/ignoredTests
@@ -3,8 +3,11 @@
 check_load/templates/attic/latex8
 export/templates/attic/latex8_pdf
 export/templates/attic/latex8_pdf2
-export/templates/attic/latex8_pdf5
+export/templates/attic/latex8_pdf5_systemF
+export/templates/attic/latex8_pdf5_texF
 export/templates/attic/latex8_dvi
-export/templates/attic/latex8_dvi3
+export/templates/attic/latex8_dvi3_systemF
+export/templates/attic/latex8_dvi3_texF
 export/templates/attic/latex8_pdf3
-export/templates/attic/latex8_pdf4
+export/templates/attic/latex8_pdf4_systemF
+export/templates/attic/latex8_pdf4_texF
diff --git a/development/autotests/lyxStatus.pm 
b/development/autotests/lyxStatus.pm
index 9b917cc..fd2e382 100644
--- a/development/autotests/lyxStatus.pm
+++ b/development/autotests/lyxStatus.pm
@@ -15,6 +15,8 @@ BEGIN {
 
 my @stack = ();                        # list of HASH-Arrays
 my $rFont = {};
+my $useNonTexFont = "true";
+
 # The elements are:
 # type (layout, inset, header, preamble, ...)
 # name
@@ -27,9 +29,15 @@ my $rFont = {};
 #              but first set the modified value into $result->[$fileidx]
 #              numerical value will be replaced with appropriate matching 
group value
 
-sub initLyxStack($)
+sub initLyxStack($$)
 {
   $rFont = $_[0];
+  if ($_[1] eq "systemF") {
+    $useNonTexFont = "true";
+  }
+  else {
+    $useNonTexFont = "false";
+  }
   $stack[0] = { type => "Starting"};
 }
 
@@ -168,16 +176,16 @@ sub checkForHeader($)
                           "result" => ["\\master ", ""]);
     if (keys %{$rFont}) {
       for my $ff ( keys %{$rFont}) {
-       my $elem = &newMatch("search" => '^\\\\font_' . $ff . '\s+default',
+       my $elem = &newMatch("search" => '^\\\\font_' . $ff . '\s+',
                             "filetype" => "replace_only",
                             "result" => ["\\font_$ff ", $rFont->{$ff}]);
        push(@rElems, $elem);
       }
-      my $elemntf = &newMatch("search" => '^\\\\use_non_tex_fonts\s+false',
-                             "filetype" => "replace_only",
-                             "result" => ["\\use_non_tex_fonts true"]);
-      push(@rElems, $elemntf);
     }
+    my $elemntf = &newMatch("search" => 
'^\\\\use_non_tex_fonts\s+(false|true)',
+                           "filetype" => "replace_only",
+                           "result" => ["\\use_non_tex_fonts $useNonTexFont"]);
+    push(@rElems, $elemntf);
     &setMatching(\@rElems);
     return(1);
   }
diff --git a/development/autotests/revertedTests 
b/development/autotests/revertedTests
index 7d55852..99a7eb1 100644
--- a/development/autotests/revertedTests
+++ b/development/autotests/revertedTests
@@ -1,48 +1,86 @@
 # Hebrew docs do not currently work with LuaTeX
-export/doc/he/Intro_pdf5
-export/doc/he/Intro_dvi3
-export/doc/he/Tutorial_pdf5
-export/doc/he/Tutorial_dvi3
-export/examples/he/example_lyxified_pdf5
-export/examples/he/example_lyxified_dvi3
-export/examples/he/example_raw_pdf5
-export/examples/he/example_raw_dvi3
-export/examples/he/splash_pdf5
-export/examples/he/splash_dvi3
+export/doc/he/Intro_pdf5_systemF
+export/doc/he/Intro_pdf5_texF
+export/doc/he/Intro_dvi3_systemF
+export/doc/he/Intro_dvi3_texF
+export/doc/he/Tutorial_pdf5_systemF
+export/doc/he/Tutorial_pdf5_texF
+export/doc/he/Tutorial_dvi3_systemF
+export/doc/he/Tutorial_dvi3_texF
+export/examples/he/example_lyxified_pdf5_systemF
+export/examples/he/example_lyxified_pdf5_texF
+export/examples/he/example_lyxified_dvi3_systemF
+export/examples/he/example_lyxified_dvi3_texF
+export/examples/he/example_raw_pdf5_systemF
+export/examples/he/example_raw_pdf5_texF
+export/examples/he/example_raw_dvi3_systemF
+export/examples/he/example_raw_dvi3_texF
+export/examples/he/splash_pdf5_systemF
+export/examples/he/splash_pdf5_texF
+export/examples/he/splash_dvi3_systemF
+export/examples/he/splash_dvi3_texF
 #
 # FIXME
 # After LyX 2.1 is released, apply the patch and remove these
 # See http://www.mail-archive.com/[email protected]/msg181595.html
-export/doc/id/Intro_pdf5
-export/doc/id/Intro_dvi3
-export/doc/id/Shortcuts_pdf5
-export/doc/id/Shortcuts_dvi3
-export/doc/id/Tutorial_pdf5
-export/doc/id/Tutorial_dvi3
-export/doc/id/UserGuide_pdf5
-export/doc/id/UserGuide_dvi3
-export/examples/id/splash_pdf5
-export/examples/id/splash_dvi3
+export/doc/id/Intro_pdf5_systemF
+export/doc/id/Intro_pdf5_texF
+export/doc/id/Intro_dvi3_systemF
+export/doc/id/Intro_dvi3_texF
+export/doc/id/Shortcuts_pdf5_systemF
+export/doc/id/Shortcuts_pdf5_texF
+export/doc/id/Shortcuts_dvi3_systemF
+export/doc/id/Shortcuts_dvi3_texF
+export/doc/id/Tutorial_pdf5_systemF
+export/doc/id/Tutorial_pdf5_texF
+export/doc/id/Tutorial_dvi3_systemF
+export/doc/id/Tutorial_dvi3_texF
+export/doc/id/UserGuide_pdf5_systemF
+export/doc/id/UserGuide_pdf5_texF
+export/doc/id/UserGuide_dvi3_systemF
+export/doc/id/UserGuide_dvi3_texF
+export/examples/id/splash_pdf5_systemF
+export/examples/id/splash_pdf5_texF
+export/examples/id/splash_dvi3_systemF
+export/examples/id/splash_dvi3_texF
 #
 # FIXME
 # Similar to the Indonesian support, see:
 # http://www.mail-archive.com/[email protected]/msg181595.html
-export/doc/hu/Intro_pdf5
-export/doc/hu/Intro_dvi3
-export/examples/hu/example_lyxified_pdf5
-export/examples/hu/example_lyxified_dvi3
-export/examples/hu/example_raw_pdf5
-export/examples/hu/example_raw_dvi3
-export/examples/hu/splash_pdf5
-export/examples/hu/splash_dvi3
+export/doc/hu/Intro_pdf5_systemF
+export/doc/hu/Intro_pdf5_texF
+export/doc/hu/Intro_dvi3_systemF
+export/doc/hu/Intro_dvi3_texF
+export/examples/hu/example_lyxified_pdf5_systemF
+export/examples/hu/example_lyxified_pdf5_texF
+export/examples/hu/example_lyxified_dvi3_systemF
+export/examples/hu/example_lyxified_dvi3_texF
+export/examples/hu/example_raw_pdf5_systemF
+export/examples/hu/example_raw_pdf5_texF
+export/examples/hu/example_raw_dvi3_systemF
+export/examples/hu/example_raw_dvi3_texF
+export/examples/hu/splash_pdf5_systemF
+export/examples/hu/splash_pdf5_texF
+export/examples/hu/splash_dvi3_systemF
+export/examples/hu/splash_dvi3_texF
 #
 # Export with XeTeX and LuaTeX (with either non-tex fonts or 8-bit
 # compatibility mode) does not work because the loading of inputenc with
 # utf8x is hardcoded in europecv.cls at the time of this writing. See:
 # http://comments.gmane.org/gmane.editors.lyx.devel/145896
-export/examples/es/europeCV_pdf4
-export/examples/es/europeCV_pdf5
-export/examples/es/europeCV_dvi3
+export/examples/es/europeCV_pdf4_systemF
+export/examples/es/europeCV_pdf4_texF
+export/examples/es/europeCV_pdf5_systemF
+export/examples/es/europeCV_pdf5_texF
+export/examples/es/europeCV_dvi3_systemF
+export/examples/es/europeCV_dvi3_texF
+#
+# somehow lualatex is not able to compile with non-tex fonts
+export/doc/es/Math_dvi3_systemF
+export/doc/es/Tutorial_dvi3_systemF
+export/doc/es/UserGuide_dvi3_systemF
+export/examples/es/ejemplo_con_lyx_dvi3_systemF
+
 # See http://www.lyx.org/trac/ticket/8823
 export/examples/ja/lilypond_pdf
 export/examples/ja/sweave_pdf
@@ -51,15 +89,19 @@ export/examples/ja/knitr_pdf
 # luainputenc.sty loads luatex.sty
 # Both files (luatex.sty and ectaart.cls) define
 # the latex-command \setattribute
-export/templates/ectaart_pdf5
-export/templates/ectaart_dvi3
+export/templates/ectaart_pdf5_systemF
+export/templates/ectaart_pdf5_texF
+export/templates/ectaart_dvi3_systemF
+export/templates/ectaart_dvi3_texF
 #
 # LuaTeX does not support Farsi yet. See:
 # 
https://github.com/reutenauer/polyglossia/commit/ccb0e9e2c6411170ad779b05ff5076f1193cc323
-export/examples/fa/splash_pdf5
-export/examples/fa/splash_dvi3
+export/examples/fa/splash_pdf5_systemF
+export/examples/fa/splash_pdf5_texF
+export/examples/fa/splash_dvi3_systemF
+export/examples/fa/splash_dvi3_texF
 #
 # There is no non-TeX support for Ukrainian with LuaTeX. See:
 # https://www.mail-archive.com/[email protected]/msg181690.html
-export/doc/uk/Intro_pdf5
-export/doc/uk/Intro_dvi3
+export/doc/uk/Intro_pdf5_systemF
+export/doc/uk/Intro_dvi3_systemF
diff --git a/development/autotests/useSystemFonts.pl 
b/development/autotests/useSystemFonts.pl
index 990736e..55f520a 100644
--- a/development/autotests/useSystemFonts.pl
+++ b/development/autotests/useSystemFonts.pl
@@ -49,35 +49,47 @@ use lyxStatus;
 
 # convert lyx file to be compilable with xetex
 
-my ($source, $dest, $format, $rest) = @ARGV;
+my ($source, $dest, $format, $fontT, $rest) = @ARGV;
 
 &diestack("Too many arguments") if (defined($rest));
 &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));
 
 $source = File::Spec->rel2abs($source);
 $dest = File::Spec->rel2abs($dest);
 
 my %font = ();
-
-if ($source =~ /\/(he|el|ru|uk)\//) {
-  $font{roman} = "FreeSans";
-  $font{sans} = "FreeSans";
-  $font{typewriter} = "FreeSans";
-}
-elsif ($source =~ /\/fa\//) {
-  $font{roman} = "FreeFarsi";
-  $font{sans} = "FreeFarsi";
-  $font{typewriter} = "FreeFarsi Monospace";
+my $lang = "main";
+if ($source =~ /\/([a-z][a-z](_[A-Z][A-Z])?)\//) {
+  $lang = $1;
 }
-elsif ($source =~ /\/zh_CN\//) {
-  $font{roman} = "WenQuanYi Micro Hei";
-  $font{sans} = "WenQuanYi Micro Hei";
-  $font{typewriter} = "WenQuanYi Micro Hei";
+if ($fontT eq "systemF") {
+  if ($lang =~ /^(he|el|ru|uk|main)$/) {
+    $font{roman} = "FreeSans";
+    $font{sans} = "FreeSans";
+    $font{typewriter} = "FreeSans";
+  }
+  elsif ($lang eq "fa") {
+    $font{roman} = "FreeFarsi";
+    $font{sans} = "FreeFarsi";
+    $font{typewriter} = "FreeFarsi Monospace";
+  }
+  elsif ($lang eq "zh_CN") {
+    $font{roman} = "WenQuanYi Micro Hei";
+    $font{sans} = "WenQuanYi Micro Hei";
+    $font{typewriter} = "WenQuanYi Micro Hei";
+  }
+  else {
+    # default system fonts
+    $font{roman} = "FreeSans";
+    $font{sans} = "FreeSans";
+    $font{typewriter} = "FreeSans";
+  }
 }
 else {
-  # Nothing to do?
+  # use tex font here
 }
 
 my $sourcedir = dirname($source);
@@ -89,13 +101,7 @@ if (! -d $destdir) {
 my $destdirOfSubdocuments;
 {
   my ($name, $pat, $suffix) = fileparse($source, qr/\.[^.]*/);
-  my $ext = $format;
-  if ($source =~ /\/([a-z][a-z](_[A-Z][A-Z])?)\//) {
-    $ext .= "_$1";
-  }
-  else {
-    $ext .= "_main";
-  }
+  my $ext = $format . "_$lang";
   $destdirOfSubdocuments = "$destdir/tmp_$ext" . "_$name"; # Global var, 
something TODO here
 }
 
@@ -140,7 +146,7 @@ sub interpretedCopy($$$$)
   &diestack("could not read \"$source\"") if (!open(FI, $source));
   &diestack("could not write \"$dest\"") if (! open(FO, '>', $dest));
 
-  &initLyxStack(\%font);
+  &initLyxStack(\%font, $fontT);
 
   while (my $l = <FI>) {
     chomp($l);

Reply via email to