Skip to main content

Crate text_document_test_harness

Crate text_document_test_harness 

Source
Expand description

Shared test setup utilities for text-document crate tests.

Provides helpers to create an in-memory document with content, export text, and traverse the entity tree. This crate depends only on common and direct_access — it reimplements plain-text import and export directly via entity controllers, so it does not depend on document_io or any feature crate, breaking the circular dev-dependency chain.

Modules§

block_controller
document_controller
frame_controller
inline_element_controller
list_controller
root_controller
table_cell_controller
table_controller

Structs§

BasicStats
Basic document statistics retrieved directly from entity data.
BlockRelationshipDto
CreateBlockDto
CreateDocumentDto
CreateFrameDto
CreateInlineElementDto
CreateListEntityDto
CreateListResult
CreateRootDto
CreateTableCellDto
CreateTableDto
InsertFrameResult
InsertImageResult
InsertTableResult
TableCellDto
TableDto
UpdateBlockDto
UpdateInlineElementDto

Enums§

BlockRelationshipField
DocumentRelationshipField
FrameRelationshipField
RootRelationshipField
TableCellRelationshipField
TableRelationshipField

Functions§

create_list
Create a list spanning blocks in [position, anchor] using entity controllers.
export_text
Export the current document as plain text by reading blocks and concatenating their plain_text fields with \n separators.
get_all_block_ids
Get all block IDs across all frames in the document (not just the first frame).
get_block_ids
Get the first frame’s block IDs.
get_document_stats
Get basic document statistics by reading the Document entity directly.
get_element_ids
Get the element IDs for a given block.
get_first_block_element_ids
Get the first block’s element IDs.
get_frame_id
Get the first frame ID for the document.
get_sorted_cells
Get all cells for a table, sorted by row then column.
get_table_cell_ids
Get all cell IDs for a given table.
get_table_ids
Get all table IDs in the document.
insert_frame
Insert a sub-frame at position using entity controllers.
insert_image
Insert an image inline element at position using entity controllers.
insert_table
Insert a rows x columns table at position using entity controllers.
setup
Create an in-memory database with a Root and empty Document.
setup_with_text
Create an in-memory database with a Root, Document, and imported text content.