verify

command
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

LOK binding integration verification

End-to-end verification of github.com/docgo/libreofficekit against a real LibreOffice: load documents, render tiles/PDF, extract text selection, clipboard round-trip, and compare every extracted string against an independent oracle that parses the OOXML packages directly (no LibreOffice involved).

Layout

  • main.go — Go harness. Loads every file in samples/ through the binding, renders, extracts, and writes out/<name>.json|.txt|.pdf|.png.
  • oracle.py — independent expected-content extractor (zipfile + XML): docx body/footnotes/endnotes, xlsx cells (formula evaluation, date/percent number formats), pptx slides/notes, plus comment/reply counts.
  • compare.py — token-level coverage/similarity of binding output vs oracle; pptx falls back to PDF text extraction (LO 7.3 Impress has no LOK text selection); xlsx numbers are normalized for display rounding.
  • gen_samples.py — regenerates the python-docx/openpyxl/python-pptx samples (deterministic content).
  • goexlib-repro/ — regression check for the cgo.CString contract: v0.0.9 returned Go heap memory (crash on Free), fixed upstream in v0.1.0 to allocate on the C heap; this module verifies the fixed contract.
  • samples/ — 24 files: 10 docx (tables, headers/footers, lists, CJK, mixed, comments, change-tracking), 9 xlsx (types/number formats, formulas with oracle-side evaluation, merged cells, multi-sheet, 200-row sheet), 5 pptx (decks, CJK, 11-slide, notes).

Run

# 1. generate samples (optional; samples/ is committed)
python3 gen_samples.py          # needs python-docx openpyxl python-pptx

# 2. build & run the harness (uses this repo's binding)
go build -o out/verify ./verify
GODEBUG=asyncpreemptoff=1 ./out/verify
#   env: LOK_LO_PROGRAM=/path/to/libreoffice/program (default /usr/lib/libreoffice/program)

# 3. compare against oracle
python3 verify/compare.py

GODEBUG=asyncpreemptoff=1 is required: the LOK C callbacks are invoked on foreign threads and Go's async preemption otherwise aborts with a SIGURG fatal error.

Known LO 7.3 limitations (not binding bugs)

  • Comment callbacks are never emitted by LO 7.3 — comment counts show 0 (comment-warn in the comparison; not counted as failure).
  • Impress (pptx) has no text selection in LO 7.3 — pptx is verified via the rendered PDF instead.
  • Calc: wait ~1.2 s after .uno:SelectAll before GetTextSelection, otherwise the pre-SelectAll anchor cell text is returned for large sheets.
  • Calc SelectPart on LO 7.3 does not move the marked area to the new sheet (text selection keeps returning sheet 1 content), so multi-sheet spreadsheets are verified through the PDF export instead (LO exports all sheets).
  • A second view created on a second document crashes LO 7.3, so the harness keeps a single view per document.

Binding bugs found and fixed along the way

  • GetClipboard/SetClipboard passed cgo.CString(...) results to cgo.Free(...) — with goexlib/cgo v0.0.9 that aborted with free(): invalid pointer because CString returned Go heap memory. Upstream fixed the contract in v0.1.0 (C-heap allocation); the binding now uses cgo.CString directly (regression check in goexlib-repro/).
  • Known separate issue (pre-existing, not from this fix): in LO 7.3 headless, GetClipboard never returns data (getClipboardTry=false in all runs) even right after a successful SetClipboard round-trip; clipboard read-back is not verifiable on this LO version.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL