testing library

Builders for small documents in memory, for tests: buildDocx, buildXlsx and buildPptx.

Classes

XlsxTestCell
A value with formatting: bold, a solid fill ('FFC000'), a number format code, and a border ('thin', 'medium'...) on borderSides in borderColor (none for automatic).
XlsxTestFormula
A formula and the result saved with it (none when cached is null).
XlsxTestSheet
A sheet for buildXlsx: cells by address ('B3'), and whether the author hid it ('hidden' / 'veryHidden').
XlsxTestXml
A cell written as-is: the XML inside <c r=".."> and its attributes, e.g. XlsxTestXml('<f t="shared" si="0"/><v>4</v>').

Functions

bodyShape(List<(String, int)> paragraphs) → String
A body shape; each entry is (text, bullet level).
buildDocx(String body, {String? styles, String? numbering, String? footnotes, String? endnotes, String relationships = '', Map<String, List<int>> media = const {}}) → Uint8List
Builds a minimal .docx for tests: body is the w:body content (the w: and r: prefixes are declared), and styles, numbering, footnotes and endnotes are the inner XML of those parts when given. relationships adds Relationship elements to the document's rels; media adds files under word/.
buildPptx(List<String> slides, {Map<String, List<int>> media = const {}, Map<int, String> slideRels = const {}, (int, int)? slideSize}) → Uint8List
Builds a minimal .pptx for tests: just the parts PptxParser reads - presentation.xml + its rels, the slides + their rels, and media. slides are slide-tree bodies (p:spTree children), in presentation order; they're stored in reverse file-name order so a test can tell p:sldIdLst order from file order. slideSize (EMUs) writes a p:sldSz.
buildXlsx(List<XlsxTestSheet> sheets, {List<String> dxfs = const []}) → Uint8List
Builds a minimal .xlsx for tests: workbook + rels, shared strings, styles and the sheets - just the parts XlsxReader reads. dxfs is raw <dxf> XML, for conditional formatting's dxfIds.
picture(String relId) → String
A p:pic whose picture is the slide relationship relId.
tableFrame(List<List<String>> rows) → String
A graphic frame holding an a:tbl of rows of cell text (not XML-escaped).
titleShape(String text) → String
A title-placeholder shape (p:sp with type="title") holding text; text is inserted as-is, not XML-escaped.