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 e3031856db59599e25f17398bc49b3732aba06a2
Author: Jim Jagielski <[email protected]>
AuthorDate: Thu Oct 22 16:27:27 2026 -0400

    test/odf-validate: add fixtures for the value-clamp fixes
---
 .../fixtures/boolean-value/c_boolean.sxc           | Bin 0 -> 6239 bytes
 .../fixtures/boolean-value/checks.json             |   1 +
 .../fixtures/boolean-writer/boolean-writer.odt     | Bin 0 -> 9199 bytes
 .../fixtures/boolean-writer/checks.json            |  33 +++++++++++++++++++++
 test/odf-validate/fixtures/boolean-writer/make.py  |  33 +++++++++++++++++++++
 test/odf-validate/fixtures/font-size/checks.json   |   1 +
 test/odf-validate/fixtures/font-size/testinput.odp | Bin 0 -> 40660 bytes
 .../odf-validate/fixtures/hyphen-count/checks.json |   2 ++
 .../fixtures/hyphen-count/xforms-ubl.odt           | Bin 0 -> 22265 bytes
 test/odf-validate/fixtures/opacity/checks.json     |   1 +
 test/odf-validate/fixtures/opacity/filter.sxw      | Bin 0 -> 14359 bytes
 .../fixtures/print-date-never/checks.json          |  11 +++++++
 .../fixtures/print-date-never/good.odt             | Bin 0 -> 703 bytes
 .../fixtures/print-date/burger_factory.odt         | Bin 0 -> 18934 bytes
 test/odf-validate/fixtures/print-date/checks.json  |   2 ++
 15 files changed, 84 insertions(+)

