Compare commits

..
Author SHA1 Message Date
Dylan M. Taylor 2f17b53970 test: share repeated PPTX fixture ZIP operations 2026-11-23 20:49:54 -05:00
Dylan M. Taylor 17655fe628 Refresh native package byte golden for ZIP 9.8.2
The updated ZIP dependency deterministically changes the Deflate streams and member offsets. Member names and order, decompressed payloads and CRCs, timestamps, compression methods, flags, and ZIP metadata match the previous golden. Keep the exact byte comparison and the existing logical and damage-report goldens unchanged.
2026-11-23 20:24:47 -05:00
Dylan M. Taylor 127bb2e8d4 Use ZIP 9.8.2 for DeckCraft test fixtures
Supersedes the remaining dependency bump from Harrison Booth’s #1496 after production parsing moved to shared crates.
2026-11-23 20:24:47 -05:00
gmrmad1andFredApps 9db2fa0ca9 docs: bring ROADMAP.md current through 2026-11-15 (#2138)
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
2026-11-23 16:45:43 -06:00
Dylan M. Taylor 2d031bb6b6 revert: restore scheduled release.yml dry-run on main (#2342) 2026-11-23 14:44:51 -05:00
Dylan M. Taylor 14ff0938ff ci(release): publish scheduled nightly prereleases (#2341) 2026-11-23 13:16:43 -05:00
Dylan M. Taylor 26620f59be ci(release): forward ARTCRAFT_SERVICES_DISPATCH_TOKEN secret (#2335) 2026-11-23 09:33:31 -05:00
FredApps 7fbdc085eb Merge pull request #2266 from kiwi5boy/ccr-3400a88a-qfiv9l
#2069: WMF scale and offset mapping records place sub-pictures
2026-11-23 05:59:10 +07:00
autocraft-bot[bot] 06c7701514 Merge main into ccr-3400a88a-qfiv9l 2026-11-22 16:32:37 +00:00
Dylan M. Taylor 0ccc68f61c test(pptx): require named chart and edited series values in PPTX/POTX/PPSX parity test (#2295) 2026-11-21 12:25:33 -05:00
Dylan M. Taylor c355c06397 format: use shared craft-rtf tokenizer for RTF input (#2289)
* format: use shared craft-rtf tokenizer for RTF input

* test: match craft-rtf Tokens 10-digit param limit in huge_left_indent test
2026-11-21 02:46:03 -05:00
keithcsqueensu 921b455836 #2069: WMF scale and offset mapping records place sub-pictures
Move the craft-metafile pin to storytold/craft-libs f428c3d3, past
craft-libs #1816 (Hamza's mapping records from #1183, with the frame
fix). WMF files that draw sub-pictures with SCALEVIEWPORTEXT,
SCALEWINDOWEXT, OFFSETVIEWPORTORG and OFFSETWINDOWORG now place each
one in its part of the frame instead of stretching the first over it.

Only craft-metafile moves; the other craft-libs pins are unchanged.

The render test builds the issue's WMF in code and fails on the old
pin: the right half is red, not blue.
2026-11-20 00:19:20 +00:00
48 changed files with 381 additions and 426 deletions
+1
View File
@@ -59,3 +59,4 @@ jobs:
AZURE_SIGNING_ACCOUNT: ${{ secrets.AZURE_SIGNING_ACCOUNT }}
AZURE_CERT_PROFILE: ${{ secrets.AZURE_CERT_PROFILE }}
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
ARTCRAFT_SERVICES_DISPATCH_TOKEN: ${{ secrets.ARTCRAFT_SERVICES_DISPATCH_TOKEN }}
Generated
+46 -60
View File
@@ -220,9 +220,6 @@ name = "arbitrary"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed"
dependencies = [
"derive_arbitrary",
]
[[package]]
name = "arboard"
@@ -240,7 +237,7 @@ dependencies = [
"objc2-foundation 0.3.2",
"parking_lot",
"percent-encoding",
"windows-sys 0.52.0",
"windows-sys 0.61.2",
"wl-clipboard-rs",
"x11rb",
]
@@ -817,6 +814,15 @@ dependencies = [
"crossbeam-utils",
]
[[package]]
name = "constant_time_eq"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9eb6feb175df65d0a3ccd3e73484e940d0ac664e8034f0519fd49a93db3071d9"
dependencies = [
"rustversion",
]
[[package]]
name = "core-foundation"
version = "0.9.4"
@@ -964,7 +970,7 @@ dependencies = [
"serde",
"serde_json",
"thiserror 2.0.21",
"zip 9.1.0",
"zip",
]
[[package]]
@@ -1025,7 +1031,7 @@ dependencies = [
[[package]]
name = "craft-metafile"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=63196e66f3033a6623eb629af95a104d26986725#63196e66f3033a6623eb629af95a104d26986725"
source = "git+https://github.com/storytold/craft-libs?rev=f428c3d36e0faf3924b76956a01334c051543527#f428c3d36e0faf3924b76956a01334c051543527"
dependencies = [
"encoding_rs",
"image",
@@ -1131,7 +1137,7 @@ dependencies = [
"verifysign",
"winreg",
"winsafe",
"zip 9.1.0",
"zip",
]
[[package]]
@@ -1182,7 +1188,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=254e9a409b410dc93c0e06
dependencies = [
"flate2",
"thiserror 2.0.21",
"zip 9.1.0",
"zip",
]
[[package]]
@@ -1192,7 +1198,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=8048f8ef92da80fb3ce5a0
dependencies = [
"flate2",
"thiserror 2.0.21",
"zip 9.1.0",
"zip",
]
[[package]]
@@ -1304,7 +1310,7 @@ dependencies = [
"deckcraft-engine",
"deckcraft-mcp",
"serde_json",
"zip 3.0.0",
"zip",
]
[[package]]
@@ -1339,7 +1345,7 @@ dependencies = [
"serde",
"serde_json",
"thiserror 2.0.21",
"zip 3.0.0",
"zip",
]
[[package]]
@@ -1362,7 +1368,7 @@ dependencies = [
"craft-rtf",
"deckcraft-model",
"serde_json",
"zip 3.0.0",
"zip",
]
[[package]]
@@ -1461,7 +1467,7 @@ dependencies = [
"quick-xml 0.41.0",
"serde_json",
"thiserror 2.0.21",
"zip 3.0.0",
"zip",
]
[[package]]
@@ -1548,17 +1554,6 @@ version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e"
[[package]]
name = "derive_arbitrary"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b034bd7d5f032402a2479444dcc6f74e36a03f31854d41680fb240ef682a1ac"
dependencies = [
"proc-macro2",
"quote",
"syn 3.0.6",
]
[[package]]
name = "dify"
version = "0.8.0"
@@ -1940,7 +1935,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys 0.52.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -3363,7 +3358,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -3866,7 +3861,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
dependencies = [
"libc",
"windows-sys 0.45.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -4518,7 +4513,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys 0.12.1",
"windows-sys 0.52.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -4575,7 +4570,7 @@ dependencies = [
"security-framework",
"security-framework-sys",
"webpki-root-certs",
"windows-sys 0.52.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -5255,10 +5250,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
"getrandom 0.3.4",
"getrandom 0.4.3",
"once_cell",
"rustix 1.1.5",
"windows-sys 0.52.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -6220,7 +6215,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.52.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -6924,6 +6919,20 @@ name = "zeroize"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879"
dependencies = [
"zeroize_derive",
]
[[package]]
name = "zeroize_derive"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.119",
]
[[package]]
name = "zerotrie"
@@ -6964,32 +6973,21 @@ dependencies = [
[[package]]
name = "zip"
version = "3.0.0"
version = "9.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12598812502ed0105f607f941c386f43d441e00148fce9dec3ca5ffb0bde9308"
dependencies = [
"arbitrary",
"crc32fast",
"flate2",
"indexmap",
"memchr",
"zopfli",
]
[[package]]
name = "zip"
version = "9.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2886b00003a72c4ccee3f42cfc34908d33b2508a74d827dc2a4244706475c704"
checksum = "2d8dbe089cf6b0448b78f5fc50139ab5aaa40d08ac07cdc1baf2c13add35fcce"
dependencies = [
"constant_time_eq",
"crc32fast",
"flate2",
"getrandom 0.4.3",
"indexmap",
"libc",
"memchr",
"nix",
"typed-path",
"windows-sys 0.61.2",
"zeroize",
]
[[package]]
@@ -7004,18 +7002,6 @@ version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
[[package]]
name = "zopfli"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249"
dependencies = [
"bumpalo",
"crc32fast",
"log",
"simd-adler32",
]
[[package]]
name = "zune-core"
version = "0.5.3"
+2 -2
View File
@@ -72,14 +72,14 @@ craft-audio = { git = "https://github.com/storytold/craft-libs", rev = "010702ee
# H.264, HEVC, VP9 and AV1 decoders.
craft-video = { git = "https://github.com/storytold/craft-libs", rev = "010702ee9b030844c852939095b1da0d0656a890", version = "=0.1.0", default-features = false, features = ["h264-decode", "hevc-decode", "vp9-decode", "av1-decode", "threads"] }
# WMF, EMF and EMF+ reader.
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "63196e66f3033a6623eb629af95a104d26986725", version = "=0.1.0" }
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "f428c3d36e0faf3924b76956a01334c051543527", version = "=0.1.0" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "63196e66f3033a6623eb629af95a104d26986725", version = "=0.1.0", default-features = false, features = ["write", "write-simple-text"] }
# craft-update: app-specific pretend versions apply to startup and manual checks.
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "63196e66f3033a6623eb629af95a104d26986725", features = ["egui"] }
craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "63196e66f3033a6623eb629af95a104d26986725", version = "=0.1.0" }
i_overlay = "9"
quick-xml = "0.41"
zip = { version = "3", default-features = false, features = ["deflate"] }
zip = { version = "=9.8.2", default-features = false, features = ["deflate-flate2"] }
miniz_oxide = { version = "0.9", default-features = false, features = ["with-alloc"] }
# ui
+6
View File
@@ -2,7 +2,9 @@
**Stage: alpha** · next: beta, ~20 points and ~120–210 h away
> **Last reviewed:** 2026-11-04 · **Last updated:** 2026-11-20 · **Change:** trivial (progress log: WMF scale and offset mapping records place sub-pictures, #2069; scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
> **Last reviewed:** 2026-11-04 · **Last updated:** 2026-11-16 · **Change:** trivial (progress log: every slide as PNG or JPEG from File › Export › Change File Type and Save As, #2019; scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
> **Last reviewed:** 2026-11-04 · **Last updated:** 2026-11-15 · **Change:** trivial (DeckCraft v0.19.0 version preparation (#2134); the SmartArt and WordArt display names become Diagram and Decorative Text (#1981) in DeckCraft's own feature labels — commands, contextual tab labels and messages — with the neutral labels guarded by tests (the PowerPoint-matching empty-diagram placeholder prompt still reads "Click icon to add SmartArt graphic", and saved control-channel identifiers such as the tab id "SmartArt Design" keep their keys); the wasm32 build no longer refers to the native-only opening generation (#1954); the control-protocol method reference is corrected (#2132); parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
> **Last reviewed:** 2026-11-04 · **Last updated:** 2026-11-14 · **Change:** minor (a slide the show advances to again plays its animations again, #2090; slide-list entries with missing relationships are reported as lost slides and open as repaired copies; the Opus decoder and the Ogg, MP4 and Matroska demuxers come from craft-libs; empty notes slides are kept through PPTX and native saves, #2025; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
> **Last reviewed:** 2026-11-04 · **Last updated:** 2026-11-09 · **Change:** minor (progress log: PowerPoint 97–2003 `.ppt`/`.pot`/`.pps` import, #239) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
> **Last reviewed:** 2026-11-04 · **Last updated:** 2026-11-07 · **Change:** trivial (progress log: text in a group whose child coordinates scale its shapes is placed for export where the slide draws it; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
@@ -158,7 +160,9 @@ app's JSON control channel (`deckcraft --control PORT`).
| Date | What landed |
|---|---|
| 2026-11-20 | WMF pictures that draw sub-pictures through the scale and offset mapping records (charts and clip art from older Office versions) place each one in its part of the frame (#2069) |
| 2026-11-16 | Export: every slide as its own PNG or JPEG picture from File › Export › Change File Type and File › Save As; the Export… dialog adds JPEG images (all slides) (#2019) |
| 2026-11-15 | DeckCraft v0.19.0 version preparation (#2134); the SmartArt and WordArt display names become Diagram and Decorative Text in DeckCraft's own feature labels — commands, contextual tab labels and messages — with the neutral labels guarded by tests; the wasm32 build no longer refers to the native-only opening generation (#1954); the control-protocol method reference is corrected (#2132) |
| 2026-11-14 | Slide show: a slide the show advances to again (click, →, Space, automatic advance or a loop) starts over, so its animations play again, as in PowerPoint. Back and links still show it as it was left (#2090) |
| 2026-11-11 | PPTX: a slide whose notes slide has empty text retains its notesSlide part and relationship on save and reopen (#2025); empty notes slides survive native round trips |
| 2026-11-11 | Media: the Opus decoder and the Ogg, MP4/MOV and Matroska demuxers are craft-audio and craft-media from craft-libs; DeckCraft's own copies and re-export crates are removed |
@@ -351,7 +355,9 @@ app's JSON control channel (`deckcraft --control PORT`).
| Date | Change | Summary |
|---|---|---|
| 2026-11-20 | trivial | Progress log: WMF scale and offset mapping records (#2069); scores unchanged |
| 2026-11-16 | trivial | Progress log: export all slides as PNG or JPEG from the File tab (#2019); scores unchanged |
| 2026-11-15 | trivial | v0.19.0 version preparation; Diagram and Decorative Text naming (#1981) scoped to DeckCraft's own labels — the PowerPoint-matching empty-placeholder prompt still reads "Click icon to add SmartArt graphic" and saved control-channel identifiers keep their keys; wasm32 fix (#1954); control-protocol reference fix (#2132); parity scores unchanged |
| 2026-11-14 | trivial | Progress log: a slide the show advances to again plays its animations again (#2090); parity scores unchanged |
| 2026-11-11 | minor | Progress log: empty notes slides preserved on PPTX/native save (#2025); parity scores unchanged |
| 2026-11-11 | trivial | Opus and container code moved to craft-libs crates; parity scores unchanged |
+2 -2
View File
@@ -24,10 +24,10 @@ fn without_slide2(deck: &[u8]) -> Vec<u8> {
let mut f = zin.by_index(i).unwrap();
let mut data = vec![];
f.read_to_end(&mut data).unwrap();
if f.name() == "ppt/slides/slide2.xml" {
if f.name().expect("ZIP member name") == "ppt/slides/slide2.xml" {
data = b"<p:sld".to_vec();
}
out.start_file(f.name(), options).unwrap();
out.start_file(f.name().expect("ZIP member name"), options).unwrap();
out.write_all(&data).unwrap();
}
out.finish().unwrap().into_inner()
+2 -2
View File
@@ -232,7 +232,7 @@ mod font_script_tests {
let mut xml = String::new();
for i in 0..zip.len() {
let mut f = zip.by_index(i).unwrap();
if f.name().starts_with("ppt/slides/slide") && f.name().ends_with(".xml") {
if f.name().expect("ZIP member name").starts_with("ppt/slides/slide") && f.name().expect("ZIP member name").ends_with(".xml") {
std::io::Read::read_to_string(&mut f, &mut xml).unwrap();
}
}
@@ -311,7 +311,7 @@ mod font_script_tests {
let mut xml = String::new();
for i in 0..zip.len() {
let mut f = zip.by_index(i).unwrap();
if f.name().starts_with("ppt/slides/slide") && f.name().ends_with(".xml") {
if f.name().expect("ZIP member name").starts_with("ppt/slides/slide") && f.name().expect("ZIP member name").ends_with(".xml") {
std::io::Read::read_to_string(&mut f, &mut xml).unwrap();
}
}
+3 -3
View File
@@ -4494,7 +4494,7 @@ fn smartart_round_trips_through_pptx_as_a_diagram() {
let bytes = deckcraft_pptx::export(&doc).unwrap();
let names: Vec<String> = {
let z = zip::ZipArchive::new(std::io::Cursor::new(&bytes)).unwrap();
z.file_names().map(String::from).collect()
z.file_names().map(|name| name.expect("ZIP member name")).map(String::from).collect()
};
for part in ["data1", "layout1", "quickStyle1", "colors1", "drawing1"] {
assert!(names.iter().any(|n| n == &format!("ppt/diagrams/{part}.xml")), "{part} in {names:?}");
@@ -6104,10 +6104,10 @@ fn opening_a_pptx_with_an_unreadable_slide_says_so() {
let mut f = zin.by_index(i).unwrap();
let mut d = vec![];
f.read_to_end(&mut d).unwrap();
if f.name() == "ppt/slides/slide2.xml" {
if f.name().expect("ZIP member name") == "ppt/slides/slide2.xml" {
d = b"<p:sld".to_vec();
}
out.start_file(f.name(), o).unwrap();
out.start_file(f.name().expect("ZIP member name"), o).unwrap();
out.write_all(&d).unwrap();
}
let broken = out.finish().unwrap().into_inner();
+1 -1
View File
@@ -102,7 +102,7 @@ fn pptx_native_edit_save_reopen_keeps_chart_parts() {
let mut f = z.by_index(i).expect("entry");
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
payloads.push((f.name().to_string(), data));
payloads.push((f.name().expect("ZIP member name").to_string(), data));
}
assert!(payloads.iter().any(|(n, d)| n.starts_with("ppt/embeddings/") && d == WORKBOOK));
assert!(payloads.iter().any(|(n, d)| n.starts_with("ppt/drawings/") && d == DRAWING));
+1 -1
View File
@@ -91,7 +91,7 @@ fn with_timing(bytes: &[u8], clicks: impl Fn(&mut u32, &str, &str) -> Vec<String
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
for i in 0..src.len() {
let mut f = src.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = Vec::new();
f.read_to_end(&mut data).expect("read");
if name == "ppt/slides/slide1.xml" {
+6 -6
View File
@@ -53,7 +53,7 @@ fn rewrite_manifest(bytes: &[u8], edit: impl FnOnce(&mut Value)) -> Vec<u8> {
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
for i in 0..z.len() {
let f = z.by_index(i).unwrap();
if f.name() == "presentation.json" {
if f.name().expect("ZIP member name") == "presentation.json" {
out.start_file("presentation.json", zip::write::SimpleFileOptions::default()).unwrap();
out.write_all(&serde_json::to_vec(&json).unwrap()).unwrap();
} else {
@@ -120,7 +120,7 @@ fn chart_payloads_in_every_shape_owner_get_distinct_entries() {
p.handout_master = Some(Arc::new(Master { shapes, ..Default::default() }));
let bytes = save(&p).unwrap();
let z = zip::ZipArchive::new(Cursor::new(bytes.as_slice())).unwrap();
assert_eq!(z.file_names().filter(|name| name.starts_with("chart-parts/")).count(), 5);
assert_eq!(z.file_names().map(|name| name.expect("ZIP member name")).filter(|name| name.starts_with("chart-parts/")).count(), 5);
assert_eq!(load(&bytes).unwrap(), p);
}
@@ -131,11 +131,11 @@ fn missing_or_corrupt_chart_payload_is_reported() {
let mut z = zip::ZipArchive::new(Cursor::new(bytes.as_slice())).unwrap();
let mut json: Value = serde_json::from_slice(&read_entry(&mut z, "presentation.json").unwrap()).unwrap();
let name = part_json(&mut json).unwrap()["nativeEntry"].as_str().unwrap().to_owned();
let start = z.by_name(&name).unwrap().data_start() as usize;
let start = z.by_name(&name).unwrap().data_start().expect("member data offset") as usize;
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
for i in 0..z.len() {
let f = z.by_index(i).unwrap();
if f.name() != name {
if f.name().expect("ZIP member name") != name {
out.raw_copy_file(f).unwrap();
}
}
@@ -200,7 +200,7 @@ fn corrupt_chart_members_stop_before_reusing_the_inflation_budget() {
let mut bytes = save(&with_two_parts()).unwrap();
let offsets: Vec<_> = {
let mut z = zip::ZipArchive::new(Cursor::new(bytes.as_slice())).unwrap();
(0..2).map(|i| z.by_name(&format!("chart-parts/{i}")).unwrap().data_start() as usize).collect()
(0..2).map(|i| z.by_name(&format!("chart-parts/{i}")).unwrap().data_start().expect("member data offset") as usize).collect()
};
for offset in offsets {
bytes[offset] ^= 0xff;
@@ -227,7 +227,7 @@ fn duplicate_physical_zip_names_are_indexed_and_inflated_once() {
}
assert_eq!(replaced, 2);
let z = zip::ZipArchive::new(Cursor::new(bytes.as_slice())).unwrap();
assert_eq!(z.file_names().filter(|n| n.starts_with("chart-parts/")).count(), 1);
assert_eq!(z.file_names().map(|name| name.expect("ZIP member name")).filter(|n| n.starts_with("chart-parts/")).count(), 1);
let (q, damaged) = load_within(&bytes, Budget::media(10, 2)).unwrap();
assert_eq!(damaged.len(), 1, "the second reference is missing, not inflated again");
let ShapeKind::Group { children, .. } = &q.slides[0].shapes[0].kind else { panic!("group") };
+1 -1
View File
@@ -109,7 +109,7 @@ fn a_load_of_a_damaged_package_gives_the_golden_report() {
let mut out = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
for i in 0..z.len() {
let Ok(f) = z.by_index_raw(i) else { continue };
if f.name() != "media/1" && f.name() != "chart-parts/1" {
if f.name().expect("ZIP member name") != "media/1" && f.name().expect("ZIP member name") != "chart-parts/1" {
out.raw_copy_file(f).unwrap_or_else(|e| panic!("{e}"));
}
}
+2 -2
View File
@@ -113,7 +113,7 @@ fn without(bytes: &[u8], drop: &str) -> Vec<u8> {
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
for i in 0..z.len() {
let f = z.by_index(i).unwrap();
if f.name() != drop {
if f.name().expect("ZIP member name") != drop {
out.raw_copy_file(f).unwrap();
}
}
@@ -219,7 +219,7 @@ fn repeated_media_ids_are_read_once() {
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
for i in 0..z.len() {
let mut f = z.by_index(i).unwrap();
if f.name() == "presentation.json" {
if f.name().expect("ZIP member name") == "presentation.json" {
let mut json = vec![];
f.read_to_end(&mut json).unwrap();
let mut v: serde_json::Value = serde_json::from_slice(&json).unwrap();
Binary file not shown.
+4 -22
View File
@@ -1,7 +1,9 @@
//! A series-level `c:dLbls/c:delete val="1"` hides that series' labels although the
//! chart-wide `showVal` is on (#1977).
use std::io::{Cursor, Read, Write};
#[path = "support/chart_fixture.rs"]
mod chart_fixture;
use std::sync::Arc;
use deckcraft_geom::Xfrm;
@@ -26,26 +28,6 @@ fn bar_chart_pptx() -> Vec<u8> {
deckcraft_pptx::export(&p).expect("export")
}
fn reimport(bytes: &[u8], f: impl Fn(&str) -> String) -> Presentation {
let mut zip = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let opts = zip::write::SimpleFileOptions::default();
for i in 0..zip.len() {
let mut entry = zip.by_index(i).expect("entry");
let name = entry.name().to_string();
let mut data = vec![];
entry.read_to_end(&mut data).expect("read");
if name.starts_with("ppt/charts/chart") && name.ends_with(".xml") && !name.contains("_rels") {
let xml = String::from_utf8(data).expect("chart xml");
data = f(&xml).into_bytes();
}
out.start_file(&name, opts).expect("start");
out.write_all(&data).expect("write");
}
let patched = out.finish().expect("finish").into_inner();
deckcraft_pptx::import(&patched).expect("import")
}
fn chart_of(p: &Presentation) -> &Chart {
let s = p.slides.first().expect("slide");
for sh in &s.shapes {
@@ -58,7 +40,7 @@ fn chart_of(p: &Presentation) -> &Chart {
#[test]
fn series_dlbls_delete_hides_that_series_labels() {
let p = reimport(&bar_chart_pptx(), |xml| {
let p = chart_fixture::reimport(&bar_chart_pptx(), |xml| {
xml.replacen("<c:cat>", r#"<c:dLbls><c:delete val="1"/></c:dLbls><c:cat>"#, 1).replacen(
"<c:gapWidth",
r#"<c:dLbls><c:showVal val="1"/></c:dLbls><c:gapWidth"#,
+7 -26
View File
@@ -1,7 +1,9 @@
//! Series-level data labels: `c:dLbls/c:showVal` on a series overrides the chart-wide setting,
//! and a bare `<c:showVal/>` (no `val` attribute) means true, as the schema's default (#868).
use std::io::{Cursor, Read, Write};
#[path = "support/chart_fixture.rs"]
mod chart_fixture;
use std::sync::Arc;
use deckcraft_geom::Xfrm;
@@ -27,27 +29,6 @@ fn bar_chart_pptx() -> Vec<u8> {
deckcraft_pptx::export(&p).expect("export")
}
/// Rewrite the chart part's XML through `f` and re-import the deck.
fn reimport(bytes: &[u8], f: impl Fn(&str) -> String) -> Presentation {
let mut zip = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let opts = zip::write::SimpleFileOptions::default();
for i in 0..zip.len() {
let mut entry = zip.by_index(i).expect("entry");
let name = entry.name().to_string();
let mut data = vec![];
entry.read_to_end(&mut data).expect("read");
if name.starts_with("ppt/charts/chart") && name.ends_with(".xml") && !name.contains("_rels") {
let xml = String::from_utf8(data).expect("chart xml");
data = f(&xml).into_bytes();
}
out.start_file(&name, opts).expect("start");
out.write_all(&data).expect("write");
}
let patched = out.finish().expect("finish").into_inner();
deckcraft_pptx::import(&patched).expect("import")
}
fn chart_of(p: &Presentation) -> &Chart {
let s = p.slides.first().expect("slide");
for sh in &s.shapes {
@@ -62,7 +43,7 @@ fn chart_of(p: &Presentation) -> &Chart {
/// setting is off; the other series stay quiet.
#[test]
fn bare_series_showval_shows_labels() {
let p = reimport(&bar_chart_pptx(), |xml| xml.replacen("<c:cat>", r#"<c:dLbls><c:showVal/></c:dLbls><c:cat>"#, 1));
let p = chart_fixture::reimport(&bar_chart_pptx(), |xml| xml.replacen("<c:cat>", r#"<c:dLbls><c:showVal/></c:dLbls><c:cat>"#, 1));
let c = chart_of(&p);
assert!(!c.data_labels, "the chart-wide setting stays off");
assert_eq!(c.series[0].data_labels, Some(true), "a bare showVal means true");
@@ -76,7 +57,7 @@ fn bare_series_showval_shows_labels() {
/// `val="0"` on the series hides its labels although the chart-wide setting is on.
#[test]
fn series_showval_false_hides_labels() {
let p = reimport(&bar_chart_pptx(), |xml| {
let p = chart_fixture::reimport(&bar_chart_pptx(), |xml| {
xml.replacen("<c:cat>", r#"<c:dLbls><c:showVal val="0"/></c:dLbls><c:cat>"#, 1).replacen(
"<c:gapWidth",
r#"<c:dLbls><c:showVal/></c:dLbls><c:gapWidth"#,
@@ -138,7 +119,7 @@ fn combo_chart_pptx() -> Vec<u8> {
/// keeps them off, even when the other group asks for them (#868).
#[test]
fn a_combo_chart_keeps_each_groups_own_label_setting() {
let p = reimport(&combo_chart_pptx(), |xml| {
let p = chart_fixture::reimport(&combo_chart_pptx(), |xml| {
// The bar group asks for no labels, the line group for labels.
xml.replacen("<c:gapWidth", r#"<c:dLbls><c:showVal val="0"/></c:dLbls><c:gapWidth"#, 1).replacen(
"<c:marker val=\"1\"/>",
@@ -158,7 +139,7 @@ fn a_combo_chart_keeps_each_groups_own_label_setting() {
#[test]
fn chart_options_data_labels_on_overrides_series_off() {
use deckcraft_engine::Session;
let p = reimport(&bar_chart_pptx(), |xml| xml.replace("<c:cat>", r#"<c:dLbls><c:showVal val="0"/></c:dLbls><c:cat>"#));
let p = chart_fixture::reimport(&bar_chart_pptx(), |xml| xml.replace("<c:cat>", r#"<c:dLbls><c:showVal val="0"/></c:dLbls><c:cat>"#));
assert!(chart_of(&p).series.iter().all(|s| !chart_of(&p).series_data_labels(s)), "every series starts quiet");
let path = std::env::temp_dir().join("deckcraft_series_labels_off.pptx");
std::fs::write(&path, deckcraft_pptx::export(&p).expect("export")).expect("write");
+1 -1
View File
@@ -19,7 +19,7 @@ fn rewrite(bytes: &[u8], edit: impl Fn(&str, String) -> String) -> Vec<u8> {
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
for i in 0..src.len() {
let mut f = src.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = Vec::new();
f.read_to_end(&mut data).expect("read");
if name.ends_with(".xml") {
+1 -1
View File
@@ -17,7 +17,7 @@ fn deck_with(effect: &str, behaviour: &str) -> Vec<bool> {
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
if name == "ppt/slides/slide1.xml" {
+3 -3
View File
@@ -31,7 +31,7 @@ fn with_workbook(bytes: &[u8]) -> Vec<u8> {
let mut chart_part = None;
for i in 0..zip.len() {
let mut f = zip.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
if name.starts_with("ppt/charts/chart") && name.ends_with(".xml") && !name.contains("_rels") {
@@ -70,7 +70,7 @@ fn parts(bytes: &[u8]) -> Vec<(String, Vec<u8>)> {
let mut out = vec![];
for i in 0..zip.len() {
let mut f = zip.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
out.push((name, data));
@@ -156,7 +156,7 @@ fn rewrite(src: &[u8], edit: impl Fn(&str, Vec<u8>) -> Vec<u8>, extra: &[(&str,
let opts = zip::write::SimpleFileOptions::default();
for i in 0..zip.len() {
let mut f = zip.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
let data = edit(&name, data);
+7 -7
View File
@@ -58,10 +58,10 @@ fn rewrite(bytes: &[u8], drop: &[&str]) -> Vec<u8> {
let mut out = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
if drop.iter().any(|d| f.name() == *d) {
if drop.iter().any(|d| f.name().expect("ZIP member name") == *d) {
continue;
}
out.start_file(f.name(), zip::write::SimpleFileOptions::default()).expect("start");
out.start_file(f.name().expect("ZIP member name"), zip::write::SimpleFileOptions::default()).expect("start");
std::io::copy(&mut f, &mut out).expect("copy");
}
out.finish().expect("finish").into_inner()
@@ -161,8 +161,8 @@ fn owned_modern_part_still_suppresses_later_legacy() {
let mut out = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
out.start_file(f.name(), zip::write::SimpleFileOptions::default()).expect("start");
if f.name() == "ppt/slides/_rels/slide2.xml.rels" {
out.start_file(f.name().expect("ZIP member name"), zip::write::SimpleFileOptions::default()).expect("start");
if f.name().expect("ZIP member name") == "ppt/slides/_rels/slide2.xml.rels" {
std::io::Write::write_all(&mut out, rels2.as_bytes()).expect("write");
} else {
std::io::copy(&mut f, &mut out).expect("copy");
@@ -193,8 +193,8 @@ fn legacy_only_package_imports() {
let mut out = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
out.start_file(f.name(), zip::write::SimpleFileOptions::default()).expect("start");
if f.name() == "ppt/slides/slide1.xml" {
out.start_file(f.name().expect("ZIP member name"), zip::write::SimpleFileOptions::default()).expect("start");
if f.name().expect("ZIP member name") == "ppt/slides/slide1.xml" {
let mut xml = String::new();
f.read_to_string(&mut xml).expect("utf8");
if let Some(start) = xml.find("<p:extLst>") {
@@ -246,7 +246,7 @@ fn every_written_xml_part_binds_its_prefixes() {
let mut modern = 0;
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
if !(name.ends_with(".xml") || name.ends_with(".rels")) {
continue;
}
+2 -14
View File
@@ -4,7 +4,7 @@
//! package and the content parts. A second save must come out the same as the first.
use std::collections::BTreeMap;
use std::io::{Cursor, Read, Write};
use std::io::{Cursor, Write};
use std::sync::Arc;
use deckcraft_model::chart::{Chart, ChartType};
@@ -120,19 +120,7 @@ struct Pkg {
impl Pkg {
fn open(bytes: &[u8]) -> Self {
let mut zip = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut parts = BTreeMap::new();
for i in 0..zip.len() {
let mut f = zip.by_index(i).expect("entry");
if f.is_dir() {
continue;
}
let name = f.name().trim_start_matches('/').to_string();
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
parts.insert(name, data);
}
Pkg { parts }
Pkg { parts: super::zip_fixture::corpus_parts(bytes) }
}
fn replace(&self, name: &str, data: Vec<u8>) -> Vec<u8> {
+2 -14
View File
@@ -4,7 +4,7 @@
//! content parts. A second save keeps the same part names and text.
use std::collections::BTreeMap;
use std::io::{Cursor, Read, Write};
use std::io::{Cursor, Write};
use std::sync::Arc;
use deckcraft_model::anim::{AnimStart, Animation, TextBuild};
@@ -221,19 +221,7 @@ struct Pkg {
impl Pkg {
fn open(bytes: &[u8]) -> Self {
let mut zip = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut parts = BTreeMap::new();
for i in 0..zip.len() {
let mut f = zip.by_index(i).expect("entry");
if f.is_dir() {
continue;
}
let name = f.name().trim_start_matches('/').to_string();
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
parts.insert(name, data);
}
Pkg { parts }
Pkg { parts: super::zip_fixture::corpus_parts(bytes) }
}
fn bytes(&self) -> Vec<u8> {
+14 -38
View File
@@ -4,7 +4,7 @@
//! Relationship-bearing SmartArt and OLE parts stay with issue #203. Media playback options stay
//! with #74. Animation rewind (`cTn fill="remove"`) stays with #77. This file does not assert those.
use std::io::{Cursor, Read, Write};
use std::io::{Cursor, Read};
use std::sync::Arc;
use deckcraft_color::Rgba;
@@ -284,33 +284,6 @@ fn ink_and_timing_survive(q: &Presentation) {
assert!(pulse.trigger.is_none());
}
/// An exported deck with `parts` added (or replaced) and `edit` applied to every XML part.
fn with_parts(parts: &[(&str, Vec<u8>)], edit: impl Fn(&str, String) -> String) -> Vec<u8> {
let base = deckcraft_pptx::export(&defaults::new_presentation(None)).expect("export");
let mut z = zip::ZipArchive::new(Cursor::new(base)).expect("zip");
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let o = zip::write::SimpleFileOptions::default();
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
let name = f.name().to_string();
if parts.iter().any(|(n, _)| *n == name) {
continue;
}
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
if name.ends_with(".xml") || name.ends_with(".rels") {
d = edit(&name, String::from_utf8(d).expect("utf8")).into_bytes();
}
out.start_file(name, o).expect("start");
out.write_all(&d).expect("write");
}
for (name, data) in parts {
out.start_file(*name, o).expect("start");
out.write_all(data).expect("write");
}
out.finish().expect("finish").into_inner()
}
fn zip_text(bytes: &[u8], name: &str) -> String {
let mut z = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut f = z.by_name(name).unwrap_or_else(|_| panic!("no {name}"));
@@ -337,7 +310,7 @@ fn an_alternate_content_model_keeps_the_glb_and_its_poster() {
let model = glb(7);
let poster = png([200, 30, 40]);
let frame = r#"<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"><mc:Choice xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" Requires="am3d"><p:contentPart r:id="rIdModel"><p:nvContentPartPr><p:cNvPr id="60" name="Model from file"/><p:cNvContentPartPr/><p:nvPr/></p:nvContentPartPr><p:xfrm><a:off x="508000" y="635000"/><a:ext cx="1524000" cy="1143000"/></p:xfrm></p:contentPart></mc:Choice><mc:Fallback><p:pic><p:nvPicPr><p:cNvPr id="61" name="Model poster"/><p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr><p:nvPr/></p:nvPicPr><p:blipFill><a:blip r:embed="rIdPoster"/><a:stretch><a:fillRect/></a:stretch></p:blipFill><p:spPr><a:xfrm><a:off x="508000" y="635000"/><a:ext cx="1524000" cy="1143000"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr></p:pic></mc:Fallback></mc:AlternateContent>"#;
let bytes = with_parts(&[("ppt/media/model.glb", model.clone()), ("ppt/media/poster.png", poster.clone())], |name, s| {
let bytes = super::zip_fixture::with_parts(&[("ppt/media/model.glb", model.clone()), ("ppt/media/poster.png", poster.clone())], |name, s| {
if name == "ppt/slides/slide1.xml" {
s.replacen("</p:spTree>", &format!("{frame}</p:spTree>"), 1)
} else if name == "ppt/slides/_rels/slide1.xml.rels" {
@@ -368,19 +341,22 @@ fn an_alternate_content_model_keeps_the_glb_and_its_poster() {
fn an_ink_content_part_still_uses_its_fallback_picture() {
let poster = png([10, 10, 10]);
let frame = r#"<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"><mc:Choice Requires="p14"><p:contentPart r:id="rIdInk"><p:nvContentPartPr><p:cNvPr id="50" name="Ink marks"/><p:cNvContentPartPr/><p:nvPr/></p:nvContentPartPr></p:contentPart></mc:Choice><mc:Fallback><p:pic><p:nvPicPr><p:cNvPr id="51" name="Ink poster"/><p:cNvPicPr/><p:nvPr/></p:nvPicPr><p:blipFill><a:blip r:embed="rIdPoster"/><a:stretch><a:fillRect/></a:stretch></p:blipFill><p:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="914400" cy="914400"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr></p:pic></mc:Fallback></mc:AlternateContent>"#;
let bytes = with_parts(&[("ppt/ink/ink1.xml", b"<ink/>".to_vec()), ("ppt/media/ink-poster.png", poster.clone())], |name, s| {
if name == "ppt/slides/slide1.xml" {
s.replacen("</p:spTree>", &format!("{frame}</p:spTree>"), 1)
} else if name == "ppt/slides/_rels/slide1.xml.rels" {
s.replacen(
let bytes = super::zip_fixture::with_parts(
&[("ppt/ink/ink1.xml", b"<ink/>".to_vec()), ("ppt/media/ink-poster.png", poster.clone())],
|name, s| {
if name == "ppt/slides/slide1.xml" {
s.replacen("</p:spTree>", &format!("{frame}</p:spTree>"), 1)
} else if name == "ppt/slides/_rels/slide1.xml.rels" {
s.replacen(
"</Relationships>",
r#"<Relationship Id="rIdInk" Type="http://schemas.microsoft.com/office/2007/relationships/ink" Target="../ink/ink1.xml"/><Relationship Id="rIdPoster" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/ink-poster.png"/></Relationships>"#,
1,
)
} else {
s
}
});
} else {
s
}
},
);
let p = deckcraft_pptx::import(&bytes).expect("import");
assert!(p.slides[0].shapes.iter().all(|s| s.name != "Ink marks"));
let s = by_name(&p, "Ink poster");
+1 -1
View File
@@ -327,7 +327,7 @@ fn rewrite_zip_entry(bytes: &[u8], entry_name: &str, f: impl Fn(&str) -> String)
let opts = zip::write::SimpleFileOptions::default().compression_method(zip::CompressionMethod::Deflated);
for i in 0..r.len() {
let mut file = r.by_index(i).unwrap();
let name = file.name().to_string();
let name = file.name().expect("ZIP member name").to_string();
let mut buf = Vec::new();
file.read_to_end(&mut buf).unwrap();
w.start_file(&name, opts).unwrap();
+7 -3
View File
@@ -19,7 +19,7 @@ fn repack(bytes: &[u8], parts: &[(&str, String)]) -> Vec<u8> {
let opts = zip::write::SimpleFileOptions::default();
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
if parts.iter().any(|(n, _)| *n == name) {
continue;
}
@@ -253,8 +253,12 @@ fn themes_masters_and_layouts_survive_a_round_trip() {
// A second save keeps the same theme and master parts.
let names = |bytes: &[u8]| {
let z = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut v: Vec<String> =
z.file_names().filter(|n| n.contains("theme") || n.contains("slideMaster") || n.contains("slideLayout")).map(str::to_string).collect();
let mut v: Vec<String> = z
.file_names()
.map(|name| name.expect("ZIP member name"))
.filter(|n| n.contains("theme") || n.contains("slideMaster") || n.contains("slideLayout"))
.map(std::borrow::Cow::into_owned)
.collect();
v.sort();
v
};
+7 -25
View File
@@ -1,30 +1,11 @@
//! Fills read from decks written by other tools.
use std::io::{Cursor, Read, Write};
use std::io::Cursor;
use deckcraft_geom::Xfrm;
use deckcraft_model::style::{Fill, PictureFill, PictureMode};
use deckcraft_model::{Shape, ShapeId, defaults};
/// `bytes` with `edit` applied to every slide part.
fn edit_slides(bytes: &[u8], edit: impl Fn(String) -> String) -> Vec<u8> {
let mut z = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let o = zip::write::SimpleFileOptions::default();
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
let name = f.name().to_string();
if name.starts_with("ppt/slides/slide") && name.ends_with(".xml") {
d = edit(String::from_utf8(d).expect("utf8")).into_bytes();
}
out.start_file(name, o).expect("start");
out.write_all(&d).expect("write");
}
out.finish().expect("finish").into_inner()
}
fn png() -> Vec<u8> {
let mut out = Cursor::new(vec![]);
image::DynamicImage::ImageRgb8(image::RgbImage::from_pixel(4, 4, image::Rgb([10, 200, 30])))
@@ -62,7 +43,7 @@ fn textured_mode(bytes: &[u8]) -> PictureMode {
fn a_shape_picture_fill_without_stretch_or_tile_tiles() {
// tdf#128596: `<a:blipFill><a:blip/></a:blipFill>` on a shape, as some tools write it;
// PowerPoint tiles the picture at its own size.
let bare = edit_slides(&deck(), |s| {
let bare = super::zip_fixture::edit_slides(&deck(), |s| {
let s = regex_free_strip(&s, "<a:stretch>", "</a:stretch>");
assert!(!s.contains("<a:stretch"), "the test deck lost its stretch");
s
@@ -167,8 +148,9 @@ fn a_gradient_tile_rect_is_read_and_round_trips() {
let s = q.slides[0].shapes.iter().find(|s| s.name == "Corner").expect("shape");
assert_eq!(s.fill, Some(Fill::Gradient(g)));
// As written by PowerPoint (attributes it leaves out are 0).
let edited =
edit_slides(&bytes, |x| x.replace("<a:tileRect l=\"-100000\" t=\"-100000\" r=\"0\" b=\"0\"/>", "<a:tileRect l=\"-100000\" t=\"-100000\"/>"));
let edited = super::zip_fixture::edit_slides(&bytes, |x| {
x.replace("<a:tileRect l=\"-100000\" t=\"-100000\" r=\"0\" b=\"0\"/>", "<a:tileRect l=\"-100000\" t=\"-100000\"/>")
});
let q = deckcraft_pptx::import(&edited).expect("import");
let s = q.slides[0].shapes.iter().find(|s| s.name == "Corner").expect("shape");
assert!(matches!(&s.fill, Some(Fill::Gradient(g)) if g.tile == [-1.0, -1.0, 0.0, 0.0]), "{:?}", s.fill);
@@ -200,7 +182,7 @@ fn a_table_naming_no_style_is_drawn_with_the_table_grid() {
// Written with its style, it reads back as written.
assert_eq!(style(&bytes), "none");
// Without a:tableStyleId PowerPoint draws thin dark grid lines.
let bare = edit_slides(&bytes, |x| {
let bare = super::zip_fixture::edit_slides(&bytes, |x| {
let (Some(a), Some(b)) = (x.find("<a:tableStyleId>"), x.find("</a:tableStyleId>")) else { return x };
format!("{}{}", &x[..a], &x[b + "</a:tableStyleId>".len()..])
});
@@ -235,7 +217,7 @@ fn black_and_white_and_inverted_alpha_pictures_round_trip() {
#[test]
fn an_upright_picture_fill_round_trips() {
let bytes = deck();
let edited = edit_slides(&bytes, |x| x.replacen("rotWithShape=\"1\"", "rotWithShape=\"0\"", 1));
let edited = super::zip_fixture::edit_slides(&bytes, |x| x.replacen("rotWithShape=\"1\"", "rotWithShape=\"0\"", 1));
let q = deckcraft_pptx::import(&edited).expect("import");
let s = q.slides[0].shapes.iter().find(|s| s.name == "Textured").expect("shape");
let Some(Fill::Picture(pf)) = &s.fill else { panic!("{:?}", s.fill) };
+1 -1
View File
@@ -21,7 +21,7 @@ fn deck() -> Vec<u8> {
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
for i in 0..src.len() {
let mut f = src.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = Vec::new();
f.read_to_end(&mut data).expect("read");
let edit = |d: Vec<u8>, at: &str, add: &str| String::from_utf8(d).expect("utf8").replacen(at, &format!("{add}{at}"), 1).into_bytes();
+6 -28
View File
@@ -1,6 +1,6 @@
//! Lock and hidden state (Selection pane): what PowerPoint writes for Lock, and what it reads as locked.
use std::io::{Cursor, Read, Write};
use std::io::Cursor;
use deckcraft_geom::Xfrm;
use deckcraft_model::style::PictureFill;
@@ -78,30 +78,8 @@ fn find<'a>(s: &'a Slide, name: &str) -> &'a Shape {
found.unwrap_or_else(|| panic!("no shape {name}"))
}
fn entries(bytes: &[u8]) -> Vec<(String, Vec<u8>)> {
let mut z = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
(0..z.len())
.map(|i| {
let mut f = z.by_index(i).expect("entry");
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
(f.name().to_string(), d)
})
.collect()
}
fn rezip(es: &[(String, Vec<u8>)]) -> Vec<u8> {
let mut z = zip::ZipWriter::new(Cursor::new(Vec::new()));
let o = zip::write::SimpleFileOptions::default();
for (n, d) in es {
z.start_file(n.as_str(), o).expect("start");
z.write_all(d).expect("write");
}
z.finish().expect("finish").into_inner()
}
fn slide1_xml(bytes: &[u8]) -> String {
let es = entries(bytes);
let es = super::zip_fixture::entries(bytes);
let (_, d) = es.iter().find(|(n, _)| n == "ppt/slides/slide1.xml").expect("slide1");
String::from_utf8(d.clone()).expect("utf8")
}
@@ -168,7 +146,7 @@ fn partial_locks_are_not_lock() {
if let Some(s) = p.slides.first_mut() {
std::sync::Arc::make_mut(s).shapes = vec![a, b, c, d];
}
let mut es = entries(&deckcraft_pptx::export(&p).expect("export"));
let mut es = super::zip_fixture::entries(&deckcraft_pptx::export(&p).expect("export"));
let slide = es.iter_mut().find(|(n, _)| n == "ppt/slides/slide1.xml").expect("slide1");
let xml = String::from_utf8(slide.1.clone()).expect("utf8");
let swap = |xml: String, name: &str, locks: &str| {
@@ -186,7 +164,7 @@ fn partial_locks_are_not_lock() {
let xml =
swap(xml, "C", r#"<a:spLocks noGrp="1" noRot="1" noMove="1" noResize="1" noEditPoints="1" noAdjustHandles="1" noChangeShapeType="1"/>"#);
slide.1 = xml.into_bytes();
let q = deckcraft_pptx::import(&rezip(&es)).expect("import");
let q = deckcraft_pptx::import(&super::zip_fixture::zip_of(&es)).expect("import");
let s = &q.slides[0];
assert!(!find(s, "A").locked);
assert!(!find(s, "B").locked);
@@ -202,10 +180,10 @@ fn empty_locks_element_is_unlocked() {
if let Some(s) = p.slides.first_mut() {
std::sync::Arc::make_mut(s).shapes = vec![a];
}
let mut es = entries(&deckcraft_pptx::export(&p).expect("export"));
let mut es = super::zip_fixture::entries(&deckcraft_pptx::export(&p).expect("export"));
let slide = es.iter_mut().find(|(n, _)| n == "ppt/slides/slide1.xml").expect("slide1");
let xml = String::from_utf8(slide.1.clone()).expect("utf8").replacen("<p:cNvSpPr/>", "<p:cNvSpPr><a:spLocks/></p:cNvSpPr>", 1);
slide.1 = xml.into_bytes();
let q = deckcraft_pptx::import(&rezip(&es)).expect("import");
let q = deckcraft_pptx::import(&super::zip_fixture::zip_of(&es)).expect("import");
assert!(!find(&q.slides[0], "A").locked);
}
+1
View File
@@ -30,5 +30,6 @@ mod table_styles;
mod tags;
mod transition_xml;
mod trigger_steps;
mod zip_fixture;
mod picture_backing;
+1 -1
View File
@@ -26,7 +26,7 @@ fn entries(bytes: &[u8]) -> Vec<(String, Vec<u8>)> {
let mut f = z.by_index(i).expect("entry");
let mut d = vec![];
std::io::Read::read_to_end(&mut f, &mut d).expect("read");
(f.name().to_string(), d)
(f.name().expect("ZIP member name").to_string(), d)
})
.collect()
}
+1 -1
View File
@@ -35,7 +35,7 @@ fn imported(body_style: &str) -> Presentation {
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
for i in 0..z.len() {
let mut part = z.by_index(i).expect("part");
let name = part.name().to_string();
let name = part.name().expect("ZIP member name").to_string();
let mut data = Vec::new();
part.read_to_end(&mut data).expect("read");
if name.starts_with("ppt/slideMasters/slideMaster") && name.ends_with(".xml") {
+2 -26
View File
@@ -1,35 +1,11 @@
//! Equations whose math namespace is declared above the equation: on the slide root or on a wrapper.
use std::io::{Cursor, Read, Write};
use deckcraft_geom::Xfrm;
use deckcraft_model::text::{Paragraph, Run, RunKind, RunProps, TextBody};
use deckcraft_model::{Shape, ShapeId, defaults};
const NS_M: &str = r#"xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math""#;
fn entries(bytes: &[u8]) -> Vec<(String, Vec<u8>)> {
let mut z = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
(0..z.len())
.map(|i| {
let mut f = z.by_index(i).expect("entry");
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
(f.name().to_string(), d)
})
.collect()
}
fn rezip(es: &[(String, Vec<u8>)]) -> Vec<u8> {
let mut z = zip::ZipWriter::new(Cursor::new(Vec::new()));
let o = zip::write::SimpleFileOptions::default();
for (n, d) in es {
z.start_file(n.as_str(), o).expect("start");
z.write_all(d).expect("write");
}
z.finish().expect("finish").into_inner()
}
/// Export an equation, move its `xmlns:m` from the equation to the element `host` opens, and
/// return the OMML read back.
fn moved_to(host: &str) -> String {
@@ -52,7 +28,7 @@ fn moved_to(host: &str) -> String {
if let Some(s) = p.slides.first_mut() {
std::sync::Arc::make_mut(s).shapes = vec![eq];
}
let mut es = entries(&deckcraft_pptx::export(&p).expect("export"));
let mut es = super::zip_fixture::entries(&deckcraft_pptx::export(&p).expect("export"));
let slide = es.iter_mut().find(|(n, _)| n == "ppt/slides/slide1.xml").expect("slide1");
let xml = String::from_utf8(slide.1.clone()).expect("utf8");
assert!(xml.contains(host), "{xml}");
@@ -60,7 +36,7 @@ fn moved_to(host: &str) -> String {
assert_eq!(xml.matches(NS_M).count(), 1);
slide.1 = xml.into_bytes();
let q = deckcraft_pptx::import(&rezip(&es)).expect("import");
let q = deckcraft_pptx::import(&super::zip_fixture::zip_of(&es)).expect("import");
let shape = q.slides[0].shapes.iter().find(|s| s.name == "Equation").expect("shape");
let run = shape.text.as_ref().and_then(|t| t.paragraphs.first()).and_then(|p| p.runs.first()).expect("run");
match &run.kind {
+2 -2
View File
@@ -40,13 +40,13 @@ fn clips(nodes: impl Fn(u32, u32) -> String) -> Vec<MediaClip> {
let mut f = z.by_index(i).expect("entry");
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
if f.name() == "ppt/slides/slide1.xml" {
if f.name().expect("ZIP member name") == "ppt/slides/slide1.xml" {
let s = String::from_utf8(d).expect("utf8");
assert!(!s.contains("<p:timing"));
let end = s.rfind("</p:sld>").expect("end");
d = format!("{}{timing}{}", &s[..end], &s[end..]).into_bytes();
}
out.start_file(f.name(), zip::write::SimpleFileOptions::default()).expect("start");
out.start_file(f.name().expect("ZIP member name"), zip::write::SimpleFileOptions::default()).expect("start");
out.write_all(&d).expect("write");
}
let q = deckcraft_pptx::import(&out.finish().expect("finish").into_inner()).expect("import");
+3 -35
View File
@@ -1,7 +1,7 @@
//! Speaker notes keep their run and paragraph formatting: a bold heading, indented points with
//! custom bullets, plain lines.
use std::io::{Cursor, Read, Write};
use std::io::{Cursor, Read};
use std::sync::Arc;
use deckcraft_model::defaults;
@@ -21,23 +21,7 @@ fn empty_notes_deck() -> Vec<u8> {
let mut p = defaults::new_presentation(None);
Arc::make_mut(&mut p.slides[0]).notes = TextBody::from_text("placeholder");
let bytes = deckcraft_pptx::export(&p).expect("export");
let mut src = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let mut found = false;
for i in 0..src.len() {
let mut f = src.by_index(i).expect("entry");
let name = f.name().to_string();
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
if name == NOTES {
data = EMPTY_NOTES_XML.as_bytes().to_vec();
found = true;
}
out.start_file(name, zip::write::SimpleFileOptions::default()).expect("start");
out.write_all(&data).expect("write");
}
assert!(found, "the export has no {NOTES}");
out.finish().expect("finish").into_inner()
super::zip_fixture::replace_part(bytes, NOTES, EMPTY_NOTES_XML.as_bytes())
}
/// A deck with one notes slide, its notes replaced by [`NOTES_XML`].
@@ -45,23 +29,7 @@ fn deck() -> Vec<u8> {
let mut p = defaults::new_presentation(None);
Arc::make_mut(&mut p.slides[0]).notes = TextBody::from_text("placeholder");
let bytes = deckcraft_pptx::export(&p).expect("export");
let mut src = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let mut found = false;
for i in 0..src.len() {
let mut f = src.by_index(i).expect("entry");
let name = f.name().to_string();
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
if name == NOTES {
data = NOTES_XML.as_bytes().to_vec();
found = true;
}
out.start_file(name, zip::write::SimpleFileOptions::default()).expect("start");
out.write_all(&data).expect("write");
}
assert!(found, "the export has no {NOTES}");
out.finish().expect("finish").into_inner()
super::zip_fixture::replace_part(bytes, NOTES, NOTES_XML.as_bytes())
}
fn assert_formatted(notes: &TextBody) {
+4 -31
View File
@@ -1,8 +1,8 @@
//! Embedded (OLE) objects and their preview pictures, as other versions of PowerPoint write them.
use std::io::{Cursor, Read, Write};
use std::io::Cursor;
use deckcraft_model::{ShapeKind, defaults};
use deckcraft_model::ShapeKind;
fn png() -> Vec<u8> {
let mut out = Cursor::new(vec![]);
@@ -12,33 +12,6 @@ fn png() -> Vec<u8> {
out.into_inner()
}
/// An exported deck with `parts` added (or replaced) and `edit` applied to every part's text.
fn with_parts(parts: &[(&str, Vec<u8>)], edit: impl Fn(&str, String) -> String) -> Vec<u8> {
let base = deckcraft_pptx::export(&defaults::new_presentation(None)).expect("export");
let mut z = zip::ZipArchive::new(Cursor::new(base)).expect("zip");
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let o = zip::write::SimpleFileOptions::default();
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
let name = f.name().to_string();
if parts.iter().any(|(n, _)| *n == name) {
continue;
}
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
if name.ends_with(".xml") || name.ends_with(".rels") {
d = edit(&name, String::from_utf8(d).expect("utf8")).into_bytes();
}
out.start_file(name, o).expect("start");
out.write_all(&d).expect("write");
}
for (name, data) in parts {
out.start_file(*name, o).expect("start");
out.write_all(data).expect("write");
}
out.finish().expect("finish").into_inner()
}
/// PowerPoint 2007 style: `p:oleObj spid` with no `p:pic`; the preview is the `v:imagedata` of the
/// VML shape with that id in the slide's legacy drawing part.
fn ole_deck(spid_in_vml: &str) -> Vec<u8> {
@@ -51,7 +24,7 @@ fn ole_deck(spid_in_vml: &str) -> Vec<u8> {
let vml_rels = r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/preview.png"/><Relationship Id="rId7" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/other.png"/></Relationships>"#;
let frame = r#"<p:graphicFrame><p:nvGraphicFramePr><p:cNvPr id="900" name="Object 3"/><p:cNvGraphicFramePr/><p:nvPr/></p:nvGraphicFramePr><p:xfrm><a:off x="0" y="0"/><a:ext cx="1828800" cy="914400"/></p:xfrm><a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/presentationml/2006/ole"><p:oleObj spid="_x0000_s681987" name="Slide" r:id="rIdOle" imgW="4664160" imgH="3497400" progId="PowerPoint.Slide.8"><p:embed/></p:oleObj></a:graphicData></a:graphic></p:graphicFrame>"#;
with_parts(
super::zip_fixture::with_parts(
&[
("ppt/drawings/vmlDrawing1.vml", vml.into_bytes()),
("ppt/drawings/_rels/vmlDrawing1.vml.rels", vml_rels.as_bytes().to_vec()),
@@ -107,7 +80,7 @@ fn an_ole_objects_fallback_picture_gives_it_its_fill_and_outline() {
)
};
let deck = |frame: String| {
with_parts(&[("ppt/media/eq.png", png()), ("ppt/embeddings/oleObject1.bin", vec![0; 16])], move |name, s| {
super::zip_fixture::with_parts(&[("ppt/media/eq.png", png()), ("ppt/embeddings/oleObject1.bin", vec![0; 16])], move |name, s| {
if name == "ppt/slides/slide1.xml" {
s.replacen("</p:spTree>", &format!("{frame}</p:spTree>"), 1)
} else if name == "ppt/slides/_rels/slide1.xml.rels" {
+1 -1
View File
@@ -40,7 +40,7 @@ fn deck_with(frames: &str) -> Vec<u8> {
let mut f = z.by_index(i).expect("entry");
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
if name == "ppt/slides/slide1.xml" {
let s = String::from_utf8(d).expect("utf8");
let at = s.rfind("</p:spTree>").expect("spTree");
+1 -1
View File
@@ -41,7 +41,7 @@ fn import_with_timing(build: impl Fn(&[u32]) -> String) -> Vec<(String, AnimStar
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
if name == "ppt/slides/slide1.xml" {
+3 -23
View File
@@ -1,29 +1,9 @@
//! Placeholder inheritance in decks written by PowerPoint.
use std::io::{Cursor, Read, Write};
use deckcraft_geom::Xfrm;
use deckcraft_model::style::PictureFill;
use deckcraft_model::{Geom, PhType, Placeholder, Shape, ShapeId, ShapeKind, defaults};
/// `bytes` with `edit` applied to every slide part.
fn edit_slides(bytes: &[u8], edit: impl Fn(String) -> String) -> Vec<u8> {
let mut z = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let o = zip::write::SimpleFileOptions::default();
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
let name = f.name().to_string();
if name.starts_with("ppt/slides/slide") && name.ends_with(".xml") {
d = edit(String::from_utf8(d).expect("utf8")).into_bytes();
}
out.start_file(name, o).expect("start");
out.write_all(&d).expect("write");
}
out.finish().expect("finish").into_inner()
}
use std::io::Cursor;
#[test]
fn a_placeholder_without_geometry_takes_its_layouts() {
@@ -40,7 +20,7 @@ fn a_placeholder_without_geometry_takes_its_layouts() {
}
let bytes = deckcraft_pptx::export(&p).expect("export");
// Strip the slide's own geometry, as PowerPoint writes inheriting placeholders.
let bare = edit_slides(&bytes, |s| {
let bare = super::zip_fixture::edit_slides(&bytes, |s| {
let mut s = s;
while let Some(i) = s.find("<a:prstGeom") {
let Some(j) = s[i..].find("</a:prstGeom>").map(|j| j + i + "</a:prstGeom>".len()) else { break };
@@ -97,7 +77,7 @@ fn a_picture_placeholder_without_geometry_takes_its_layouts() {
};
std::sync::Arc::make_mut(&mut p.slides[0]).shapes = vec![pic];
let bytes = deckcraft_pptx::export(&p).expect("export");
let bare = edit_slides(&bytes, |mut s| {
let bare = super::zip_fixture::edit_slides(&bytes, |mut s| {
while let Some(i) = s.find("<a:prstGeom") {
let Some(j) = s[i..].find("</a:prstGeom>").map(|j| j + i + "</a:prstGeom>".len()) else { break };
s.replace_range(i..j, "");
+17 -5
View File
@@ -1175,7 +1175,7 @@ fn wordart_warps_and_their_adjusts_round_trip() {
let mut out = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
for i in 0..zip.len() {
let mut f = zip.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = vec![];
std::io::Read::read_to_end(&mut f, &mut data).expect("read");
if name == "ppt/slides/slide1.xml" {
@@ -1309,7 +1309,7 @@ fn transition_defaults_read_like_powerpoint() {
let mut out = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
for i in 0..zip.len() {
let mut f = zip.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = vec![];
std::io::Read::read_to_end(&mut f, &mut data).expect("read");
if name == "ppt/slides/slide1.xml" {
@@ -1513,7 +1513,7 @@ fn an_embedded_font_list_already_in_the_package_is_read() {
let mut out = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
for i in 0..zip.len() {
let mut f = zip.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = vec![];
std::io::Read::read_to_end(&mut f, &mut data).expect("read");
if name == "ppt/presentation.xml" {
@@ -1657,7 +1657,7 @@ fn patch_slides(bytes: Vec<u8>, from: &str, to: &str) -> Vec<u8> {
let mut out = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
if name.starts_with("ppt/slides/slide") && name.ends_with(".xml") {
@@ -1806,7 +1806,7 @@ fn repack(pkg: &[u8], edit: impl Fn(&str, String) -> String, extra: &[(&str, &[u
let opts = zip::write::SimpleFileOptions::default();
for i in 0..z.len() {
let mut f = z.by_index(i).unwrap();
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = vec![];
f.read_to_end(&mut data).unwrap();
if name.ends_with(".xml") || name.ends_with(".rels") {
@@ -2374,6 +2374,15 @@ fn pptx_potx_ppsx_export_parity_preserves_masters_charts_themes_and_timing() {
..Default::default()
});
let edited_values = vec![Some(111.5), Some(222.25), Some(333.75), Some(444.0)];
let chart_slide_idx = p.slides.iter().position(|sl| sl.shapes.iter().any(|s| s.name == "Chart 0")).expect("chart slide");
{
let ch_shape = Arc::make_mut(&mut p.slides[chart_slide_idx]).shapes.iter_mut().find(|s| s.name == "Chart 0").expect("Chart 0");
ch_shape.name = "Revenue Chart".into();
let ShapeKind::Chart(ch) = &mut ch_shape.kind else { panic!("expected chart") };
ch.series[0].values = edited_values.clone();
}
for (ext, expected_ct) in [
("pptx", "presentationml.presentation.main+xml"),
("potx", "presentationml.template.main+xml"),
@@ -2392,5 +2401,8 @@ fn pptx_potx_ppsx_export_parity_preserves_masters_charts_themes_and_timing() {
let cue = reopened.slides[0].shapes.iter().find(|s| s.name == "Cue").expect("cue");
let ShapeKind::Media(clip) = &cue.kind else { panic!("expected media") };
assert!(clip.autoplay && clip.loop_play && (clip.volume - 0.5).abs() < 1e-3);
let chart_shape = reopened.slides[chart_slide_idx].shapes.iter().find(|s| s.name == "Revenue Chart").expect("named chart");
let ShapeKind::Chart(chart) = &chart_shape.kind else { panic!("expected chart") };
assert_eq!(chart.series[0].values, edited_values, "{ext}");
}
}
+2 -26
View File
@@ -3,8 +3,6 @@
//! The deck is built here: an export of a new presentation with a SmartArt frame, data part and
//! drawing part written by the test.
use std::io::{Cursor, Read, Write};
use deckcraft_engine::render::place_slide;
use deckcraft_geom::{Point, Rect};
use deckcraft_model::{Presentation, ShapeKind, defaults};
@@ -34,28 +32,6 @@ fn drawing_shape(prst: &str, shape: (f64, f64, f64, f64, f64), text_rect: (f64,
)
}
fn entries(bytes: &[u8]) -> Vec<(String, Vec<u8>)> {
let mut z = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
(0..z.len())
.map(|i| {
let mut f = z.by_index(i).expect("entry");
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
(f.name().to_string(), d)
})
.collect()
}
fn zip_of(files: &[(String, Vec<u8>)]) -> Vec<u8> {
let mut z = zip::ZipWriter::new(Cursor::new(Vec::new()));
let o = zip::write::SimpleFileOptions::default();
for (n, d) in files {
z.start_file(n.as_str(), o).expect("start");
z.write_all(d).expect("write");
}
z.finish().expect("finish").into_inner()
}
fn replace(files: &mut [(String, Vec<u8>)], name: &str, from: &str, to: &str) {
let (_, d) = files.iter_mut().find(|(n, _)| n == name).unwrap_or_else(|| panic!("{name} missing"));
let s = String::from_utf8(d.clone()).expect("utf8");
@@ -65,7 +41,7 @@ fn replace(files: &mut [(String, Vec<u8>)], name: &str, from: &str, to: &str) {
/// A deck whose first slide holds a SmartArt frame drawn by `shapes`.
fn smartart_deck(shapes: &[String]) -> Vec<u8> {
let mut files = entries(&deckcraft_pptx::export(&defaults::new_presentation(None)).expect("export"));
let mut files = super::zip_fixture::entries(&deckcraft_pptx::export(&defaults::new_presentation(None)).expect("export"));
let (fx, fy, fw, fh) = FRAME;
let frame = format!(
r#"<p:graphicFrame><p:nvGraphicFramePr><p:cNvPr id="90" name="Diagram 1"/><p:cNvGraphicFramePr/><p:nvPr/></p:nvGraphicFramePr><p:xfrm><a:off x="{}" y="{}"/><a:ext cx="{}" cy="{}"/></p:xfrm><a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/diagram"><dgm:relIds xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram" r:dm="rIdDm" r:lo="rIdLo" r:qs="rIdQs" r:cs="rIdCs"/></a:graphicData></a:graphic></p:graphicFrame></p:spTree>"#,
@@ -90,7 +66,7 @@ fn smartart_deck(shapes: &[String]) -> Vec<u8> {
);
files.push(("ppt/diagrams/data1.xml".into(), data.as_bytes().to_vec()));
files.push(("ppt/diagrams/drawing1.xml".into(), drawing.into_bytes()));
zip_of(&files)
super::zip_fixture::zip_of(&files)
}
/// Each text of slide 1 with the slide-space box it is laid out in (insets applied), the number of
+1 -1
View File
@@ -21,7 +21,7 @@ fn content_types_last(bytes: &[u8]) -> Vec<u8> {
let stored = SimpleFileOptions::default().compression_method(zip::CompressionMethod::Stored);
out.start_file("ppt/media/padding.bin", stored).expect("start");
out.write_all(&vec![0u8; 64 * 1024]).expect("padding");
let names: Vec<String> = (0..src.len()).map(|i| src.by_index(i).expect("entry").name().to_string()).collect();
let names: Vec<String> = (0..src.len()).map(|i| src.by_index(i).expect("entry").name().expect("ZIP member name").into_owned()).collect();
for name in names.iter().filter(|n| *n != "[Content_Types].xml").chain(std::iter::once(&"[Content_Types].xml".to_string())) {
let mut data = Vec::new();
src.by_name(name).expect("by_name").read_to_end(&mut data).expect("read");
+1 -1
View File
@@ -40,7 +40,7 @@ fn table_deck() -> Vec<u8> {
let mut f = z.by_index(i).expect("entry");
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
if name == "ppt/tableStyles.xml" {
d = style_xml().into_bytes();
} else if name.starts_with("ppt/slides/slide") && name.ends_with(".xml") {
+3 -3
View File
@@ -26,7 +26,7 @@ fn tags_survive_round_trip() {
let mut ct = String::new();
zip.by_name("[Content_Types].xml").expect("ct").read_to_string(&mut ct).expect("read");
assert!(ct.contains("presentationml.tags+xml"));
assert_eq!((0..zip.len()).filter(|i| zip.by_index(*i).is_ok_and(|f| f.name().starts_with("ppt/tags/"))).count(), 3);
assert_eq!((0..zip.len()).filter(|i| zip.by_index(*i).is_ok_and(|f| f.name().expect("ZIP member name").starts_with("ppt/tags/"))).count(), 3);
let back = deckcraft_pptx::import(&bytes).expect("import");
assert_eq!(back.tags, p.tags);
@@ -67,7 +67,7 @@ fn a_tags_part_listed_many_times_is_copied_once_and_capped() {
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
for i in 0..zip.len() {
let mut f = zip.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
out.start_file(&name, zip::write::SimpleFileOptions::default()).expect("start");
@@ -131,7 +131,7 @@ fn new_tag_parts_are_not_parsed_or_cached_after_the_budget_is_exhausted() {
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
for i in 0..zip.len() {
let mut f = zip.by_index(i).expect("entry");
let name = f.name().to_string();
let name = f.name().expect("ZIP member name").to_string();
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
out.start_file(&name, zip::write::SimpleFileOptions::default()).expect("start");
+2 -2
View File
@@ -21,7 +21,7 @@ fn import_with(xml: &str) -> Transition {
let mut f = z.by_index(i).expect("entry");
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
if f.name() == "ppt/slides/slide1.xml" {
if f.name().expect("ZIP member name") == "ppt/slides/slide1.xml" {
let s = String::from_utf8(d).expect("utf8");
let t = s.find("<p:transition").expect("transition");
let a = s[..t].rfind("<mc:AlternateContent").expect("mc start");
@@ -29,7 +29,7 @@ fn import_with(xml: &str) -> Transition {
let b = t + s[t..].find(end).expect("mc end") + end.len();
d = format!("{}{xml}{}", &s[..a], &s[b..]).into_bytes();
}
out.start_file(f.name(), o).expect("start");
out.start_file(f.name().expect("ZIP member name"), o).expect("start");
out.write_all(&d).expect("write");
}
let bytes = out.finish().expect("finish").into_inner();
+109
View File
@@ -0,0 +1,109 @@
//! Ordered ZIP helpers for the in-memory PPTX fixtures in this integration binary.
use std::io::{Cursor, Read, Seek, Write};
use deckcraft_model::defaults;
fn payload_first_entry(archive: &mut zip::ZipArchive<impl Read + Seek>, index: usize) -> (String, Vec<u8>) {
let mut entry = archive.by_index(index).expect("entry");
let mut data = Vec::new();
entry.read_to_end(&mut data).expect("read");
(entry.name().expect("ZIP member name").into_owned(), data)
}
pub(super) fn entries(bytes: &[u8]) -> Vec<(String, Vec<u8>)> {
let mut archive = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
(0..archive.len()).map(|index| payload_first_entry(&mut archive, index)).collect()
}
pub(super) fn zip_of(files: &[(String, Vec<u8>)]) -> Vec<u8> {
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let options = zip::write::SimpleFileOptions::default();
for (name, data) in files {
out.start_file(name.as_str(), options).expect("start");
out.write_all(data).expect("write");
}
out.finish().expect("finish").into_inner()
}
/// `bytes` with `edit` applied to every slide part.
pub(super) fn edit_slides(bytes: &[u8], edit: impl Fn(String) -> String) -> Vec<u8> {
let mut z = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let o = zip::write::SimpleFileOptions::default();
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
let name = f.name().expect("ZIP member name").to_string();
if name.starts_with("ppt/slides/slide") && name.ends_with(".xml") {
d = edit(String::from_utf8(d).expect("utf8")).into_bytes();
}
out.start_file(name, o).expect("start");
out.write_all(&d).expect("write");
}
out.finish().expect("finish").into_inner()
}
pub(super) fn replace_part(bytes: Vec<u8>, part: &str, replacement: &[u8]) -> Vec<u8> {
let mut src = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let mut found = false;
for i in 0..src.len() {
let mut f = src.by_index(i).expect("entry");
let name = f.name().expect("ZIP member name").to_string();
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
if name == part {
data = replacement.to_vec();
found = true;
}
out.start_file(name, zip::write::SimpleFileOptions::default()).expect("start");
out.write_all(&data).expect("write");
}
assert!(found, "the export has no {part}");
out.finish().expect("finish").into_inner()
}
/// An exported deck with `parts` added (or replaced) and `edit` applied to every XML part.
pub(super) fn with_parts(parts: &[(&str, Vec<u8>)], edit: impl Fn(&str, String) -> String) -> Vec<u8> {
let base = deckcraft_pptx::export(&defaults::new_presentation(None)).expect("export");
let mut z = zip::ZipArchive::new(Cursor::new(base)).expect("zip");
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let o = zip::write::SimpleFileOptions::default();
for i in 0..z.len() {
let mut f = z.by_index(i).expect("entry");
let name = f.name().expect("ZIP member name").to_string();
if parts.iter().any(|(n, _)| *n == name) {
continue;
}
let mut d = vec![];
f.read_to_end(&mut d).expect("read");
if name.ends_with(".xml") || name.ends_with(".rels") {
d = edit(&name, String::from_utf8(d).expect("utf8")).into_bytes();
}
out.start_file(name, o).expect("start");
out.write_all(&d).expect("write");
}
for (name, data) in parts {
out.start_file(*name, o).expect("start");
out.write_all(data).expect("write");
}
out.finish().expect("finish").into_inner()
}
pub(super) fn corpus_parts(bytes: &[u8]) -> std::collections::BTreeMap<String, Vec<u8>> {
let mut zip = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut parts = std::collections::BTreeMap::new();
for i in 0..zip.len() {
let mut f = zip.by_index(i).expect("entry");
if f.is_dir() {
continue;
}
let name = f.name().expect("ZIP member name").trim_start_matches('/').to_string();
let mut data = vec![];
f.read_to_end(&mut data).expect("read");
parts.insert(name, data);
}
parts
}
@@ -0,0 +1,24 @@
use std::io::{Cursor, Read, Write};
use deckcraft_model::Presentation;
/// Rewrite the chart part's XML through `f` and re-import the deck.
pub(super) fn reimport(bytes: &[u8], f: impl Fn(&str) -> String) -> Presentation {
let mut zip = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
let opts = zip::write::SimpleFileOptions::default();
for i in 0..zip.len() {
let mut entry = zip.by_index(i).expect("entry");
let name = entry.name().expect("ZIP member name").to_string();
let mut data = vec![];
entry.read_to_end(&mut data).expect("read");
if name.starts_with("ppt/charts/chart") && name.ends_with(".xml") && !name.contains("_rels") {
let xml = String::from_utf8(data).expect("chart xml");
data = f(&xml).into_bytes();
}
out.start_file(&name, opts).expect("start");
out.write_all(&data).expect("write");
}
let patched = out.finish().expect("finish").into_inner();
deckcraft_pptx::import(&patched).expect("import")
}
+62
View File
@@ -3404,3 +3404,65 @@ fn a_shape_whose_outline_is_not_finite_is_not_drawable() {
quad.paths[0].path = path;
assert!(!crate::geometry::drawable(&quad, m, 100.0, 50.0));
}
/// A WMF without a placeable header (the frame comes from its window records) holding `records`
/// (function, parameter bytes).
fn wmf_bare(records: &[(u16, Vec<u8>)]) -> Vec<u8> {
let mut body = Vec::new();
let mut max_words = 3u32;
for (func, params) in records {
let words = (6 + params.len() as u32).div_ceil(2);
max_words = max_words.max(words);
body.extend(words.to_le_bytes());
body.extend(func.to_le_bytes());
body.extend(params);
if params.len() % 2 == 1 {
body.push(0);
}
}
body.extend([3, 0, 0, 0, 0, 0]);
let mut f = Vec::new();
for v in [1u16, 9, 0x300] {
f.extend(v.to_le_bytes());
}
f.extend((((18 + body.len()) / 2) as u32).to_le_bytes());
f.extend(1u16.to_le_bytes());
f.extend(max_words.to_le_bytes());
f.extend(0u16.to_le_bytes());
f.extend(body);
f
}
#[test]
fn metafile_scaled_viewport_places_each_sub_picture_in_its_half() {
// #2069: an 800 × 400 frame drawn as two sub-pictures. Each saves the DC, halves the viewport
// width with SCALEVIEWPORTEXT, sets its own 400 × 400 window (the second shifted right by its
// window origin), draws a circle and restores the DC: red on the left, blue on the right.
let sub = |origin_x: i32, colorref: u32| {
let mut brush = 0u16.to_le_bytes().to_vec();
brush.extend(colorref.to_le_bytes());
brush.extend(0u16.to_le_bytes());
vec![
(0x001E, vec![]), // SAVEDC
(0x0103, i16s(&[8])), // SETMAPMODE MM_ANISOTROPIC
(0x0412, i16s(&[1, 1, 2, 1])), // SCALEVIEWPORTEXT y 1/1, x 1/2
(0x020B, i16s(&[0, origin_x])), // SETWINDOWORG
(0x020C, i16s(&[400, 400])), // SETWINDOWEXT
(0x02FC, brush), // CREATEBRUSHINDIRECT
(0x012D, i16s(&[0])), // SELECTOBJECT
(0x0418, i16s(&[380, 380, 20, 20])), // ELLIPSE
(0x0127, i16s(&[-1])), // RESTOREDC
(0x01F0, i16s(&[0])), // DELETEOBJECT
]
};
let mut recs = vec![(0x020B, i16s(&[0, 0])), (0x020C, i16s(&[400, 800]))];
recs.extend(sub(0, 0x0000_00FF));
recs.extend(sub(-400, 0x00FF_0000));
let img = crate::metafile::rasterize(&wmf_bare(&recs), 200).expect("raster");
assert_eq!(img.dimensions(), (200, 100));
let red = |p: &image::Rgba<u8>| p[0] > 200 && p[1] < 60 && p[2] < 60 && p[3] > 200;
let blue = |p: &image::Rgba<u8>| p[2] > 200 && p[0] < 60 && p[1] < 60 && p[3] > 200;
assert!(red(img.get_pixel(50, 50)), "red circle in the left half: {:?}", img.get_pixel(50, 50));
assert!(blue(img.get_pixel(150, 50)), "blue circle in the right half: {:?}", img.get_pixel(150, 50));
assert!(img.get_pixel(100, 50)[3] < 128, "the circles don't meet in the middle: {:?}", img.get_pixel(100, 50));
}
+3 -2
View File
@@ -1,6 +1,6 @@
# File-format parity with PowerPoint
> **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-11 · **Change:** minor (empty notes slides are preserved on save and reopen, #2025; previous: minor, PowerPoint 97–2003 `.ppt`/`.pot`/`.pps` import; previous: trivial, a slide whose relationship is missing is reported in `lostSlides`; previous: minor (cell anchorCtr, vertOverflow/horzOverflow, compatLnSpc, normalizeH, thaiDist, table rtl, run altLang and reflection transforms round-trip; Reuse Slides brings referenced custom table styles; previous: minor (native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: seven owned PPTX corpus files, embedded fonts, EMF/WMF clip regions, threaded comments (#70), chart trendlines and workbooks (#335), SmartArt written as a diagram, tags and custom XML kept, picture export DPI; duplicated rows and headers folded; previous: trivial, lines in scaled groups, #233))) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
> **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-20 · **Change:** trivial (WMF scale and offset mapping records place sub-pictures, #2069; previous: minor, empty notes slides are preserved on save and reopen, #2025; previous: minor, PowerPoint 97–2003 `.ppt`/`.pot`/`.pps` import; previous: trivial, a slide whose relationship is missing is reported in `lostSlides`; previous: minor (cell anchorCtr, vertOverflow/horzOverflow, compatLnSpc, normalizeH, thaiDist, table rtl, run altLang and reflection transforms round-trip; Reuse Slides brings referenced custom table styles; previous: minor (native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: seven owned PPTX corpus files, embedded fonts, EMF/WMF clip regions, threaded comments (#70), chart trendlines and workbooks (#335), SmartArt written as a diagram, tags and custom XML kept, picture export DPI; duplicated rows and headers folded; previous: trivial, lines in scaled groups, #233))) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
Every format PowerPoint reads or writes, DeckCraft's support, fidelity and how it is tested.
Gaps are itemized in [gaps.md](gaps.md#file-formats). Dimension score: **~58% ready**
@@ -54,7 +54,7 @@ intermediate build that required inline `bytes` cannot read the new referenced r
|---|---|---|---|
| PNG, JPEG, GIF (animated), BMP, TIFF, WebP | yes | yes | `image` 0.25; animated GIFs play since #39 |
| SVG | yes (with PNG fallback) | **no** | The PNG fallback shows; SVG files can't be inserted |
| EMF / WMF | yes | partial | Drawn as vectors (paths, pens, pattern and hatch brushes, bitmaps, text in the document's fonts with the file's character advances). Rectangle clip regions (`INTERSECTCLIPRECT`, `EXCLUDECLIPRECT`, `EXTSELECTCLIPRGN`) limit later drawing. EMF+ only pictures play every EMF+ drawing record (brushes incl. gradients and textures, pens, paths, curves, images, strings, transforms, clipping; see `crates/metafile/src/emfplus.rs` for the few exceptions). Legacy OLE objects (VML preview) and ActiveX controls show their pictures |
| EMF / WMF | yes | partial | Drawn as vectors (paths, pens, pattern and hatch brushes, bitmaps, text in the document's fonts with the file's character advances). Rectangle clip regions (`INTERSECTCLIPRECT`, `EXCLUDECLIPRECT`, `EXTSELECTCLIPRGN`) limit later drawing. WMF scale and offset mapping records (`SCALEVIEWPORTEXT`, `SCALEWINDOWEXT`, `OFFSETVIEWPORTORG`, `OFFSETWINDOWORG`) place sub-pictures in their part of the frame (#2069). EMF+ only pictures play every EMF+ drawing record (brushes incl. gradients and textures, pens, paths, curves, images, strings, transforms, clipping; see `crates/metafile/src/emfplus.rs` for the few exceptions). Legacy OLE objects (VML preview) and ActiveX controls show their pictures |
| HEIC | yes (macOS) | no | |
| Audio: MP3, AAC/M4A, ALAC, WAV, AIFF, CAF, FLAC, Ogg Vorbis, Opus | yes (Ogg/Opus partly) | yes | Pure-Rust decoders in `crates/media`; Opus from craft-audio (craft-libs) |
| WMA | yes (Windows) | embedded, not playable | |
@@ -119,6 +119,7 @@ the round trip even though DeckCraft doesn't model it.
| Date | Change | Summary |
|---|---|---|
| 2026-11-20 | trivial | WMF scale and offset mapping records place sub-pictures in their part of the frame: craft-metafile pinned past craft-libs #1816 (#2069) |
| 2026-11-09 | minor | PowerPoint 97–2003 `.ppt`/`.pot`/`.pps` open (import only): masters, layouts from title masters, slides, text and styles, shapes, pictures, notes. Saving asks for a new name |
| 2026-11-07 | trivial | A slide-list entry whose relationship is missing is reported in `lostSlides` like an unreadable slide part, so the deck opens as a repaired copy; slide lists over 10,000 entries are refused with an import-limit error rather than silently truncated (#1910) |
| 2026-11-02 | minor | Optional table RTL direction is read and written as `a:tblPr/@rtl`; native and two PPTX saves preserve true, false and absent values with distinguishable column text |
+2 -1
View File
@@ -1,6 +1,6 @@
# DeckCraft vs Microsoft PowerPoint: parity assessment
> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-02 · **Change:** trivial (reused slide contents fit the destination size; thumbnails remain; parity estimates unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-15 · **Change:** trivial (DeckCraft v0.19.0 version preparation; the SmartArt and WordArt display names become Diagram and Decorative Text in DeckCraft's own feature labels — commands, contextual tab labels and messages — with the neutral labels guarded by tests (the PowerPoint-matching empty-diagram placeholder prompt still reads "Click icon to add SmartArt graphic", and saved control-channel identifiers such as the tab id "SmartArt Design" keep their keys); the wasm32 build no longer refers to the native-only opening generation; the control-protocol method reference is corrected; previous: reused slide contents fit the destination size; thumbnails remain; parity estimates unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
The authoritative answer to "how close is DeckCraft to PowerPoint, and how much work is left?".
[ROADMAP.md](../ROADMAP.md) summarizes it; [gaps.md](gaps.md) itemizes every shortfall;
@@ -288,6 +288,7 @@ scored done (16 open issues).
| Date | Change | Summary |
|---|---|---|
| 2026-11-15 | trivial | DeckCraft v0.19.0 version preparation; the SmartArt and WordArt display names become Diagram and Decorative Text in DeckCraft's own labels (#1981; the PowerPoint-matching empty-placeholder prompt still reads "Click icon to add SmartArt graphic"); wasm32 build fix (#1954); control-protocol method reference corrected (#2132). Parity estimates unchanged, not re-measured |
| 2026-11-02 | trivial | Reused slide content scales to the destination; picker thumbnails remain; parity estimates unchanged |
| 2026-10-22 | trivial | Animations shortfall: preview from the selected effect (Play From) is in. Percentages unchanged |
| 2026-10-17 | trivial | A word no longer breaks after `?`, `!`, `}` or `+` (a URL's query wraps at the edge as in PowerPoint 2016 for Windows), as it already didn't after `/` and `\`. Headline percentages unchanged |