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

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

commit 7071125f70ff56c91ceea27ad0e96a7c3b28b531
Author: Jim Jagielski <[email protected]>
AuthorDate: Fri Oct 23 13:40:04 2026 -0400

    test/odf-validate: add fixtures for the default-mode gates
---
 test/odf-validate/fixtures/alien-attrs/calc.json   |  16 ++++
 test/odf-validate/fixtures/alien-attrs/draw.json   |  16 ++++
 .../fixtures/alien-attrs/writer-cell.json          |  16 ++++
 .../fixtures/alien-attrs/writer-foreign.json       |  20 +++++
 .../fixtures/normal-values5b/checks-image.json     |  82 +++++++++++++++++++++
 .../fixtures/ole-text-edge/checks.json             |  77 +++++++++++++++++++
 test/odf-validate/fixtures/ole-text-edge/make.py   |  24 ++++++
 .../fixtures/ole-text-edge/ole-text-edge.odg       | Bin 0 -> 16068 bytes
 8 files changed, 251 insertions(+)

diff --git a/test/odf-validate/fixtures/alien-attrs/calc.json 
b/test/odf-validate/fixtures/alien-attrs/calc.json
new file mode 100644
index 0000000000..b204c9b290
--- /dev/null
+++ b/test/odf-validate/fixtures/alien-attrs/calc.json
@@ -0,0 +1,16 @@
+[
+ {
+  "name": "calc_aliens",
+  "expr": "sorted(doc.Sheets.getByIndex(0).getCellByPosition(0, 
0).UserDefinedAttributes.ElementNames)",
+  "expect": [
+   "ex:alien-foreign"
+  ]
+ },
+ {
+  "name": "calc_aliens_foreign",
+  "expr": "[n for n in sorted(doc.Sheets.getByIndex(0).getCellByPosition(0, 
0).UserDefinedAttributes.ElementNames) if n.startswith('ex:')]",
+  "expect": [
+   "ex:alien-foreign"
+  ]
+ }
+]
diff --git a/test/odf-validate/fixtures/alien-attrs/draw.json 
b/test/odf-validate/fixtures/alien-attrs/draw.json
new file mode 100644
index 0000000000..e53a8317ce
--- /dev/null
+++ b/test/odf-validate/fixtures/alien-attrs/draw.json
@@ -0,0 +1,16 @@
+[
+ {
+  "name": "draw_aliens",
+  "expr": 
"sorted(doc.DrawPages.getByIndex(0).getByIndex(0).UserDefinedAttributes.ElementNames)",
+  "expect": [
+   "ex:alien-foreign"
+  ]
+ },
+ {
+  "name": "draw_aliens_foreign",
+  "expr": "[n for n in 
sorted(doc.DrawPages.getByIndex(0).getByIndex(0).UserDefinedAttributes.ElementNames)
 if n.startswith('ex:')]",
+  "expect": [
+   "ex:alien-foreign"
+  ]
+ }
+]
diff --git a/test/odf-validate/fixtures/alien-attrs/writer-cell.json 
b/test/odf-validate/fixtures/alien-attrs/writer-cell.json
new file mode 100644
index 0000000000..4e72fded0c
--- /dev/null
+++ b/test/odf-validate/fixtures/alien-attrs/writer-cell.json
@@ -0,0 +1,16 @@
+[
+ {
+  "name": "writer_aliens_cell",
+  "expr": 
"sorted(doc.TextTables.getByIndex(0).getCellByName('A1').UserDefinedAttributes.ElementNames)",
+  "expect": [
+   "draw:alien-draw",
+   "ex:alien-foreign",
+   "fo:alien-fo",
+   "office:alien-office",
+   "style:alien-style",
+   "svg:alien-svg",
+   "table:alien-table",
+   "text:enable-numbering"
+  ]
+ }
+]
diff --git a/test/odf-validate/fixtures/alien-attrs/writer-foreign.json 
b/test/odf-validate/fixtures/alien-attrs/writer-foreign.json
new file mode 100644
index 0000000000..23d180d852
--- /dev/null
+++ b/test/odf-validate/fixtures/alien-attrs/writer-foreign.json
@@ -0,0 +1,20 @@
+[
+ {
+  "name": "writer_aliens_foreign",
+  "expr": "[[n for n in sorted(x.ElementNames) if n.startswith('ex:')] for x 
in (doc.Text.createTextCursor().ParaUserDefinedAttributes, 
doc.TextTables.getByIndex(0).UserDefinedAttributes, 
doc.TextTables.getByIndex(0).getCellByName('A1').UserDefinedAttributes, 
doc.TextSections.getByIndex(0).UserDefinedAttributes)]",
+  "expect": [
+   [
+    "ex:alien-foreign"
+   ],
+   [
+    "ex:alien-foreign"
+   ],
+   [
+    "ex:alien-foreign"
+   ],
+   [
+    "ex:alien-foreign"
+   ]
+  ]
+ }
+]
diff --git a/test/odf-validate/fixtures/normal-values5b/checks-image.json 
b/test/odf-validate/fixtures/normal-values5b/checks-image.json
new file mode 100644
index 0000000000..a3e9231e45
--- /dev/null
+++ b/test/odf-validate/fixtures/normal-values5b/checks-image.json
@@ -0,0 +1,82 @@
+[
+ {
+  "name": "symbol_image",
+  "expr": "[(n, [(str(s.Symbol.Style.value), s.Symbol.Graphic is not None, 
s.Symbol.Graphic.Type if s.Symbol.Graphic is not None else None, 
s.Symbol.Size.Width, s.Symbol.Size.Height) for s in 
sh.Charts.getByName(n).EmbeddedObject.getFirstDiagram().getCoordinateSystems()[0].getChartTypes()[0].getDataSeries()])
 for sh in [doc.Sheets.getByIndex(0)] for n in sh.Charts.ElementNames]",
