mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Cmake export tests: Add structue test for exported lyx files
We test here, if any \end_{somethig} matches \begin_{something}. Exeptions are \end_index and \end_branch ATM, they should match \index and \branch respectively. Also added new testfile.
This commit is contained in:
parent
a80da13cc1
commit
d0d45d4043
302
autotests/export/MissingEndLayoutBetweenTables.lyx
Normal file
302
autotests/export/MissingEndLayoutBetweenTables.lyx
Normal file
@ -0,0 +1,302 @@
|
||||
#LyX 2.2 created this file. For more info see http://www.lyx.org/
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin unavailable
|
||||
\textclass scrbook
|
||||
\options bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading,usenames,dvipsnames,table
|
||||
\use_default_options false
|
||||
\begin_modules
|
||||
initials
|
||||
graphicboxes
|
||||
\end_modules
|
||||
\maintain_unincluded_children false
|
||||
\language english
|
||||
\language_package default
|
||||
\inputencoding auto
|
||||
\fontencoding global
|
||||
\font_roman "lmodern" "default"
|
||||
\font_sans "lmss" "default"
|
||||
\font_typewriter "lmtt" "default"
|
||||
\font_math "auto" "auto"
|
||||
\font_default_family default
|
||||
\use_non_tex_fonts false
|
||||
\font_sc false
|
||||
\font_osf false
|
||||
\font_sf_scale 100 100
|
||||
\font_tt_scale 100 100
|
||||
\graphics default
|
||||
\default_output_format default
|
||||
\output_sync 0
|
||||
\bibtex_command default
|
||||
\index_command default
|
||||
\paperfontsize 12
|
||||
\spacing single
|
||||
\use_hyperref true
|
||||
\pdf_title "LyX's Figure, Table, Floats, Notes, and Boxes manual"
|
||||
\pdf_author "LyX Team, Uwe Stöhr"
|
||||
\pdf_subject "LyX-documentation about figures, tables, floats, notes, and boxes"
|
||||
\pdf_keywords "LyX, Tables, Figures, Floats, Boxes, Notes"
|
||||
\pdf_bookmarks true
|
||||
\pdf_bookmarksnumbered true
|
||||
\pdf_bookmarksopen true
|
||||
\pdf_bookmarksopenlevel 1
|
||||
\pdf_breaklinks false
|
||||
\pdf_pdfborder false
|
||||
\pdf_colorlinks true
|
||||
\pdf_backref false
|
||||
\pdf_pdfusetitle false
|
||||
\pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false"
|
||||
\papersize default
|
||||
\use_geometry false
|
||||
\use_package amsmath 2
|
||||
\use_package amssymb 2
|
||||
\use_package cancel 0
|
||||
\use_package esint 0
|
||||
\use_package mathdots 1
|
||||
\use_package mathtools 0
|
||||
\use_package mhchem 1
|
||||
\use_package stackrel 0
|
||||
\use_package stmaryrd 0
|
||||
\use_package undertilde 0
|
||||
\cite_engine basic
|
||||
\cite_engine_type default
|
||||
\biblio_style plain
|
||||
\use_bibtopic false
|
||||
\use_indices false
|
||||
\paperorientation portrait
|
||||
\suppress_date false
|
||||
\justification true
|
||||
\use_refstyle 0
|
||||
\notefontcolor #0000ff
|
||||
\index Index
|
||||
\shortcut idx
|
||||
\color #008000
|
||||
\end_index
|
||||
\secnumdepth 3
|
||||
\tocdepth 3
|
||||
\paragraph_separation skip
|
||||
\defskip medskip
|
||||
\quotes_language english
|
||||
\papercolumns 1
|
||||
\papersides 2
|
||||
\paperpagestyle default
|
||||
\tracking_changes false
|
||||
\html_math_output 0
|
||||
\html_css_as_file 0
|
||||
\output_changes false
|
||||
\html_be_strict false
|
||||
\end_header
|
||||
|
||||
\begin_body
|
||||
|
||||
\begin_layout Title
|
||||
Stripped down Embedded objects
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
The table-wide vertical alignment is used for tables within text lines:
|
||||
\begin_inset Newline newline
|
||||
\end_inset
|
||||
|
||||
A line with tables with different alignments:
|
||||
\begin_inset Tabular
|
||||
<lyxtabular version="3" rows="2" columns="2">
|
||||
<features tabularvalignment="top">
|
||||
<column alignment="center" valignment="top" width="0pt">
|
||||
<column alignment="center" valignment="top">
|
||||
<row>
|
||||
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
|
||||
\begin_inset Text
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
</cell>
|
||||
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
|
||||
\begin_inset Text
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\family roman
|
||||
\series medium
|
||||
\shape up
|
||||
\size normal
|
||||
\emph off
|
||||
\bar no
|
||||
\noun off
|
||||
\color none
|
||||
xy1
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
|
||||
\begin_inset Text
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\family roman
|
||||
\series medium
|
||||
\shape up
|
||||
\size normal
|
||||
\emph off
|
||||
\bar no
|
||||
\noun off
|
||||
\color none
|
||||
A
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
</cell>
|
||||
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
|
||||
\begin_inset Text
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
</cell>
|
||||
</row>
|
||||
</lyxtabular>
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Tabular
|
||||
<lyxtabular version="3" rows="2" columns="2">
|
||||
<features tabularvalignment="middle">
|
||||
<column alignment="center" valignment="top">
|
||||
<column alignment="center" valignment="top">
|
||||
<row>
|
||||
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
|
||||
\begin_inset Text
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
</cell>
|
||||
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
|
||||
\begin_inset Text
|
||||
|
||||
\begin_layout Plain Layout
|
||||
xy2
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
|
||||
\begin_inset Text
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\family roman
|
||||
\series medium
|
||||
\shape up
|
||||
\size normal
|
||||
\emph off
|
||||
\bar no
|
||||
\noun off
|
||||
\color none
|
||||
A
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
</cell>
|
||||
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
|
||||
\begin_inset Text
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
</cell>
|
||||
</row>
|
||||
</lyxtabular>
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Tabular
|
||||
<lyxtabular version="3" rows="2" columns="2">
|
||||
<features tabularvalignment="bottom">
|
||||
<column alignment="center" valignment="top" width="0pt">
|
||||
<column alignment="center" valignment="top">
|
||||
<row>
|
||||
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
|
||||
\begin_inset Text
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
</cell>
|
||||
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
|
||||
\begin_inset Text
|
||||
|
||||
\begin_layout Plain Layout
|
||||
xy3
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
|
||||
\begin_inset Text
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\family roman
|
||||
\series medium
|
||||
\shape up
|
||||
\size normal
|
||||
\emph off
|
||||
\bar no
|
||||
\noun off
|
||||
\color none
|
||||
A
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
</cell>
|
||||
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
|
||||
\begin_inset Text
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
</cell>
|
||||
</row>
|
||||
</lyxtabular>
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Newline newline
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Problem occurs between the tables, missing
|
||||
\backslash
|
||||
end_layout
|
||||
\end_layout
|
||||
|
||||
\end_body
|
||||
\end_document
|
41
development/autotests/beginEndStructureCheck.pl
Executable file
41
development/autotests/beginEndStructureCheck.pl
Executable file
@ -0,0 +1,41 @@
|
||||
#! /usr/bin/env perl
|
||||
# -*- mode: perl; -*-
|
||||
|
||||
use strict;
|
||||
|
||||
my @stack = ();
|
||||
my $depth = 0;
|
||||
my $input = $ARGV[0];
|
||||
my $line = 0;
|
||||
if (open(FI, $input)) {
|
||||
while (my $l = <FI>) {
|
||||
chomp($l);
|
||||
$line++;
|
||||
if ($l =~ /^\s*\\begin_([a-z]+)/) {
|
||||
$stack[$depth] = $1;
|
||||
$depth++;
|
||||
}
|
||||
elsif ($l =~ /^\s*\\(index|branch)\s/) {
|
||||
# does not start with e.g. \begin_index, but ends with \end_index!!
|
||||
$stack[$depth] = $1;
|
||||
$depth++;
|
||||
}
|
||||
elsif ($l =~ /^\s*\\end_([a-z]+)/) {
|
||||
my $expect = $1;
|
||||
if ($depth > 0) {
|
||||
if ($stack[$depth-1] eq $expect) {
|
||||
$depth--;
|
||||
}
|
||||
else {
|
||||
print "expected \\end_$stack[$depth-1], got \\end_$expect instead at $input:$line\n";
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "got \\end_$expect, but depth is already 0 at $input:$line\n";
|
||||
exit(-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exit(0);
|
@ -28,6 +28,7 @@
|
||||
#
|
||||
|
||||
set(Perl_Script "${TOP_SRC_DIR}/development/autotests/useSystemFonts.pl")
|
||||
set(Structure_Script "${TOP_SRC_DIR}/development/autotests/beginEndStructureCheck.pl")
|
||||
set(LanguageFile "${TOP_SRC_DIR}/lib/languages")
|
||||
set(GetTempDir "${TOP_SRC_DIR}/development/autotests/getTempDir.pl")
|
||||
set(_ft ${fonttype})
|
||||
@ -77,10 +78,16 @@ if (NOT _err)
|
||||
message(STATUS "check load of ${result_file_name}")
|
||||
set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
|
||||
set(ENV{LANG} "en") # to get all error-messages in english
|
||||
execute_process(
|
||||
COMMAND ${PERL_EXECUTABLE} ${Structure_Script} "${WORKDIR}/${result_file_name}"
|
||||
RESULT_VARIABLE _err
|
||||
ERROR_VARIABLE lyxerr)
|
||||
if (NOT _err)
|
||||
execute_process(
|
||||
COMMAND ${lyx} -batch -userdir "${LYX_TESTS_USERDIR}" ${result_file_name}
|
||||
RESULT_VARIABLE _err
|
||||
ERROR_VARIABLE lyxerr)
|
||||
endif()
|
||||
if (NOT _err)
|
||||
CheckLoadErrors(lyxerr "${TOP_SRC_DIR}/development/autotests" _err)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user