This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch AOO50X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit d13fd8d7ccf163272b4325c4608fe85949f62f85
Author: Jim Jagielski <[email protected]>
AuthorDate: Tue Nov 3 11:38:43 2026 -0500

    test/aoo-test: add the ODF 1.4 extended variant to the validator and to its 
controls
---
 test/aoo-test/src/aootest/checkers/validate.py | 19 ++++++++++---------
 test/aoo-test/src/aootest/controls.py          | 11 ++++++++++-
 test/aoo-test/tests/selftest/test_validate.py  | 13 +++++++++++++
 3 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/test/aoo-test/src/aootest/checkers/validate.py 
b/test/aoo-test/src/aootest/checkers/validate.py
index 0c09ca11b8..feb4d861ac 100644
--- a/test/aoo-test/src/aootest/checkers/validate.py
+++ b/test/aoo-test/src/aootest/checkers/validate.py
@@ -20,9 +20,10 @@
 #**************************************************************
 
 # usage: python -m aootest.checkers.validate <outdir> <val.json>   (needs 
AOO_JING and AOO_SCHEMA_DIR; tests call check())
-# Validates every package in <outdir> against ODF 1.2 as written, against ODF 
1.3 and 1.4 with the version rewritten
-# ("13", "14"), and against ODF 1.2 and 1.3 after removing foreign elements 
and attributes ("12x", "13x"; Part 1 2.2.2 B.1;
-# manifest left as written apart from the version).
+# Validates every package in <outdir> against ODF 1.2 as written, against ODF 
1.3 and 1.4 with an office:version or
+# manifest:version of 1.2 or 1.3 rewritten to the target ("13", "14"; any 
other version stays and is reported), and against
+# ODF 1.2, 1.3 and 1.4 after removing foreign elements and attributes ("12x", 
"13x", "14x"; Part 1 2.2.2 B.1; manifest left
+# as written apart from the version).
 import sys, os, re, zipfile, subprocess, json
 
 from aootest.checkers import foreign
@@ -30,7 +31,7 @@ from aootest.checkers import foreign
 SCHEMA_FILES = {"12": ("OpenDocument-v1.2-os-schema.rng", 
"OpenDocument-v1.2-os-manifest-schema.rng"),
                 "13": ("OpenDocument-v1.3-schema.rng", 
"OpenDocument-v1.3-manifest-schema.rng"),
                 "14": ("OpenDocument-v1.4-schema.rng", 
"OpenDocument-v1.4-manifest-schema.rng")}
-VERSIONS = ("12", "14", "12x", "13", "13x")
+VERSIONS = ("12", "14", "12x", "13", "13x", "14x")
 STREAMS = {"content.xml", "styles.xml", "meta.xml", "settings.xml"}
 # ODF 1.2 Part 1 2.2.1 B.4: a content.xml rooted at MathML is validated 
against MathML, not ODF
 ERR = re.compile(r"^(.*?):(\d+):(\d+): (error|fatal|warning): (.*)$")
@@ -43,7 +44,7 @@ def root_is_mathml(text):
 
 def schemas(schema_dir):
     sch = {v: tuple(os.path.join(schema_dir, f) for f in fs) for v, fs in 
SCHEMA_FILES.items()}
-    sch["12x"], sch["13x"] = sch["12"], sch["13"]
+    sch["12x"], sch["13x"], sch["14x"] = sch["12"], sch["13"], sch["14"]
     return sch
 
 
@@ -55,7 +56,7 @@ def check(outdir, workdir, jing, schema_dir):
         raise ValueError("validate: workdir is not empty: " + work)
     SCH = schemas(schema_dir)
     files = {v: ([], []) for v in VERSIONS}
-    mixed = {"12x": foreign.mixed_elements(SCH["12"][0]), "13x": 
foreign.mixed_elements(SCH["13"][0])}
+    mixed = {v: foreign.mixed_elements(SCH[v][0]) for v in ("12x", "13x", 
"14x")}
     skipped, bad_zip = [], []
     pkgs = sorted(p for p in os.listdir(outdir) if not p.startswith("."))
     for pkg in pkgs:
@@ -72,11 +73,11 @@ def check(outdir, workdir, jing, schema_dir):
                 skipped.append(pkg + "/" + name); continue
             for v in VERSIONS:
                 t = text
-                if v in ("12x", "13x") and not is_mani:
+                if v in mixed and not is_mani:
                     t = foreign.strip_foreign(t, mixed[v])
-                if v in ("13", "13x", "14"):
+                if v in ("13", "13x", "14", "14x"):
                     attr = "manifest:version" if is_mani else "office:version"
-                    t = re.sub(attr + '="1.2"', attr + '="1.%s"' % v[1], t, 
count=1)
+                    t = re.sub(attr + '="1\\.[23]"', attr + '="1.%s"' % v[1], 
t, count=1)
                 p = os.path.join(work, v, pkg, name)
                 os.makedirs(os.path.dirname(p), exist_ok=True)
                 open(p, "w", encoding="utf-8").write(t)
diff --git a/test/aoo-test/src/aootest/controls.py 
b/test/aoo-test/src/aootest/controls.py
index 7fe2bef256..a46e9783ea 100644
--- a/test/aoo-test/src/aootest/controls.py
+++ b/test/aoo-test/src/aootest/controls.py
@@ -66,7 +66,7 @@ def make_odf_controls(outdir):
     OFFNS = ('xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" '
              'xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" '
              
'xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; '
-             'xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"')
+             'xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"')
 
 
     def mkdoc(name, ext, mime, streams):