+  "expect": [
+   [
+    "c1",
+    [
+     [
+      "GRAPHIC",
+      true,
+      1,
+      250,
+      250
+     ],
+     [
+      "AUTO",
+      false,
+      null,
+      175,
+      175
+     ]
+    ]
+   ],
+   [
+    "c2",
+    [
+     [
+      "NONE",
+      false,
+      null,
+      250,
+      250
+     ],
+     [
+      "NONE",
+      false,
+      null,
+      250,
+      250
+     ]
+    ]
+   ]
+  ]
+ },
+ {
+  "name": "series_data",
+  "expr": "[(n, [[list(q.Values.getData()) for q in s.getDataSequences()] for 
s in 
sh.Charts.getByName(n).EmbeddedObject.getFirstDiagram().getCoordinateSystems()[0].getChartTypes()[0].getDataSeries()])
 for sh in [doc.Sheets.getByIndex(0)] for n in sh.Charts.ElementNames]",
+  "expect": [
+   [
+    "c1",
+    [
+     [
+      [
+       1.0,
+       3.0,
+       4.0
+      ]
+     ],
+     [
+      []
+     ]
+    ]
+   ],
+   [
+    "c2",
+    [
+     [
+      [
+       1.0,
+       3.0,
+       4.0
+      ]
+     ],
+     [
+      []
+     ]
+    ]
+   ]
+  ]
+ }
+]
diff --git a/test/odf-validate/fixtures/ole-text-edge/checks.json 
b/test/odf-validate/fixtures/ole-text-edge/checks.json
new file mode 100644
index 0000000000..394072d06c
--- /dev/null
+++ b/test/odf-validate/fixtures/ole-text-edge/checks.json
@@ -0,0 +1,77 @@
+[
+ {
+  "name": "ole_text",
+  "expr": "[[s.ShapeType.split('.')[-1], s.String, s.CLSID] for s in 
[doc.DrawPages.getByIndex(0).getByIndex(i) for i in 
range(doc.DrawPages.getByIndex(0).Count)]]",
+  "expect": [
+   [
+    "OLE2Shape",
+    "",
+    "078B7ABA-54FC-457F-8551-6147e776a997"
+   ],
+   [
+    "OLE2Shape",
+    "OLE label",
+    "078B7ABA-54FC-457F-8551-6147e776a997"
+   ],
+   [
+    "OLE2Shape",
+    " ",
+    "078B7ABA-54FC-457F-8551-6147e776a997"
+   ],
+   [
+    "OLE2Shape",
+    "\n",
+    "078B7ABA-54FC-457F-8551-6147e776a997"
+   ],
+   [
+    "OLE2Shape",
+    "1/3/1",
+    "078B7ABA-54FC-457F-8551-6147e776a997"
+   ]
+  ]
+ },
+ {
+  "name": "ole_paragraphs",
+  "expr": "[[(lambda en: [p.String for p in [en.nextElement() for _ in 
iter(en.hasMoreElements, False)]])(s.createEnumeration())] for s in 
[doc.DrawPages.getByIndex(0).getByIndex(i) for i in 
range(doc.DrawPages.getByIndex(0).Count)]]",
+  "expect": [
+   [
+    [
+     ""
+    ]
+   ],
+   [
+    [
+     "OLE label"
+    ]
+   ],
+   [
+    [
+     " "
+    ]
+   ],
+   [
+    [
+     "",
+     ""
+    ]
+   ],
+   [
+    [
+     "1/3/1"
+    ]
+   ]
+  ]
+ },
+ {
+  "name": "ole_has_field",
+  "expr": "[any(pt.TextPortionType == 'TextField' for pt in (lambda en: 
[en.nextElement() for _ in iter(en.hasMoreElements, 
False)])(par.createEnumeration())) for s in 
[doc.DrawPages.getByIndex(0).getByIndex(i) for i in 
range(doc.DrawPages.getByIndex(0).Count)] for par in (lambda en: 
[en.nextElement() for _ in iter(en.hasMoreElements, 
False)])(s.createEnumeration())]",
+  "expect": [
+   false,
+   false,
+   false,
+   false,
+   false,
+   true
+  ]
+ }
+]
diff --git a/test/odf-validate/fixtures/ole-text-edge/make.py 
b/test/odf-validate/fixtures/ole-text-edge/make.py
new file mode 100644
index 0000000000..2b6c13ceec
--- /dev/null
+++ b/test/odf-validate/fixtures/ole-text-edge/make.py
@@ -0,0 +1,24 @@
+# usage: runpy.sh fixtures/ole-text-edge/make.py <port> <out.odg>   (office 
saving ODF 1.2 Extended)
+# OLE shapes whose text is: none, a label, one space, a line break only, a 
date field only.
+import sys, uno
+from unohelp import connect, desktop, pv
+from com.sun.star.awt import Size, Point
+
+port, out = int(sys.argv[1]), sys.argv[2]
+d = desktop(connect(port))
+doc = d.loadComponentFromURL("private:factory/sdraw", "_blank", 0, 
(pv("Hidden", True),))
+page = doc.DrawPages.getByIndex(0)
+for i, text in enumerate(("", "OLE label", " ", "\n", None)):
+    s = doc.createInstance("com.sun.star.drawing.OLE2Shape")
+    s.CLSID = "078B7ABA-54FC-457F-8551-6147e776a997"
+    page.add(s)
+    s.Position = Point(1000 + i * 5000, 2000); s.Size = Size(4000, 3000)
+    if text is None:
+        f = doc.createInstance("com.sun.star.text.TextField.DateTime")
+        f.IsFixed = True
+        f.IsDate = True
+        s.insertTextContent(s.createTextCursor(), f, False)
+    elif text:
+        s.String = text
+doc.storeToURL(uno.systemPathToFileUrl(out), (pv("FilterName", "draw8"),))
+doc.close(True)
diff --git a/test/odf-validate/fixtures/ole-text-edge/ole-text-edge.odg 
b/test/odf-validate/fixtures/ole-text-edge/ole-text-edge.odg
new file mode 100644
index 0000000000..dad1364847
Binary files /dev/null and 
b/test/odf-validate/fixtures/ole-text-edge/ole-text-edge.odg differ

Reply via email to