2 # -----------------------------------------------------------------------------
5 use lib
($0 =~ m
|^(.*/)| ?
$1 : ".");
8 my $file = "$samples/style-tests.gnumeric";
10 if (&subtest
("gnumeric")) {
11 &message
("Check style gnumeric roundtrip.");
12 &test_roundtrip
($file,
13 'format' => 'Gnumeric_XmlIO:sax',
17 if (&subtest
("ods")) {
18 &message
("Check style ods roundtrip.");
19 &test_roundtrip
($file,
20 'format' => 'Gnumeric_OpenCalc:odf',
22 'filter2' => 'std:drop_generator');
25 # Biff7 only handles a few fixed rotations.
26 my $xls_rotation_filter = "$PERL -p -e 's{\\b(Rotation)=\"315\"}{\$1=\"270\"}; s{\\b(Rotation)=\"45\"}{\$1=\"0\"};'";
28 # Biff7 has no diagonals patterns.
29 my $xls_diagonal_filter = "$PERL -p -e 'if (m{<gnm:StyleBorder>} .. m{</gnm:StyleBorder>}) { if (m{gnm:(Rev-)?Diagonal}) { \$_=\"\"; } else { \$any++; } \$save .= \$_; if (m{</gnm:StyleBorder>}) { print \$save if \$any>2; \$any = 0; \$save = \"\"; } \$_=\"\"; }'";
31 # Biff7 doesn't store indentation
32 my $xls_indent_filter = "$PERL -p -e 's{\\bIndent=\"[1-9]\\d*\"}{Indent=\"0\"};'";
34 # Our patterns 19-24 do not exist in xls
35 my $xls_pattern_filter = "$PERL -p -e 'use English; my \%m=(19,14,20,7,21,4,22,4,23,2,24,1); if (m{\\bShade=\"(\\d+)\"} && (\$n = \$m{\$1})) { \$_ = \"\${PREMATCH}Shade=\\\"\$n\\\"\${POSTMATCH}\"; }'";
37 if (&subtest
("biff7")) {
38 &message
("Check style xls/BIFF7 roundtrip.");
39 &test_roundtrip
($file,
40 'format' => 'Gnumeric_Excel:excel_biff7',
42 'resize' => '16384x256',
43 'filter1' => "$xls_rotation_filter | $xls_pattern_filter | $xls_diagonal_filter | $xls_indent_filter",
44 'filter2' => 'std:drop_codepage');
47 if (&subtest
("biff8")) {
48 &message
("Check style xls/BIFF8 roundtrip.");
49 &test_roundtrip
($file,
50 'format' => 'Gnumeric_Excel:excel_biff8',
52 'filter1' => $xls_pattern_filter,
53 'filter2' => 'std:drop_codepage');
56 if (&subtest
("xlsx")) {
57 &message
("Check style xlsx roundtrip.");
58 &test_roundtrip
($file,
59 'format' => 'Gnumeric_Excel:xlsx',
61 'resize' => '1048576x16384',
62 'filter1' => $xls_pattern_filter);