[gnumeric] Tests: maintain and use a pool of standard filters.



commit 2fbc746f548675cb1f2e377bef077de4b68cbf59
Author: Morten Welinder <terra gnome org>
Date:   Sat Sep 20 13:33:38 2014 -0400

    Tests: maintain and use a pool of standard filters.
    
    This cuts down on copied filters of dubious quality.  If needed,
    things can now be fixed in one place.

 test/ChangeLog                 |    5 +++++
 test/GnumericTest.pm           |   38 ++++++++++++++++++++++++++++++++++++--
 test/t6500-strings.pl          |    7 +++----
 test/t6501-numbers.pl          |    8 +++-----
 test/t6502-styles.pl           |    8 +++-----
 test/t6503-page-setup.pl       |    8 +++-----
 test/t6504-formula.pl          |    8 +++-----
 test/t6505-colrow.pl           |    8 +++-----
 test/t6506-cell-comments.pl    |   13 ++++---------
 test/t6507-split-panes.pl      |    8 +++-----
 test/t6508-sheet-formatting.pl |    8 +++-----
 test/t6509-validation.pl       |    8 +++-----
 test/t6510-auto-filter.pl      |    8 +++-----
 test/t6511-solver.pl           |    8 +++-----
 test/t6512-format.pl           |    8 +++-----
 test/t6513-merges.pl           |    8 +++-----
 test/t6514-rich-text.pl        |   23 ++++++-----------------
 test/t6515-cond-format.pl      |   13 +++----------
 test/t6516-graph.pl            |    8 +++-----
 test/t6517-names.pl            |    8 +++-----
 20 files changed, 99 insertions(+), 112 deletions(-)
---
diff --git a/test/ChangeLog b/test/ChangeLog
index f668610..9534a48 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2014-09-20  Morten Welinder  <terra gnome org>
+
+       * GnumericTest.pm (normalize_filter): Maintain a catalog of
+       standard filters.
+
 2014-09-11  Morten Welinder  <terra gnome org>
 
        * t6514-rich-text.pl: Hide comment author and rich text formatting