@@ -110,6 +110,15 @@ def make_odf_controls(outdir):
     for n, attrs in (("scaleone", 'style:scale-to="80%"'), ("scalexy", 
'style:scale-to-X="2" style:scale-to-Y="3"'), ("scaleboth", 
'style:scale-to-X="2" style:scale-to-Y="3" style:scale-to="80%"')):
         mkdoc(n, "odt", TEXT, {"content.xml": ("office:document-content", 
"<office:body><office:text><text:p>hi</text:p></office:text></office:body>"),
                               "styles.xml": ("office:document-styles", 
'<office:automatic-styles><style:page-layout 
style:name="pm1"><style:page-layout-properties 
%s/></style:page-layout></office:automatic-styles>' % attrs)})
+    # 1.4 (OFFICE-4142): draw:decorative on style:graphic-properties is new, 
invalid in 1.2 and 1.3; basedeco is the same style without it
+    for n, attrs in (("basedeco", ""), ("newdeco", ' draw:decorative="true"')):
+        mkdoc(n, "odt", TEXT, {"content.xml": ("office:document-content", 
"<office:body><office:text><text:p>hi</text:p></office:text></office:body>"),
+                              "styles.xml": ("office:document-styles", 
'<office:automatic-styles><style:style style:name="gr1" 
style:family="graphic"><style:graphic-properties%s/></style:style></office:automatic-styles>'
 % attrs)})
+    # 1.4 (OFFICE-4110): draw:handle needs the new position-x/-y or polar-pole 
pair; the old combined attribute alone is valid in 1.2 and 1.3 only.
+    # The pair itself is invalid in 1.2 and 1.3.
+    for n, attrs in (("handleold", 'draw:handle-position="0 0"'), 
("handlenew", 'draw:handle-position-x="0" draw:handle-position-y="0"'),
+                     ("handlepolar", 'draw:handle-polar-pole-x="0" 
draw:handle-polar-pole-y="0"')):
+        mkdoc(n, "odt", TEXT, {"content.xml": ("office:document-content", 
'<office:body><office:text><text:p><draw:custom-shape><draw:enhanced-geometry><draw:handle
 
%s/></draw:enhanced-geometry></draw:custom-shape></text:p></office:text></office:body>'
 % attrs)})
 
 
 def make_pkg_controls(outdir):
diff --git a/test/aoo-test/tests/selftest/test_validate.py 
b/test/aoo-test/tests/selftest/test_validate.py
index 8dd5208f8a..dc9f1e0665 100644
--- a/test/aoo-test/tests/selftest/test_validate.py
+++ b/test/aoo-test/tests/selftest/test_validate.py
@@ -53,6 +53,19 @@ ROWS = [
     ("13: style:scale-to-X/Y alone and style:scale-to alone valid in 1.3 and 
1.3 extended; X/Y invalid in 1.2",
      lambda E, d: not any(E(v, p) for v in ("13", "13x") for p in 
("scalexy.odt", "scaleone.odt"))
      and any('"style:scale-to-X"' in m for m in E("12", "scalexy.odt")) and 
not E("12", "scaleone.odt")),
+    ("14: good.odt clean in 1.4 and 1.4 extended; a 1.3 version is rewritten 
like a 1.2 one", lambda E, d: not E("14", "good.odt") and not E("14x", 
"good.odt")),
+    ("14: bad.odt flags text:bogus in 1.4 and 1.4 extended", lambda E, d: 
flags(E, ("14", "14x"), "bad.odt", BOGUS)),
+    ("14: wrongver.odt (1.1) flags office:version in 1.4 and 1.4 extended", 
lambda E, d: flags(E, ("14", "14x"), "wrongver.odt", "office:version")),
+    ("14: extforeign.odt invalid as written, valid in 1.4 extended once 
foreign content is removed",
+     lambda E, d: bool(E("14", "extforeign.odt")) and not E("14x", 
"extforeign.odt")),
+    ("14: draw:decorative invalid in 1.2 and 1.3, valid in 1.4 and 1.4 
extended; the same style without it is clean in all",
+     lambda E, d: all(any('"draw:decorative"' in m for m in E(v, 
"newdeco.odt")) for v in ("12", "13"))
+     and not E("14", "newdeco.odt") and not E("14x", "newdeco.odt") and not 
any(E(v, "basedeco.odt") for v in ("12", "13", "14", "14x"))),
+    ("14: draw:handle with only the old combined attribute valid in 1.2 and 
1.3, invalid in 1.4 and 1.4 extended",
+     lambda E, d: not any(E(v, "handleold.odt") for v in ("12", "13")) and 
all(E(v, "handleold.odt") for v in ("14", "14x"))),
+    ("14: draw:handle with the new position or polar pair valid in 1.4 and 1.4 
extended, invalid in 1.2 and 1.3",
+     lambda E, d: not any(E(v, p) for v in ("14", "14x") for p in 
("handlenew.odt", "handlepolar.odt"))
+     and all(E(v, p) for v in ("12", "13") for p in ("handlenew.odt", 
"handlepolar.odt"))),
     ("mathobj.odt MathML object skipped", lambda E, d: d["mathml_skipped"] == 
["mathobj.odt/Object 1/content.xml"] and not E("12", "mathobj.odt")),
     ("no unparsed jing output", lambda E, d: not any(e[0] == "?" for v in 
d["errors"] for e in d["errors"][v])),
     ("extended: extforeign.odt invalid as written, valid once foreign content 
is removed",

Reply via email to