[gnumeric] t6150: add extended schema.



commit 5254bf9f1f1babbc7d8e2478e7dc686e7d6f197e
Author: Morten Welinder <terra gnome org>
Date:   Wed Apr 8 21:02:23 2015 -0400

    t6150: add extended schema.
    
    This comes in the form of a patch from the regular schema.  The patch
    contains only our stuff so we can freely distribute it.
    
    "t6150-ods-syntax.pl download" will create the extended schema from
    the patch.

 test/Makefile.am          |    2 +-
 test/ods-ext-schema.patch |  481 +++++++++++++++++++++++++++++++++++++++++++++
 test/t6150-ods-syntax.pl  |   69 +++++++-
 3 files changed, 549 insertions(+), 3 deletions(-)
---
diff --git a/test/Makefile.am b/test/Makefile.am
index 2278dfb..d1c0a94 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -152,6 +152,6 @@ import-db:
        for t in $(srcdir)/t5[0-9][0-9][0-9]-*.pl; do echo "*** $$t ***"; $(PERL) $$t create-db; done
 
 
-EXTRA_DIST = GnumericTest.pm $(SUPPS) normalize-gnumeric $(TESTS)
+EXTRA_DIST = GnumericTest.pm $(SUPPS) normalize-gnumeric ods-ext-schema.patch $(TESTS)
 .PHONY: import-db $(TESTS)
 .NOTPARALLEL:
