fix(pptx): preserve OLE previews and select supported markup branches

CR
6d ago
+384-26

Summary

PPTX embedded objects can expose their OLE compound payload as an image while silently losing the preview that the slide actually displays. Prefer the object's preview image, retain the original OLE payload in Document.assets, and preserve the existing payload fallback when no usable preview exists.

Graphic-frame searches now traverse only the selected mc:AlternateContent branch, including nested alternatives and later sibling content. This prevents rejected tables or OLE objects from hiding the supported representation. Shape-level OLE wrappers use the same parsing path, and the supported namespace set includes the chart and diagram formats this reader already handles.

Fixes #182. Thanks to the report and follow-up analysis there for identifying both the lost preview and the payload-retention requirement.

Validation

  • Added 13 end-to-end PPTX tests covering preview/payload identity, ordinary adjacent pictures and deduplication, supported and unsupported choices, missing fallback, nested/sibling alternatives, external and missing previews, missing payloads, and chart/diagram content in both frame-level and shape-level choices.
  • On unmodified main (e7178e099b6bf9171e2c52b832cbdb4134b69112), these tests produce 12 failures / 1 pass; with this change, 13 pass.
  • cargo test --locked: 311 passed, 1 ignored (the existing optional local-samples test).
  • cargo fmt --all --check: passed.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings: passed.
  • An independent reviewer inspected the change and reran all 13 regression tests successfully.

AI assistance was used for implementation, testing, and independent review. Node/Python/Wasm runtime tests were not run locally; their crates are covered by the workspace Clippy check above.