mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 02:49:46 +00:00
Added testcase for ticket #11156
The test is named "AMS-import", with defined test-labels 'tex2lyx' and 'batch'
This commit is contained in:
parent
8b4c76fb24
commit
1a36fee79d
@ -1,7 +1,10 @@
|
||||
# Checking whether moving beamer slides through the document doesn't break its structure.
|
||||
# see also https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg203281.html
|
||||
add_test(NAME "outline-beamer" COMMAND ${PERL_EXECUTABLE} ${CMAKE_BINARY_DIR}/lyx_batch.pl beamer_test)
|
||||
setmarkedtestlabel(outline-beamer "export")
|
||||
setmarkedtestlabel(outline-beamer "export" "batch")
|
||||
# Checking that info inset correctly fills up VCS information
|
||||
# see also bug #10835
|
||||
add_test(NAME "vcs-info" COMMAND ${PERL_EXECUTABLE} ${CMAKE_BINARY_DIR}/lyx_batch.pl vcs_info_export)
|
||||
setmarkedtestlabel(vcs-info "batch")
|
||||
add_test(NAME "AMS-import" COMMAND ${PERL_EXECUTABLE} ${CMAKE_BINARY_DIR}/lyx_batch.pl ams-import)
|
||||
setmarkedtestlabel(AMS-import "tex2lyx" "batch")
|
||||
|
49
lib/scripts/lyx_batch.pl.in
Executable file → Normal file
49
lib/scripts/lyx_batch.pl.in
Executable file → Normal file
@ -12,7 +12,7 @@ sub check_precondition();
|
||||
sub system1(@);
|
||||
|
||||
my $builddir = "@CMAKE_BINARY_DIR@";
|
||||
my $userdir = "$builddir/Testing/.lyx";
|
||||
my $userdir = "$builddir/Testing/.lyxbatch";
|
||||
my $workdir = "$builddir/autotests/out-home";
|
||||
|
||||
my $vsuffix = "@PROGRAM_SUFFIX@";
|
||||
@ -24,7 +24,8 @@ my $data = "$lyxsource/development/batchtests";
|
||||
|
||||
my %Tests = (
|
||||
beamer_test => {
|
||||
create => "beamer_test.tex",
|
||||
orig_ext => "lyx",
|
||||
create => ["beamer_test.tex"],
|
||||
commands => ["file-open beamer_test.lyx",
|
||||
"buffer-begin",
|
||||
"repeat 150 outline-down",
|
||||
@ -38,24 +39,48 @@ my %Tests = (
|
||||
command => [$git_exe, "ls-files", "--error-unmatch", "vcs_info_export.lyx"],
|
||||
workdir => "$data",
|
||||
},
|
||||
create => "vcs_info_export.tex",
|
||||
orig_ext => "lyx",
|
||||
create => ["vcs_info_export.tex"],
|
||||
command_line => ["-E", "pdflatex", "vcs_info_export.tex", "$data/vcs_info_export.lyx"],
|
||||
}
|
||||
},
|
||||
"ams-import" => {
|
||||
docompare => 0,
|
||||
orig_ext => "tex",
|
||||
create => ["ams-import.pdf", "ams-import.lyx"],
|
||||
commands => ["buffer-new",
|
||||
"buffer-import latex ams-import.tex",
|
||||
"buffer-write",
|
||||
"buffer-export pdf2",
|
||||
"lyx-quit"],
|
||||
},
|
||||
);
|
||||
|
||||
die("Expected argument missing") if (! defined($ARGV[0]));
|
||||
my $test = $ARGV[0];
|
||||
die("Invalid argument") if (! defined($Tests{$test}));
|
||||
|
||||
my $orig_lyx = "$data/$test.lyx";
|
||||
my $work_lyx = "$workdir/$test.lyx";
|
||||
if (! -e $userdir) {
|
||||
mkdir($userdir);
|
||||
}
|
||||
my $orig_file = "$data/$test.$Tests{$test}->{orig_ext}";
|
||||
my $work_file = "$workdir/$test.$Tests{$test}->{orig_ext}";
|
||||
my $expected = "$data/$test.tex.orig";
|
||||
my $created = "$workdir/$Tests{$test}->{create}";
|
||||
|
||||
die("File \"$expected\" does not exist") if (! -e $expected);
|
||||
my @created = ();
|
||||
if (defined($Tests{$test}->{create})) {
|
||||
for my $created (@{$Tests{$test}->{create}}) {
|
||||
push(@created, "$workdir/$created");
|
||||
}
|
||||
}
|
||||
my $created = $created[0];
|
||||
my $docompare = 1;
|
||||
if (defined($Tests{$test}->{docompare})) {
|
||||
$docompare = $Tests{$test}->{docompare};
|
||||
}
|
||||
die("File \"$expected\" does not exist") if ($docompare && ! -e $expected);
|
||||
# Create lyx-file to work with
|
||||
copy($orig_lyx, $work_lyx) or die("Copy failed: $!");
|
||||
unlink($created);
|
||||
copy($orig_file, $work_file) or die("Copy failed: $!");
|
||||
print "Unlinking " . join(' ', @created) . "\n";
|
||||
unlink(@created);
|
||||
$ENV{LANG} = "en";
|
||||
$ENV{LC_ALL} = "C";
|
||||
$ENV{LANGUAGE} = "en_US";
|
||||
@ -71,7 +96,7 @@ if (defined($Tests{$test}->{commands})) {
|
||||
}
|
||||
|
||||
system1(@command);
|
||||
die("Expected ($expected) and created ($created) files differ") if (compare($expected, $created) != 0);
|
||||
die("Expected ($expected) and created ($created) files differ") if ($docompare && compare($expected, $created) != 0);
|
||||
|
||||
exit(0);
|
||||
|
||||
|
@ -44,7 +44,7 @@ foreach(_fl ${_tex_tests})
|
||||
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
|
||||
-DTESTFILE=${fl}
|
||||
-P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
|
||||
set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "roundtrip")
|
||||
set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "roundtrip:tex2lyx")
|
||||
add_test(NAME tex2lyx/cmplyx/${_fl}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
@ -58,7 +58,7 @@ foreach(_fl ${_tex_tests})
|
||||
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
|
||||
-DTESTFILE=${fl}
|
||||
-P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
|
||||
set_tests_properties(tex2lyx/cmplyx/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "cmplyx")
|
||||
set_tests_properties(tex2lyx/cmplyx/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "cmplyx:tex2lyx")
|
||||
endforeach()
|
||||
|
||||
add_dependencies(lyx_run_tests ${_tex2lyx} ${_lyx})
|
||||
|
Loading…
Reference in New Issue
Block a user