diff --git a/test/ods-ext-schema.patch b/test/ods-ext-schema.patch
new file mode 100644
index 0000000..ddbf9ea
--- /dev/null
+++ b/test/ods-ext-schema.patch
@@ -0,0 +1,481 @@
+--- ods-schema/OpenDocument-v1.2-os-schema.rng 2015-01-28 18:46:19.155715877 -0500
++++ ods-schema/OpenDocument-v1.2-os-ext-schema.rng     2015-04-08 20:41:49.504569470 -0400
+@@ -62,6 +62,9 @@
+       xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+       xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+       xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"
++
++      xmlns:gnm="http://www.gnumeric.org/odf-extension/1.0";
++      xmlns:css3t="http://www.w3.org/TR/css3-text/";
+ >
+       <define name="office-process-content">
+               <optional>
+@@ -2484,6 +2487,11 @@
+                                               <ref name="string"/>
+                                       </attribute>
+                               </optional>
++                              <optional>
++                                      <attribute name="gnm:error-value">
++                                              <ref name="string"/>
++                                      </attribute>
++                              </optional>
+                       </group>
+               </choice>
+       </define>
+@@ -3380,6 +3388,9 @@
+                       <optional>
+                               <ref name="table-named-expressions"/>
+                       </optional>
++                      <optional>
++                              <ref name="gnm-selections"/>
++                      </optional>
+               </element>
+       </define>
+       <define name="table-columns-and-groups">
+@@ -3670,6 +3681,11 @@
+                               </attribute>
+                       </optional>
+                       <optional>
++                              <attribute name="gnm:columns-spanned-fake">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
++                      <optional>
+                               <attribute name="table:number-rows-spanned">
+                                       <ref name="positiveInteger"/>
+                               </attribute>
+@@ -10473,6 +10489,7 @@
+                       <ref name="common-data-field-attlist"/>
+                       <ref name="list-source"/>
+                       <ref name="list-source-type"/>
++                      <ref name="gnm-list-linkage-type"/>
+                       <ref name="common-linked-cell"/>
+                       <ref name="common-source-cell-range"/>
+                       <optional>
+@@ -10637,6 +10654,7 @@
+               <ref name="selected"/>
+               <ref name="common-tab-attlist"/>
+               <ref name="common-title-attlist"/>
++              <ref name="gnm-value-type-attlist"/>
+               <ref name="common-value-attlist"/>
+               <ref name="common-data-field-attlist"/>
+               <ref name="common-form-visual-effect-attlist"/>
+@@ -12676,11 +12694,28 @@
+               </element>
+       </define>
+       <define name="number-scientific-number-attlist">
+-              <optional>
+-                      <attribute name="number:min-exponent-digits">
+-                              <ref name="integer"/>
+-                      </attribute>
+-              </optional>
++              <interleave>
++                      <optional>
++                              <attribute name="number:min-exponent-digits">
++                                      <ref name="integer"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:forced-exponent-sign">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:engineering">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:literal-E">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
++              </interleave>
+       </define>
+       <define name="number-fraction">
+               <element name="number:fraction">
+@@ -12997,14 +13032,17 @@
+               </element>
+       </define>
+       <define name="number-hours-attlist">
+-              <optional>
+-                      <attribute name="number:style">
+-                              <choice>
+-                                      <value>short</value>
+-                                      <value>long</value>
+-                              </choice>
+-                      </attribute>
+-              </optional>
++              <interleave>
++                      <ref name="gnm-truncate-on-overflow"/>
++                      <optional>
++                              <attribute name="number:style">
++                                      <choice>
++                                              <value>short</value>
++                                              <value>long</value>
++                                      </choice>
++                              </attribute>
++                      </optional>
++              </interleave>
+       </define>
+       <define name="number-minutes">
+               <element name="number:minutes">
+@@ -13013,14 +13051,17 @@
+               </element>
+       </define>
+       <define name="number-minutes-attlist">
+-              <optional>
+-                      <attribute name="number:style">
+-                              <choice>
+-                                      <value>short</value>
+-                                      <value>long</value>
+-                              </choice>
+-                      </attribute>
+-              </optional>
++              <interleave>
++                      <ref name="gnm-truncate-on-overflow"/>
++                      <optional>
++                              <attribute name="number:style">
++                                      <choice>
++                                              <value>short</value>
++                                              <value>long</value>
++                                      </choice>
++                              </attribute>
++                      </optional>
++              </interleave>
+       </define>
+       <define name="number-seconds">
+               <element name="number:seconds">
+@@ -13030,6 +13071,7 @@
+       </define>
+       <define name="number-seconds-attlist">
+               <interleave>
++                      <ref name="gnm-truncate-on-overflow"/>
+                       <optional>
+                               <attribute name="number:style">
+                                       <choice>
+@@ -13097,7 +13139,15 @@
+       </define>
+       <define name="number-text">
+               <element name="number:text">
+-                      <text/>
++                      <zeroOrMore>
++                              <optional>
++                                      <ref name="gnm-invisible"/>
++                              </optional>
++                              <optional>
++                                      <ref name="gnm-repeated"/>
++                              </optional>
++                              <text/>
++                      </zeroOrMore>
+               </element>
+       </define>
+       <define name="number-text-content">
+@@ -13169,6 +13219,11 @@
+                                       </choice>
+                               </attribute>
+                       </optional>
++                      <optional>
++                              <attribute name="gnm:format-magic">
++                                      <ref name="integer"/>
++                              </attribute>
++                      </optional>
+               </interleave>
+       </define>
+       <define name="common-auto-reorder-attlist">
+@@ -13203,6 +13258,11 @@
+                               </attribute>
+                       </optional>
+                       <optional>
++                              <attribute name="gnm:min-integer-chars">
++                                      <ref name="integer"/>
++                              </attribute>
++                      </optional>
++                      <optional>
+                               <attribute name="number:grouping">
+                                       <ref name="boolean"/>
+                               </attribute>
+@@ -14101,6 +14161,22 @@
+                                       <ref name="string"/>
+                               </attribute>
+                       </optional>
++                      <optional>
++                              <group>
++                                      <attribute name="gnm:arrow-type">
++                                              <ref name="integer"/>
++                                      </attribute>
++                                      <attribute name="gnm:arrow-a">
++                                              <ref name="double"/>
++                                      </attribute>
++                                      <attribute name="gnm:arrow-b">
++                                              <ref name="double"/>
++                                      </attribute>
++                                      <attribute name="gnm:arrow-c">
++                                              <ref name="double"/>
++                                      </attribute>
++                              </group>
++                      </optional>
+               </interleave>
+       </define>
+       <define name="draw-stroke-dash">
+@@ -14383,6 +14459,11 @@
+                                       <ref name="boolean"/>
+                               </attribute>
+                       </optional>
++                      <optional>
++                              <attribute name="gnm:style-print">
++                                      <ref name="string"/>
++                              </attribute>
++                      </optional>
+               </interleave>
+       </define>
+       <define name="style-page-layout-properties-elements">
+@@ -14874,11 +14955,28 @@
+                               </attribute>
+                       </optional>
+                       <optional>
++                              <attribute name="gnm:font-stretch-pango">
++                                      <ref name="integer"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:auto-font">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
++                      <optional>
+                               <attribute name="style:text-underline-mode">
+                                       <ref name="lineMode"/>
+                               </attribute>
+                       </optional>
+                       <optional>
++                              <attribute name="gnm:text-underline-placement">
++                                      <choice>
++                                              <value>low</value>
++                                      </choice>
++                              </attribute>
++                      </optional>
++                      <optional>
+                               <attribute name="style:text-line-through-mode">
+                                       <ref name="lineMode"/>
+                               </attribute>
+@@ -15090,6 +15188,18 @@
+       <define name="style-paragraph-properties-attlist">
+               <interleave>
+                       <optional>
++                              <attribute name="gnm:GnmHAlign">
++                                      <ref name="integer"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="css3t:text-justify">
++                                      <choice>
++                                              <value>distribute</value>
++                                      </choice>
++                              </attribute>
++                      </optional>
++                      <optional>
+                               <attribute name="fo:line-height">
+                                       <choice>
+                                               <value>normal</value>
+@@ -15461,14 +15571,21 @@
+               </optional>
+       </define>
+       <define name="common-background-color-attlist">
+-              <optional>
+-                      <attribute name="fo:background-color">
+-                              <choice>
+-                                      <value>transparent</value>
++              <interleave>
++                      <optional>
++                              <attribute name="fo:background-color">
++                                      <choice>
++                                              <value>transparent</value>
++                                              <ref name="color"/>
++                                      </choice>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:background-colour">
+                                       <ref name="color"/>
+-                              </choice>
+-                      </attribute>
+-              </optional>
++                              </attribute>
++                      </optional>
++              </interleave>
+       </define>
+       <define name="style-background-image">
+               <optional>
+@@ -15904,6 +16021,21 @@
+                                       <ref name="boolean"/>
+                               </attribute>
+                       </optional>
++                      <optional>
++                              <attribute name="gnm:display-formulas">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:display-col-header">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:display-row-header">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
+               </interleave>
+       </define>
+       <define name="style-table-properties-elements">
+@@ -16004,6 +16136,11 @@
+                               </attribute>
+                       </optional>
+                       <optional>
++                              <attribute name="gnm:GnmVAlign">
++                                      <ref name="integer"/>
++                              </attribute>
++                      </optional>
++                      <optional>
+                               <attribute name="style:text-align-source">
+                                       <choice>
+                                               <value>fix</value>
+@@ -16028,6 +16165,16 @@
+                       <ref name="common-background-color-attlist"/>
+                       <ref name="common-border-attlist"/>
+                       <optional>
++                              <attribute name="gnm:pattern-colour">
++                                      <ref name="color"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:pattern">
++                                      <ref name="integer"/>
++                              </attribute>
++                      </optional>
++                      <optional>
+                               <attribute name="style:diagonal-tl-br">
+                                       <ref name="string"/>
+                               </attribute>
+@@ -17060,6 +17207,41 @@
+                                       <ref name="nonNegativeInteger"/>
+                               </attribute>
+                       </optional>
++                      <optional>
++                              <attribute name="gnm:auto-dash">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:auto-width">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:auto-color">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:auto-type">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:pattern">
++                                      <ref name="integer"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:marker-outline-colour">
++                                      <ref name="color"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:marker-fill-colour">
++                                      <ref name="color"/>
++                              </attribute>
++                      </optional>
+               </interleave>
+       </define>
+       <define name="style-graphic-fill-properties-attlist">
+@@ -18124,4 +18306,78 @@
+                       </element>
+               </zeroOrMore>
+       </define>
++
++      <define name="gnm-selections">
++              <element name="gnm:selections">
++                      <attribute name="gnm:cursor-col">
++                              <ref name="integer"/>
++                      </attribute>
++                      <attribute name="gnm:cursor-row">
++                              <ref name="integer"/>
++                      </attribute>
++                      <optional>
++                              <ref name="gnm-selection"/>
++                      </optional>
++              </element>
++      </define>
++      <define name="gnm-selection">
++              <element name="gnm:selection">
++                      <attribute name="gnm:start-col">
++                              <ref name="integer"/>
++                      </attribute>
++                      <attribute name="gnm:start-row">
++                              <ref name="integer"/>
++                      </attribute>
++                      <attribute name="gnm:end-col">
++                              <ref name="integer"/>
++                      </attribute>
++                      <attribute name="gnm:end-row">
++                              <ref name="integer"/>
++                      </attribute>
++              </element>
++      </define>
++      <define name="gnm-list-linkage-type">
++              <optional>
++                      <attribute name="gnm:list-linkage-type">
++                              <choice>
++                                      <value>selection</value>
++                                      <value>selection-indices</value>
++                              </choice>
++                      </attribute>
++              </optional>
++      </define>
++      <define name="gnm-value-type-attlist">
++              <optional>
++                      <attribute name="gnm:value-type">
++                              <ref name="valueType"/>
++                      </attribute>
++              </optional>
++      </define>
++      <define name="gnm-truncate-on-overflow">
++              <optional>
++                      <attribute name="gnm:truncate-on-overflow">
++                              <ref name="boolean"/>
++                      </attribute>
++              </optional>
++      </define>
++      <define name="gnm-invisible">
++              <element name="gnm:invisible">
++                      <optional>
++                              <attribute name="gnm:char">
++                                      <ref name="string"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="office:process-content">
++                                      <ref name="boolean"/>
++                              </attribute>
++                      </optional>
++                      <empty/>
++              </element>
++      </define>
++      <define name="gnm-repeated">
++              <element name="gnm:repeated">
++                      <text/>
++              </element>
++      </define>
+ </grammar>
diff --git a/test/t6150-ods-syntax.pl b/test/t6150-ods-syntax.pl
index 3df21a4..9a94eee 100755
--- a/test/t6150-ods-syntax.pl
+++ b/test/t6150-ods-syntax.pl
@@ -17,11 +17,19 @@ my $schemadir = "$topsrc/test/ods-schema";
 my $schema = "$schemadir/OpenDocument-v1.2-os-schema.rng";
 my $schema_ext = "$schemadir/OpenDocument-v1.2-os-ext-schema.rng";
 my $schema_manifest = "$schemadir/OpenDocument-v1.2-os-manifest-schema.rng";
+my $schema_ext_patch = "$topsrc/test/ods-ext-schema.patch";
 
-if (($ARGV[0] || '-') eq 'download') {
+my $cmd = ($ARGV[0] || '-');
+if ($cmd eq 'download') {
     &download ();
     exit 0;
-}
+} elsif ($cmd eq 'make-schema-patch') {
+    &make_schema_patch ();
+    exit 0;
+} elsif ($cmd eq 'make-schema-ext') {
+    &make_schema_ext ();
+    exit 0;
+} 
 
 my $suggest_download = 0;
 if (!-r $schema) {
@@ -185,6 +193,8 @@ if ($nbad > 0) {
     print STDERR "Pass\n";
 }
 
+# -----------------------------------------------------------------------------
+
 sub download {
     my $src = "http://docs.oasis-open.org/office/v1.2/os";;
 
@@ -238,4 +248,59 @@ sub download {
            }
        }
     }
+
+    &make_schema_ext () unless -e $schema_ext;
 }
+
+# -----------------------------------------------------------------------------
+
+sub make_schema_ext {
+    my $dir = "$topsrc/test";
+    my $o = length ($dir) + 1;
+
+    if (-e $schema_ext) {
+       print STDERR "ERROR: Extended schema already exists.\n";
+       print STDERR "If you really want to update it, remove it first.\n";
+       exit 1;
+    }
+
+    if (!-r $schema || !-r $schema_ext_patch) {
+       print STDERR "ERROR: Making extended schema requires both $schema and $schema_ext_patch\n";
+       exit 1;
+    }
+
+    my $cmd = &GnumericTest::quotearg ("cp", $schema, $schema_ext);
+    print STDERR "# $cmd\n";
+    system ($cmd);
+
+    $cmd =
+       "(cd " . &GnumericTest::quotearg ($dir) .
+       " && " .
+       &GnumericTest::quotearg ("patch", "-i", substr($schema_ext_patch,$o), substr($schema_ext,$o)) .
+       ")";
+    print STDERR "# $cmd\n";
+    system ($cmd);
+}
+
+# -----------------------------------------------------------------------------
+
+sub make_schema_patch {
+    my $dir = "$topsrc/test";
+    my $o = length ($dir) + 1;
+
+    if (!-r $schema || !-r $schema_ext) {
+       print STDERR "ERROR: Making patch requires both $schema and $schema_ext\n";
+       exit 1;
+    }
+
+    my $cmd =
+       "(cd " . &GnumericTest::quotearg ($dir) .
+       " && " .
+       &GnumericTest::quotearg ("diff", "-u", substr($schema,$o), substr($schema_ext,$o)) .
+       " >" . &GnumericTest::quotearg (substr($schema_ext_patch,$o)) .
+       ")";
+    print STDERR "# $cmd\n";
+    system ($cmd);
+}
+
+# -----------------------------------------------------------------------------


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