[gnumeric] Tests: new test for resizing sheets.



commit 4461c3d15087ddd8743198a3c0e0d599320b420b
Author: Morten Welinder <terra gnome org>
Date:   Sun Dec 21 16:57:30 2014 -0500

    Tests: new test for resizing sheets.

 test/GnumericTest.pm           |    5 +-
 test/Makefile.am               |    1 +
 test/t9001-ssconvert-resize.pl |   98 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+), 2 deletions(-)
---
diff --git a/test/GnumericTest.pm b/test/GnumericTest.pm
index 703f6c2..f71a92e 100644
--- a/test/GnumericTest.pm
+++ b/test/GnumericTest.pm
@@ -11,12 +11,12 @@ $| = 1;
 @GnumericTest::EXPORT = qw(test_sheet_calc test_valgrind
                            test_importer test_exporter test_roundtrip
                           test_ssindex sstest test_command message
-                          $ssconvert $sstest $topsrc $top_builddir
+                          $ssconvert $sstest $ssdiff $topsrc $top_builddir
                           $samples $PERL);
 @GnumericTest::EXPORT_OK = qw(junkfile);
 
 use vars qw($topsrc $top_builddir $samples $PERL $verbose);
-use vars qw($ssconvert $ssindex $sstest);
+use vars qw($ssconvert $ssindex $sstest $ssdiff);
 use vars qw($normalize_gnumeric);
 
 $PERL = $Config{'perlpath'};
@@ -31,6 +31,7 @@ $samples = "$topsrc/samples"; $samples =~ s{^\./}{};
 $ssconvert = "$top_builddir/src/ssconvert";
 $ssindex = "$top_builddir/src/ssindex";
 $sstest = "$top_builddir/src/sstest";
+$ssdiff = "$top_builddir/src/ssdiff";
 $normalize_gnumeric = "$PERL $topsrc/test/normalize-gnumeric";
 $verbose = 0;
 
diff --git a/test/Makefile.am b/test/Makefile.am
index 56af90d..5ed1d03 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -140,6 +140,7 @@ TESTS =     t1000-statfuns.pl                       \
        t8201-gslice2.pl                        \
        t8202-gslice3.pl                        \
        t9000-ssindex.pl                        \
+       t9001-ssconvert-resize.pl               \
        t9100-number-match.pl                   \
        t9999-epilogue.pl
 
diff --git a/test/t9001-ssconvert-resize.pl b/test/t9001-ssconvert-resize.pl
new file mode 100755
index 0000000..044d224
--- /dev/null
+++ b/test/t9001-ssconvert-resize.pl
@@ -0,0 +1,98 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use GnumericTest;
+
+&message ("Check ssconvert resize");
+
+my $src = "$samples/regress.gnumeric";
+my $tmp = "regress-resize.gnumeric";
+&GnumericTest::junkfile ($tmp);
+
+# Shrink rows
+&test_command ("$ssconvert --resize=8192x256 $src $tmp", sub { 1 } );
+&test_command ("$ssdiff --xml $src $tmp",
+              sub {
+                  $_ eq <<DIFF
+<?xml version="1.0" encoding="UTF-8"?>
+<ssdiff:Diff>
+  <ssdiff:Sheet Name="Sheet1" Old="0" New="0">
+    <ssdiff:Rows Old="65536" New="8192"/>
+  </ssdiff:Sheet>
+</ssdiff:Diff>
+DIFF
+              });
+
+# Shrink cols
+&test_command ("$ssconvert --resize=65536x128 $src $tmp", sub { 1 } );
+&test_command ("$ssdiff --xml $src $tmp",
+              sub {
+                  $_ eq <<DIFF
+<?xml version="1.0" encoding="UTF-8"?>
+<ssdiff:Diff>
+  <ssdiff:Sheet Name="Sheet1" Old="0" New="0">
+    <ssdiff:Cols Old="256" New="128"/>
+  </ssdiff:Sheet>
+</ssdiff:Diff>
+DIFF
+              });
+
+# Shrink both
+&test_command ("$ssconvert --resize=8192x128 $src $tmp", sub { 1 } );
+&test_command ("$ssdiff --xml $src $tmp",
+              sub {
+                  $_ eq <<DIFF
+<?xml version="1.0" encoding="UTF-8"?>
+<ssdiff:Diff>
+  <ssdiff:Sheet Name="Sheet1" Old="0" New="0">
+    <ssdiff:Cols Old="256" New="128"/>
+    <ssdiff:Rows Old="65536" New="8192"/>
+  </ssdiff:Sheet>
+</ssdiff:Diff>
+DIFF
+              });
+
+# Expand rows
+&test_command ("$ssconvert --resize=1048576x256 $src $tmp", sub { 1 } );
+&test_command ("$ssdiff --xml $src $tmp",
+              sub {
+                  $_ eq <<DIFF
+<?xml version="1.0" encoding="UTF-8"?>
+<ssdiff:Diff>
+  <ssdiff:Sheet Name="Sheet1" Old="0" New="0">
+    <ssdiff:Rows Old="65536" New="1048576"/>
+  </ssdiff:Sheet>
+</ssdiff:Diff>
+DIFF
+              });
+
+# Expand cols
+&test_command ("$ssconvert --resize=65536x512 $src $tmp", sub { 1 } );
+&test_command ("$ssdiff --xml $src $tmp",
+              sub {
+                  $_ eq <<DIFF
+<?xml version="1.0" encoding="UTF-8"?>
+<ssdiff:Diff>
+  <ssdiff:Sheet Name="Sheet1" Old="0" New="0">
+    <ssdiff:Cols Old="256" New="512"/>
+  </ssdiff:Sheet>
+</ssdiff:Diff>
+DIFF
+              });
+
+# Expand both
+&test_command ("$ssconvert --resize=1048576x16384 $src $tmp", sub { 1 } );
+&test_command ("$ssdiff --xml $src $tmp",
+              sub {
+                  $_ eq <<DIFF
+<?xml version="1.0" encoding="UTF-8"?>
+<ssdiff:Diff>
+  <ssdiff:Sheet Name="Sheet1" Old="0" New="0">
+    <ssdiff:Cols Old="256" New="16384"/>
+    <ssdiff:Rows Old="65536" New="1048576"/>
+  </ssdiff:Sheet>
+</ssdiff:Diff>
+DIFF
+              });


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