[gnumeric] Tests: add roundtrip test for all documentation samples.



commit 62cfa30e75489ddc027572057e0aa81628ba7a97
Author: Morten Welinder <terra gnome org>
Date:   Mon Nov 20 16:43:03 2017 -0500

    Tests: add roundtrip test for all documentation samples.
    
    This currently fails [ignored] in various ways.

 test/GnumericTest.pm  |    6 ++-
 test/Makefile.am      |    1 +
 test/t6590-samples.pl |   77 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 2 deletions(-)
---
diff --git a/test/GnumericTest.pm b/test/GnumericTest.pm
index 9800bfb..b147e95 100644
--- a/test/GnumericTest.pm
+++ b/test/GnumericTest.pm
@@ -13,12 +13,13 @@ $| = 1;
                            test_csv_format_guessing
                           test_ssindex sstest test_command message subtest
                            test_tool
-                          $ssconvert $sstest $ssdiff $topsrc $top_builddir
+                          $ssconvert $sstest $ssdiff $gnumeric
+                           $topsrc $top_builddir
                           $subtests $samples corpus $PERL);
 @GnumericTest::EXPORT_OK = qw(junkfile);
 
 use vars qw($topsrc $top_builddir $samples $default_subtests $default_corpus $PERL $verbose);
-use vars qw($ssconvert $ssindex $sstest $ssdiff);
+use vars qw($ssconvert $ssindex $sstest $ssdiff $gnumeric);
 use vars qw($normalize_gnumeric);
 
 $PERL = $Config{'perlpath'};
@@ -34,6 +35,7 @@ $ssconvert = "$top_builddir/src/ssconvert";
 $ssindex = "$top_builddir/src/ssindex";
 $sstest = "$top_builddir/src/sstest";
 $ssdiff = "$top_builddir/src/ssdiff";
+$gnumeric = "$top_builddir/src/gnumeric";
 $normalize_gnumeric = "$PERL $topsrc/test/normalize-gnumeric";
 $verbose = 0;
 $default_subtests = '*';
diff --git a/test/Makefile.am b/test/Makefile.am
index e5e440b..7ca0a21 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -113,6 +113,7 @@ TESTS =     t1000-statfuns.pl                       \
        t6520-sheet-tab.pl                      \
        t6521-sheet-names.pl                    \
        t6522-hlink.pl                          \
+       t6590-samples.pl                        \
        t7000-goal-seek.pl                      \
        t7100-solver-blend.pl                   \
        t7101-solver-afiro.pl                   \
diff --git a/test/t6590-samples.pl b/test/t6590-samples.pl
new file mode 100755
index 0000000..e0d0436
--- /dev/null
+++ b/test/t6590-samples.pl
@@ -0,0 +1,77 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use GnumericTest;
+$GnumericTest::default_subtests = '*,-biff7';
+
+my $csvfile = "samples.csv";
+&GnumericTest::junkfile ($csvfile);
+{
+    my $cmd = "$gnumeric --samples-file=$csvfile";
+    print STDERR "# $cmd\n" if $GnumericTest::verbose;
+    system ($cmd);
+    if (!-r $csvfile) {
+       print STDERR "gnumeric failed to produce $csvfile\n";
+       die "Fail\n";
+    }
+}
+
+my $file = "samples.gnumeric";
+&GnumericTest::junkfile ($file);
+{
+    my $cmd = "$ssconvert $csvfile $file";
+    print STDERR "# $cmd\n" if $GnumericTest::verbose;
+    system ($cmd);
+    if (!-r $file) {
+       print STDERR "ssconvert failed to produce $file\n";
+       die "Fail\n";
+    }
+}
+&GnumericTest::removejunk ($csvfile);
+
+
+if (&subtest ("gnumeric")) {
+    &message ("Check documentation samples gnumeric roundtrip.");
+    &test_roundtrip ($file,
+                    'format' => 'Gnumeric_XmlIO:sax',
+                    'ext' => "gnm");
+}
+
+if (&subtest ("ods")) {
+    &message ("Check documentation samples ods roundtrip.");
+    &test_roundtrip ($file,
+                    'format' => 'Gnumeric_OpenCalc:odf',
+                    'ext' => "ods",
+                    'filter2' => 'std:drop_generator',
+                    'ignore_failure' => 1);
+}
+
+if (&subtest ("biff7")) {
+    &message ("Check documentation samples xls/BIFF7 roundtrip.");
+    &test_roundtrip ($file,
+                    'format' => 'Gnumeric_Excel:excel_biff7',
+                    'ext' => "xls",
+                    'resize' => '16384x256',
+                    'filter2' => 'std:drop_codepage',
+                    'ignore_failure' => 1);
+}
+
+if (&subtest ("biff8")) {
+    &message ("Check documentation samples xls/BIFF8 roundtrip.");
+    &test_roundtrip ($file,
+                    'format' => 'Gnumeric_Excel:excel_biff8',
+                    'ext' => "xls",
+                    'filter2' => 'std:drop_codepage',
+                    'ignore_failure' => 1);
+}
+
+if (&subtest ("xlsx")) {
+    &message ("Check documentation samples xlsx roundtrip.");
+    &test_roundtrip ($file,
+                    'format' => 'Gnumeric_Excel:xlsx',
+                    'ext' => "xlsx",
+                    'resize' => '1048576x16384',
+                    'ignore_failure' => 1);
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]