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 insamples/through the binding, renders, extracts, and writesout/<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 thecgo.CStringcontract: v0.0.9 returned Go heap memory (crash onFree), 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-warnin 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:SelectAllbeforeGetTextSelection, otherwise the pre-SelectAll anchor cell text is returned for large sheets. - Calc
SelectParton 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/SetClipboardpassedcgo.CString(...)results tocgo.Free(...)— with goexlib/cgo v0.0.9 that aborted withfree(): invalid pointerbecauseCStringreturned Go heap memory. Upstream fixed the contract in v0.1.0 (C-heap allocation); the binding now usescgo.CStringdirectly (regression check ingoexlib-repro/).- Known separate issue (pre-existing, not from this fix): in LO 7.3 headless,
GetClipboardnever returns data (getClipboardTry=falsein all runs) even right after a successfulSetClipboardround-trip; clipboard read-back is not verifiable on this LO version.
Documentation
¶
There is no documentation for this package.
Click to show internal directories.
Click to hide internal directories.