diff --git a/test/GnumericTest.pm b/test/GnumericTest.pm
index e43d442..c8c9cc8 100644
--- a/test/GnumericTest.pm
+++ b/test/GnumericTest.pm
@@ -376,6 +376,38 @@ sub test_exporter {
 
 # -----------------------------------------------------------------------------
 
+# The BIFF formats leave us with a msole:codepage property
+my $drop_codepage_filter =
+    "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+
+my $drop_generator_filter =
+    "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'";
+
+# BIFF7 doesn't store cell comment author
+my $no_author_filter = "$PERL -p -e 's{ Author=\"[^\"]*\"}{};'";
+
+# BIFF7 cannot store rich text comments
+my $no_rich_comment_filter = "$PERL -p -e 'if (/gnm:CellComment/) { s{ TextFormat=\"[^\"]*\"}{}; }'";
+
+# Excel cannot have superscript and subscript at the same time
+my $supersub_filter = "$PERL -p -e 
's{\\[superscript=1:(\\d+):(\\d+)\\]\\[subscript=1:(\\d+):\\2\\]}{[superscript=1:\$1:\$3][subscript=1:\$3:\$2]};'";
+
+
+sub normalize_filter {
+    my ($f) = @_;
+    return 'cat' unless defined $f;
+
+    $f =~ s/std:drop_codepage/$drop_codepage_filter/;
+    $f =~ s/std:drop_generator/$drop_generator_filter/;
+    $f =~ s/std:no_author/$no_author_filter/;
+    $f =~ s/std:no_rich_comment/$no_rich_comment_filter/;
+    $f =~ s/std:supersub/$supersub_filter/;
+
+    return $f;
+}
+
+# -----------------------------------------------------------------------------
+
 sub test_roundtrip {
     my ($file,%named_args) = @_;
 
@@ -386,8 +418,10 @@ sub test_roundtrip {
     my $resize = $named_args{'resize'};
     my $ignore_failure = $named_args{'ignore_failure'};
 
-    my $filter1 = $named_args{'filter1'} || $named_args{'filter'} || 'cat';
-    my $filter2 = $named_args{'filter2'} || $named_args{'filter'} || 'cat';
+    my $filter1 = &normalize_filter ($named_args{'filter1'} ||
+                                    $named_args{'filter'});
+    my $filter2 = &normalize_filter ($named_args{'filter2'} ||
+                                    $named_args{'filter'});
 
     my $tmp = fileparse ($file);
     $tmp =~ s/\.([a-zA-Z0-9]+)$// or die "Must have extension for roundtrip test.";
diff --git a/test/t6500-strings.pl b/test/t6500-strings.pl
index 236beb9..e82b662 100755
--- a/test/t6500-strings.pl
+++ b/test/t6500-strings.pl
@@ -16,9 +16,8 @@ my $file = "$samples/string-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
+                'filter2' => 'std:drop_generator');
 
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
 my $xls_greek_filter = "$PERL -p -C7 -e '1 while (s{\\b(ValueType=\"60\">Greek[ ?]+)[^ ?<]}{\$1?})'";
 
 &message ("Check string xls/BIFF7 roundtrip.");
@@ -27,13 +26,13 @@ my $xls_greek_filter = "$PERL -p -C7 -e '1 while (s{\\b(ValueType=\"60\">Greek[
                 'ext' => "xls",
                 'resize' => '16384x256',
                 'filter1' => $xls_greek_filter,
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check string xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check string xlsx roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6501-numbers.pl b/test/t6501-numbers.pl
index af4c38f..e5f5743 100755
--- a/test/t6501-numbers.pl
+++ b/test/t6501-numbers.pl
@@ -19,23 +19,21 @@ my $file = "$samples/number-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+                'filter2' => 'std:drop_generator');
 
 &message ("Check number xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff7',
                 'ext' => "xls",
                 'resize' => '16384x256',
-                'filter2' => $xls_filter,
+                'filter2' => 'std:drop_codepage',
                 'ignore_failure' => 1);
 
 &message ("Check number xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_filter,
+                'filter2' => 'std:drop_codepage',
                 'ignore_failure' => 1);
 
 &message ("Check number xlsx roundtrip.");
diff --git a/test/t6502-styles.pl b/test/t6502-styles.pl
index 691a954..f55ab55 100755
--- a/test/t6502-styles.pl
+++ b/test/t6502-styles.pl
@@ -16,9 +16,7 @@ my $file = "$samples/style-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+                'filter2' => 'std:drop_generator');
 
 # Biff7 only handles a few fixed rotations.
 my $xls_rotation_filter = "$PERL -p -e 's{\\b(Rotation)=\"315\"}{\$1=\"270\"}; 
s{\\b(Rotation)=\"45\"}{\$1=\"0\"};'";
@@ -38,14 +36,14 @@ my $xls_pattern_filter = "$PERL -p -e 'use English; my \%m=(19,14,20,7,21,4,22,4
                 'ext' => "xls",
                 'resize' => '16384x256',
                 'filter1' => "$xls_rotation_filter | $xls_pattern_filter | $xls_diagonal_filter | 
$xls_indent_filter",
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check style xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
                 'filter1' => $xls_pattern_filter,
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check style xlsx roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6503-page-setup.pl b/test/t6503-page-setup.pl
index a82a4ed..aa07e6e 100755
--- a/test/t6503-page-setup.pl
+++ b/test/t6503-page-setup.pl
@@ -16,22 +16,20 @@ my $file = "$samples/page-setup-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+                'filter2' => 'std:drop_generator');
 
 &message ("Check page-setup xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff7',
                 'ext' => "xls",
                 'resize' => '16384x256',
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check page-setup xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check page-setup xlsx roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6504-formula.pl b/test/t6504-formula.pl
index 2ce68c2..71eca72 100755
--- a/test/t6504-formula.pl
+++ b/test/t6504-formula.pl
@@ -16,22 +16,20 @@ my $file = "$samples/formula-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+                'filter2' => 'std:drop_generator');
 
 &message ("Check formula xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff7',
                 'ext' => "xls",
                 'resize' => '16384x256',
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check formula xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check formula xlsx roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6505-colrow.pl b/test/t6505-colrow.pl
index 6987b85..92af8e1 100755
--- a/test/t6505-colrow.pl
+++ b/test/t6505-colrow.pl
@@ -16,23 +16,21 @@ my $file = "$samples/colrow-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+                'filter2' => 'std:drop_generator');
 
 &message ("Check col/row info xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff7',
                 'ext' => "xls",
                 'resize' => '16384x256',
-                'filter2' => $xls_codepage_filter,
+                'filter2' => 'std:drop_codepage',
                 'ignore_failure' => 1);
 
 &message ("Check col/row info xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter,
+                'filter2' => 'std:drop_codepage',
                 'ignore_failure' => 1);
 
 &message ("Check col/row info xlsx roundtrip.");
diff --git a/test/t6506-cell-comments.pl b/test/t6506-cell-comments.pl
index e2ddaff..0003c92 100755
--- a/test/t6506-cell-comments.pl
+++ b/test/t6506-cell-comments.pl
@@ -16,12 +16,7 @@ my $file = "$samples/cell-comment-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
-
-# BIFF7 cannot store comment author
-my $xls_no_author_filter = "$PERL -p -e 's{ Author=\"[^\"]*\"}{};'";
+                'filter2' => 'std:drop_generator');
 
 my $xls_greek_filter = "$PERL -p -C7 -e '1 while (s{\\b(Text=\"Greek[ ?]+)[^ ?\"]}{\$1?})'";
 
@@ -30,14 +25,14 @@ my $xls_greek_filter = "$PERL -p -C7 -e '1 while (s{\\b(Text=\"Greek[ ?]+)[^ ?\"
                 'format' => 'Gnumeric_Excel:excel_biff7',
                 'ext' => "xls",
                 'resize' => '16384x256',
-                'filter1' => "$xls_greek_filter | $xls_no_author_filter",
-                'filter2' => $xls_codepage_filter);
+                'filter1' => "$xls_greek_filter | std:no_author",
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check cell-comment xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check cell-comment xlsx roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6507-split-panes.pl b/test/t6507-split-panes.pl
index 22aae5f..75f43a1 100755
--- a/test/t6507-split-panes.pl
+++ b/test/t6507-split-panes.pl
@@ -16,22 +16,20 @@ my $file = "$samples/split-panes-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+                'filter2' => 'std:drop_generator');
 
 &message ("Check split-panes xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff7',
                 'ext' => "xls",
                 'resize' => '16384x256',
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check split-panes xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check split-panes xlsx roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6508-sheet-formatting.pl b/test/t6508-sheet-formatting.pl
index 9fa6272..ca20bc0 100755
--- a/test/t6508-sheet-formatting.pl
+++ b/test/t6508-sheet-formatting.pl
@@ -16,22 +16,20 @@ my $file = "$samples/sheet-formatting-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+                'filter2' => 'std:drop_generator');
 
 &message ("Check sheet-formatting xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff7',
                 'ext' => "xls",
                 'resize' => '16384x256',
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check sheet-formatting xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check sheet-formatting xlsx roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6509-validation.pl b/test/t6509-validation.pl
index 014aee2..5b2da66 100755
--- a/test/t6509-validation.pl
+++ b/test/t6509-validation.pl
@@ -16,9 +16,7 @@ my $file = "$samples/validation-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+                'filter2' => 'std:drop_generator');
 
 my $xls_greek_filter = "$PERL -p -C7 -e '1 while (s{\\b((Title|Message)=\".*Greek[ ?]+)[^ ?\"]}{\$1?})'";
 
@@ -28,13 +26,13 @@ my $xls_greek_filter = "$PERL -p -C7 -e '1 while (s{\\b((Title|Message)=\".*Gree
                 'ext' => "xls",
                 'resize' => '16384x256',
                 'filter1' => $xls_greek_filter,
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check validation xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check validation xlsx roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6510-auto-filter.pl b/test/t6510-auto-filter.pl
index 1b4c934..df299ad 100755
--- a/test/t6510-auto-filter.pl
+++ b/test/t6510-auto-filter.pl
@@ -16,9 +16,7 @@ my $file = "$samples/auto-filter-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+                'filter2' => 'std:drop_generator');
 
 my $xls_greek_filter = "$PERL -p -C7 -e '1 while (s{\\b((Title|Message)=\".*Greek[ ?]+)[^ ?\"]}{\$1?})'";
 
@@ -28,13 +26,13 @@ my $xls_greek_filter = "$PERL -p -C7 -e '1 while (s{\\b((Title|Message)=\".*Gree
                 'ext' => "xls",
                 'resize' => '16384x256',
                 'filter1' => $xls_greek_filter,
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check auto-filter xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check auto-filter xlsx roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6511-solver.pl b/test/t6511-solver.pl
index 83c71a9..468b5e1 100755
--- a/test/t6511-solver.pl
+++ b/test/t6511-solver.pl
@@ -19,11 +19,9 @@ if (1) {
     &test_roundtrip ($file,
                     'format' => 'Gnumeric_OpenCalc:odf',
                     'ext' => "ods",
-                    'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
+                    'filter2' => 'std:drop_generator');
 }
 
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
-
 if (1) {
     &message ("Not checking solver xls/BIFF7 roundtrip -- format is deficient");
 } else {
@@ -32,7 +30,7 @@ if (1) {
                     'format' => 'Gnumeric_Excel:excel_biff7',
                     'ext' => "xls",
                     'resize' => '16384x256',
-                    'filter2' => $xls_codepage_filter);
+                    'filter2' => 'std:drop_codepage');
 }
 
 if (1) {
@@ -42,7 +40,7 @@ if (1) {
     &test_roundtrip ($file,
                     'format' => 'Gnumeric_Excel:excel_biff8',
                     'ext' => "xls",
-                    'filter2' => $xls_codepage_filter);
+                    'filter2' => 'std:drop_codepage');
 }
 
 if (1) {
diff --git a/test/t6512-format.pl b/test/t6512-format.pl
index a8d17d9..cb30a6f 100755
--- a/test/t6512-format.pl
+++ b/test/t6512-format.pl
@@ -19,22 +19,20 @@ my $file = "$samples/format-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+                'filter2' => 'std:drop_generator');
 
 &message ("Check format xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff7',
                 'ext' => "xls",
                 'resize' => '16384x256',
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check format xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check format xlsx roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6513-merges.pl b/test/t6513-merges.pl
index 5cc12c4..04fb301 100755
--- a/test/t6513-merges.pl
+++ b/test/t6513-merges.pl
@@ -19,22 +19,20 @@ my $file = "$samples/merge-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+                'filter2' => 'std:drop_generator');
 
 &message ("Check merges xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff7',
                 'ext' => "xls",
                 'resize' => '16384x256',
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check merges xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check merges xlsx roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6514-rich-text.pl b/test/t6514-rich-text.pl
index 71dd758..3265931 100755
--- a/test/t6514-rich-text.pl
+++ b/test/t6514-rich-text.pl
@@ -19,37 +19,26 @@ my $file = "$samples/rich-text-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
-
-# xls cannot have superscript and subscript at the same time
-my $xls_supersub_filter = "$PERL -p -e 
's{\\[superscript=1:3:5\\]\\[subscript=1:4:5\\]}{[superscript=1:3:4][subscript=1:4:5]};'";
-
-# BIFF7 cannot store comment author
-my $xls_no_author_filter = "$PERL -p -e 's{ Author=\"[^\"]*\"}{};'";
-
-# BIFF7 cannot store rich text comments
-my $xls_no_rich_comment = "$PERL -p -e 'if (/gnm:CellComment/) { s{ TextFormat=\"[^\"]*\"}{}; }'";
+                'filter2' => 'std:drop_generator');
 
 &message ("Check rich text xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff7',
                 'ext' => "xls",
                 'resize' => '16384x256',
-                'filter1' => "$xls_supersub_filter | $xls_no_author_filter | $xls_no_rich_comment",
-                'filter2' => $xls_codepage_filter);
+                'filter1' => "std:supersub | std:no_author | std:no_rich_comment",
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check rich text xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter1' => $xls_supersub_filter,
-                'filter2' => $xls_codepage_filter);
+                'filter1' => 'std:supersub',
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check rich text xlsx roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:xlsx',
                 'ext' => "xlsx",
                 'resize' => '1048576x16384',
-                'filter1' => $xls_supersub_filter);
+                'filter1' => 'std:supersub');
diff --git a/test/t6515-cond-format.pl b/test/t6515-cond-format.pl
index f761d3e..3782bc9 100755
--- a/test/t6515-cond-format.pl
+++ b/test/t6515-cond-format.pl
@@ -16,27 +16,20 @@ my $file = "$samples/cond-format-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
-
-# xls/biff cannot handle format in conditional formats.
-my $xls_cond_format_filter = "$PERL -p -e 'if (m{<gnm:Condition\\b} ... m{</gnm:Condition\\b}) { 
s{\\s+Format=\"[^\"\"]*\"}{}; }'";
+                'filter2' => 'std:drop_generator');
 
 &message ("Check conditional format xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff7',
                 'ext' => "xls",
                 'resize' => '16384x256',
-                # 'filter1' => $xls_cond_format_filter,
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check conditional format xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                '# filter1' => $xls_cond_format_filter,
-                'filter2' => $xls_codepage_filter);
+                'filter2' => 'std:drop_codepage');
 
 &message ("Check conditional format xlsx roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6516-graph.pl b/test/t6516-graph.pl
index e9ee677..765d61e 100755
--- a/test/t6516-graph.pl
+++ b/test/t6516-graph.pl
@@ -20,11 +20,9 @@ my $ods_outline_filter = "$PERL -p -e 'if (/\\bmarker\\b.*fill-color=\"([A-Z0-9:
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
                 'filter1' => $ods_outline_filter,
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'",
+                'filter2' => 'std:drop_generator',
                 'ignore_failure' => 1);
 
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
-
 if (0) {
     # We don't save graphs, so don't test.
     &message ("Check graph xls/BIFF7 roundtrip.");
@@ -32,14 +30,14 @@ if (0) {
                     'format' => 'Gnumeric_Excel:excel_biff7',
                     'ext' => "xls",
                     'resize' => '16384x256',
-                    'filter2' => $xls_codepage_filter);
+                    'filter2' => 'std:drop_codepage');
 }
 
 &message ("Check graph xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter,
+                'filter2' => 'std:drop_codepage',
                 'ignore_failure' => 1);
 
 &message ("Check graph xlsx roundtrip.");
diff --git a/test/t6517-names.pl b/test/t6517-names.pl
index 47a2f00..0109f41 100755
--- a/test/t6517-names.pl
+++ b/test/t6517-names.pl
@@ -16,23 +16,21 @@ my $file = "$samples/names-tests.gnumeric";
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
                 'ext' => "ods",
-                'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
-
-my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
+                'filter2' => 'std:drop_generator');
 
 &message ("Check names xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff7',
                 'ext' => "xls",
                 'resize' => '16384x256',
-                'filter2' => $xls_codepage_filter,
+                'filter2' => 'std:drop_codepage',
                 'ignore_failure' => 1);
 
 &message ("Check names xls/BIFF8 roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_Excel:excel_biff8',
                 'ext' => "xls",
-                'filter2' => $xls_codepage_filter,
+                'filter2' => 'std:drop_codepage',
                 'ignore_failure' => 1);
 
 &message ("Check names xlsx roundtrip.");


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