Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The archive row uses `cargo package --locked --allow-dirty --no-verify` with all

| Measurement | Value | Version | Platform | Build mode | Input | Command | Statistic | Measured on |
|---|---|---|---|---|---|---|---|---|
| Crates.io archive: rdocx | 4,501,789 compressed bytes, 56,396,845 member bytes, 37 members | 0.17.0 | macOS 26.6.2, Apple M5 Max, arm64 | `cargo package --locked --allow-dirty --no-verify` | Tracked `rdocx` package inventory | `python3 scripts/readme_doctests.py --record-measurements` | gzip archive bytes, tar member bytes, tar member count | 2026-11-09 |
| Crates.io archive: rdocx | 4,517,067 compressed bytes, 56,462,895 member bytes, 37 members | 0.17.0 | macOS 26.6.2, Apple M5 Max, arm64 | `cargo package --locked --allow-dirty --no-verify` | Tracked `rdocx` package inventory | `python3 scripts/readme_doctests.py --record-measurements` | gzip archive bytes, tar member bytes, tar member count | 2026-11-16 |
| Large-document layout throughput | minimum 250 pages/s, observed 31,019.1 pages/s | rdocx 0.14.0 | macOS 26.6.2, Apple M5 Max, arm64 | release, one test thread | 1,000 one-page paragraphs with deterministic fonts | `cargo test -p rdocx --test regression_test --release a_thousand_page_document_paginates_and_renders_within_the_declared_limits -- --ignored --exact --nocapture --test-threads=1` | pages per wall-clock second | 2026-09-19 |
| Large-document layout peak allocation | maximum 64 MiB, observed 29.03 MiB | rdocx 0.14.0 | macOS 26.6.2, Apple M5 Max, arm64 | release, one test thread | 1,000 one-page paragraphs with deterministic fonts | `cargo test -p rdocx --test regression_test --release a_thousand_page_document_paginates_and_renders_within_the_declared_limits -- --ignored --exact --nocapture --test-threads=1` | peak live allocation | 2026-09-19 |
| Large-document PDF throughput | minimum 1,000 pages/s, observed 60,058.0 pages/s | rdocx 0.14.0 | macOS 26.6.2, Apple M5 Max, arm64 | release, one test thread | 1,000 deterministic layout pages | `cargo test -p rdocx --test regression_test --release a_thousand_page_document_paginates_and_renders_within_the_declared_limits -- --ignored --exact --nocapture --test-threads=1` | pages per wall-clock second | 2026-09-19 |
Expand Down
34 changes: 34 additions & 0 deletions crates/rdocx-py/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17328,6 +17328,40 @@ def test_issue434_compare_equal_split_and_one_word_public(granularity):
assert [(r.kind, r.text) for r in original.revisions] == [("deletion", "thirty"), ("insertion", "sixty")]


@pytest.mark.parametrize("granularity", ["word", "character"])
def test_issue446_compare_keeps_unchanged_text_in_whole_runs(granularity):
import rdocx

def document(word):
document = rdocx.Document()
for index in range(12):
document.add_paragraph(f"Paragraph {index}: the bearing moved about {word} millimetres since the survey.")
return rdocx.Document.from_bytes(document.to_bytes())

original = document("twelve")
assert original.compare(document("fifteen"), "R", "2026-11-09T00:00:00Z", granularity=granularity) == ()
xml = _document_xml(original)
# One text element a run: a revision is never cut into its compared units.
assert b"</w:t><w:t" not in xml and b"</w:delText><w:delText" not in xml
# Runs with the same formatting never follow each other.
assert b"</w:r><w:r>" not in xml
revisions = original.revisions
for index, paragraph in enumerate(original.paragraphs):
runs = [run.text for run in paragraph.runs]
assert runs[0] == f"Paragraph {index}: the bearing moved about "
assert runs[-1].endswith(" millimetres since the survey.")
assert "".join(runs) == f"Paragraph {index}: the bearing moved about fifteen millimetres since the survey."
# One run a revision, and one for the text before, between and after them.
assert xml.count(b"<w:r>") <= 12 + 2 * len(revisions)
if granularity == "word":
assert [(r.kind, r.text) for r in revisions] == [("deletion", "twelve"), ("insertion", "fifteen")] * 12
assert [run.text for run in original.paragraphs[3].runs] == [
"Paragraph 3: the bearing moved about ",
"fifteen",
" millimetres since the survey.",
]
assert xml.count(b"<w:r>") == 12 * 4

@pytest.mark.parametrize("normal", [False, True, "distinct"])
def test_issue434_insert_effective_font_and_saved_body(normal):
import rdocx
Expand Down
Loading
Loading