diff --git a/test/odf-validate/fixtures/boolean-value/c_boolean.sxc 
b/test/odf-validate/fixtures/boolean-value/c_boolean.sxc
new file mode 100644
index 0000000000..b6e876605b
Binary files /dev/null and 
b/test/odf-validate/fixtures/boolean-value/c_boolean.sxc differ
diff --git a/test/odf-validate/fixtures/boolean-value/checks.json 
b/test/odf-validate/fixtures/boolean-value/checks.json
new file mode 100644
index 0000000000..27e14b0229
--- /dev/null
+++ b/test/odf-validate/fixtures/boolean-value/checks.json
@@ -0,0 +1 @@
+[{"name":"cells","expr":"[(c.AbsoluteName, c.Value, c.String, 
doc.NumberFormats.getByKey(c.NumberFormat).Type) for c in 
[doc.Sheets.getByIndex(0).getCellByPosition(x,y) for x in range(4) for y in 
range(6)] if 
c.Type.value!='EMPTY']","expect":[["$Sheet1.$A$1",12345.0,"TRUE",1024],["$Sheet1.$A$2",0.0,"FALSE",1024]]}]
diff --git a/test/odf-validate/fixtures/boolean-writer/boolean-writer.odt 
b/test/odf-validate/fixtures/boolean-writer/boolean-writer.odt
new file mode 100644
index 0000000000..f321a10618
Binary files /dev/null and 
b/test/odf-validate/fixtures/boolean-writer/boolean-writer.odt differ
diff --git a/test/odf-validate/fixtures/boolean-writer/checks.json 
b/test/odf-validate/fixtures/boolean-writer/checks.json
new file mode 100644
index 0000000000..ac05842bfa
--- /dev/null
+++ b/test/odf-validate/fixtures/boolean-writer/checks.json
@@ -0,0 +1,33 @@
+[
+ {
+  "name": "cells",
+  "expr": "[(c.Value, c.String, 
doc.NumberFormats.getByKey(c.NumberFormat).Type) for c in 
[doc.TextTables.getByIndex(0).getCellByPosition(i,0) for i in range(3)]]",
+  "expect": [
+   [
+    12345.0,
+    "TRUE",
+    1024
+   ],
+   [
+    1.0,
+    "TRUE",
+    1024
+   ],
+   [
+    0.0,
+    "FALSE",
+    1024
+   ]
+  ]
+ },
+ {
+  "name": "fields",
+  "expr": "[(f.Value, doc.NumberFormats.getByKey(f.NumberFormat).Type) for f 
in [e.nextElement() for e in [doc.TextFields.createEnumeration()] for _ in 
range(1)]]",
+  "expect": [
+   [
+    12345.0,
+    1024
+   ]
+  ]
+ }
+]
\ No newline at end of file
diff --git a/test/odf-validate/fixtures/boolean-writer/make.py 
b/test/odf-validate/fixtures/boolean-writer/make.py
new file mode 100644
index 0000000000..75bc2843e2
--- /dev/null
+++ b/test/odf-validate/fixtures/boolean-writer/make.py
@@ -0,0 +1,33 @@
+# usage: runpy.sh fixtures/boolean-writer/make.py <port> <out.odt>
+import sys, uno
+from unohelp import connect, desktop, pv
+from com.sun.star.lang import Locale
+from com.sun.star.util.NumberFormat import LOGICAL
+
+port, out = int(sys.argv[1]), sys.argv[2]
+d = desktop(connect(port))
+doc = d.loadComponentFromURL("private:factory/swriter", "_blank", 0, 
(pv("Hidden", True),))
+key = doc.NumberFormats.getStandardFormat(LOGICAL, Locale("en", "US", ""))
+tbl = doc.createInstance("com.sun.star.text.TextTable")
+tbl.initialize(1, 3)
+doc.Text.insertTextContent(doc.Text.End, tbl, False)
+for i, v in enumerate((12345, 1, 0)):
+    c = tbl.getCellByPosition(i, 0)
+    c.NumberFormat = key
+    c.setValue(v)
+cur = doc.Text.createTextCursor(); cur.gotoEnd(False)
+for i, v in enumerate((12345.0, 1.0, 0.0)):
+    f = doc.createInstance("com.sun.star.text.TextField.SetExpression")
+    mst = doc.createInstance("com.sun.star.text.FieldMaster.SetExpression")
+    mst.Name = "bv%d" % i
+    mst.SubType = 0
+    f.Content = ""
+    f.NumberFormat = key
+    f.SubType = 0
+    f.IsShowFormula = False
+    f.attachTextFieldMaster(mst)
+    doc.Text.insertTextContent(cur, f, False)
+    f.Value = v
+    doc.Text.insertString(cur, " ", False)
+doc.storeToURL(uno.systemPathToFileUrl(out), (pv("FilterName", "writer8"),))
+doc.close(True)
diff --git a/test/odf-validate/fixtures/font-size/checks.json 
b/test/odf-validate/fixtures/font-size/checks.json
new file mode 100644
index 0000000000..13225600fe
--- /dev/null
+++ b/test/odf-validate/fixtures/font-size/checks.json
@@ -0,0 +1 @@
+[{"name":"headline2_height_positive","expr":"doc.StyleFamilies.getByName('graphics').getByName('headline2').CharHeight
 > 0","expect":true}]
diff --git a/test/odf-validate/fixtures/font-size/testinput.odp 
b/test/odf-validate/fixtures/font-size/testinput.odp
new file mode 100644
index 0000000000..fe1ac44e8b
Binary files /dev/null and b/test/odf-validate/fixtures/font-size/testinput.odp 
differ
diff --git a/test/odf-validate/fixtures/hyphen-count/checks.json 
b/test/odf-validate/fixtures/hyphen-count/checks.json
new file mode 100644
index 0000000000..d5b70bfe00
--- /dev/null
+++ b/test/odf-validate/fixtures/hyphen-count/checks.json
@@ -0,0 +1,2 @@
+[{"name":"standard_counts","expr":"[doc.StyleFamilies.getByName('ParagraphStyles').getByName('Standard').ParaHyphenationMaxLeadingChars,
 
doc.StyleFamilies.getByName('ParagraphStyles').getByName('Standard').ParaHyphenationMaxTrailingChars]","expect":[0,0]},
+ {"name":"styles_with_nonzero","expr":"len([s for s in 
doc.StyleFamilies.getByName('ParagraphStyles').ElementNames if 
doc.StyleFamilies.getByName('ParagraphStyles').getByName(s).ParaHyphenationMaxLeadingChars
 != 0 or 
doc.StyleFamilies.getByName('ParagraphStyles').getByName(s).ParaHyphenationMaxTrailingChars
 != 0])","expect":0}]
diff --git a/test/odf-validate/fixtures/hyphen-count/xforms-ubl.odt 
b/test/odf-validate/fixtures/hyphen-count/xforms-ubl.odt
new file mode 100644
index 0000000000..7ffaab9bc1
Binary files /dev/null and 
b/test/odf-validate/fixtures/hyphen-count/xforms-ubl.odt differ
diff --git a/test/odf-validate/fixtures/opacity/checks.json 
b/test/odf-validate/fixtures/opacity/checks.json
new file mode 100644
index 0000000000..1ec3814386
--- /dev/null
+++ b/test/odf-validate/fixtures/opacity/checks.json
@@ -0,0 +1 @@
+[{"name":"shape_fill_transparence_clamped","expr":"[doc.DrawPage.getByIndex(i).FillTransparence
 for i in range(doc.DrawPage.Count) if 
doc.DrawPage.getByIndex(i).getPropertySetInfo().hasPropertyByName('FillTransparence')]","expect":[0,0]}]
diff --git a/test/odf-validate/fixtures/opacity/filter.sxw 
b/test/odf-validate/fixtures/opacity/filter.sxw
new file mode 100644
index 0000000000..e4b077c65f
Binary files /dev/null and b/test/odf-validate/fixtures/opacity/filter.sxw 
differ
diff --git a/test/odf-validate/fixtures/print-date-never/checks.json 
b/test/odf-validate/fixtures/print-date-never/checks.json
new file mode 100644
index 0000000000..bef0d5482f
--- /dev/null
+++ b/test/odf-validate/fixtures/print-date-never/checks.json
@@ -0,0 +1,11 @@
+[
+ {
+  "name": "print_date_absent",
+  "expr": 
"[doc.DocumentProperties.PrintDate.Year,doc.DocumentProperties.PrintDate.Month,doc.DocumentProperties.PrintDate.Day]",
+  "expect": [
+   0,
+   0,
+   0
+  ]
+ }
+]
\ No newline at end of file
diff --git a/test/odf-validate/fixtures/print-date-never/good.odt 
b/test/odf-validate/fixtures/print-date-never/good.odt
new file mode 100644
index 0000000000..9e5ea5b94f
Binary files /dev/null and 
b/test/odf-validate/fixtures/print-date-never/good.odt differ
diff --git a/test/odf-validate/fixtures/print-date/burger_factory.odt 
b/test/odf-validate/fixtures/print-date/burger_factory.odt
new file mode 100644
index 0000000000..8203ea0f09
Binary files /dev/null and 
b/test/odf-validate/fixtures/print-date/burger_factory.odt differ
diff --git a/test/odf-validate/fixtures/print-date/checks.json 
b/test/odf-validate/fixtures/print-date/checks.json
new file mode 100644
index 0000000000..8be04bb9e5
--- /dev/null
+++ b/test/odf-validate/fixtures/print-date/checks.json
@@ -0,0 +1,2 @@
+[{"name":"print_date_absent","expr":"[doc.DocumentProperties.PrintDate.Year,doc.DocumentProperties.PrintDate.Month,doc.DocumentProperties.PrintDate.Day]","expect":[0,0,0]},
+ 
{"name":"creation_date_kept","expr":"doc.DocumentProperties.CreationDate.Year","expect":2000}]

Reply via email to