From abdcbbd7917dbda419ad6b44e03adaa4e5ae4526 Mon Sep 17 00:00:00 2001 From: David Mann Date: Sat, 14 Nov 2026 08:53:18 +0100 Subject: [PATCH 1/7] WIP: Artboards to PDF: Reverse Page Order option (#13644) From dd5acdc6e19ac9d5da865d1a345469db56a74099 Mon Sep 17 00:00:00 2001 From: David Mann Date: Sat, 14 Nov 2026 09:04:03 +0100 Subject: [PATCH 2/7] Artboards to PDF: Reverse Page Order option (#13644) The dialog gets a Reverse Page Order checkbox, unticked on first open and remembered after a successful run; file.export.artboardsToPdf takes reversePageOrder (default false), which writes the default page order the other way round. A non-boolean value is an error. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/artboard_cmds.rs | 13 ++- .../pdf_reverse_page_order_tests.rs | 96 +++++++++++++++++++ .../src/artboards_to_pdf_reverse_tests.rs | 92 ++++++++++++++++++ crates/ui-egui/src/dialogs.rs | 3 + crates/ui-egui/src/lib.rs | 2 + crates/ui-egui/src/menus/view_cmds.rs | 2 +- crates/ui-egui/src/menus/view_cmds/dialogs.rs | 15 ++- 7 files changed, 220 insertions(+), 3 deletions(-) create mode 100644 crates/engine/src/cmd/artboard_cmds/pdf_reverse_page_order_tests.rs create mode 100644 crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs diff --git a/crates/engine/src/cmd/artboard_cmds.rs b/crates/engine/src/cmd/artboard_cmds.rs index 00b0f7e37f..e2cebb3f13 100644 --- a/crates/engine/src/cmd/artboard_cmds.rs +++ b/crates/engine/src/cmd/artboard_cmds.rs @@ -751,6 +751,11 @@ fn artboards_to_pdf(s: &mut Session, p: &Value) -> Result { let d = s.active().ok_or(EngineError::NoDocument)?; let doc = d.doc.clone(); let quality = f64_param(p, "quality").or(Some(10.0)); + // Reverse Page Order (#13644): the default page order the other way round. + let reverse = match p.get("reversePageOrder") { + None | Some(Value::Null) => false, + Some(v) => v.as_bool().ok_or_else(|| bad(cmd, "`reversePageOrder` must be true or false"))?, + }; let mut pages = Vec::new(); for one in chosen_documents(&doc, p)? { let buf = photocraft_compose::flatten(&one).over_background([1.0, 1.0, 1.0]); @@ -766,6 +771,9 @@ fn artboards_to_pdf(s: &mut Session, p: &Value) -> Result { if pages.is_empty() { return Err(bad(cmd, "no matching artboards")); } + if reverse { + pages.reverse(); + } write_file(&path, &raster_pdf(&pages))?; Ok(json!({"path": path, "pages": pages.len()})) } @@ -837,7 +845,7 @@ pub fn specs() -> Vec { "file.export.artboardsToPdf", "Artboards to PDF…", &["File", "Export"], - r##"{"path":str (.pdf),"artboards":[id]?,"quality":0..12=10} → {path, pages} (one raster page per board)"##, + r##"{"path":str (.pdf),"artboards":[id]?,"quality":0..12=10,"reversePageOrder":bool=false (the default page order the other way round)} → {path, pages} (one raster page per board)"##, export_artboards, artboards_to_pdf ), @@ -848,5 +856,8 @@ pub fn specs() -> Vec { #[path = "artboard_cmds/first_board_background_tests.rs"] mod first_board_background_tests; #[cfg(test)] +#[path = "artboard_cmds/pdf_reverse_page_order_tests.rs"] +mod pdf_reverse_page_order_tests; +#[cfg(test)] #[path = "artboard_cmds/tests.rs"] mod tests; diff --git a/crates/engine/src/cmd/artboard_cmds/pdf_reverse_page_order_tests.rs b/crates/engine/src/cmd/artboard_cmds/pdf_reverse_page_order_tests.rs new file mode 100644 index 0000000000..dc23d5858b --- /dev/null +++ b/crates/engine/src/cmd/artboard_cmds/pdf_reverse_page_order_tests.rs @@ -0,0 +1,96 @@ +//! Artboards to PDF's Reverse Page Order (#13644), on the measured document: 800 x 400 with Red, +//! Blue and Empty Board, bottom to top. The boards have three different sizes, so each page's +//! MediaBox says which board it is. + +use super::*; + +/// The measured document, and the ids of Red, Blue and Empty Board (bottom to top). +fn session() -> (Session, [u64; 3]) { + let mut s = Session::new(); + s.execute("file.new", json!({"width": 800, "height": 400, "depth": 8, "resolution": 72})).unwrap(); + let mut board = |rect: [i64; 4], name: &str| { + let r = s.execute("layer.new.artboard", json!({"rect": rect, "name": name})).unwrap(); + r["layer"].as_u64().unwrap() + }; + let ids = [board([0, 0, 200, 150], "Red Board"), board([120, 30, 200, 200], "Blue Board"), board([600, 0, 100, 100], "Empty Board")]; + (s, ids) +} + +/// Runs the export with `params` (plus a fresh path) and returns its result. +fn export(s: &mut Session, params: Value, tag: &str) -> (Result, Vec) { + let dir = std::env::temp_dir().join(format!("photocraft-pdf-reverse-{}-{tag}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + let path = join(&dir.to_string_lossy(), "boards.pdf"); + let mut params = params; + params["path"] = json!(path); + let r = s.execute("file.export.artboardsToPdf", params); + let bytes = std::fs::read(&path).unwrap_or_default(); + let _ = std::fs::remove_dir_all(&dir); + (r, bytes) +} + +/// Each page's size in points, in page order. +fn page_sizes(s: &mut Session, params: Value, tag: &str) -> Vec<(u32, u32)> { + let (r, bytes) = export(s, params, tag); + r.unwrap(); + let text = String::from_utf8_lossy(&bytes).into_owned(); + text.split("/MediaBox [0 0 ") + .skip(1) + .map(|rest| { + let mut n = rest.split([' ', ']']).map(|v| v.parse::().unwrap().round() as u32); + (n.next().unwrap(), n.next().unwrap()) + }) + .collect() +} + +fn reversed(mut v: Vec<(u32, u32)>) -> Vec<(u32, u32)> { + v.reverse(); + v +} + +#[test] +fn reverse_page_order_turns_the_default_order_round() { + let (mut s, _) = session(); + let default = page_sizes(&mut s, json!({}), "default"); + assert_eq!(default.len(), 3); + let mut sorted = default.clone(); + sorted.sort_unstable(); + assert_eq!(sorted, [(100, 100), (200, 150), (200, 200)], "one page per board"); + assert_eq!(page_sizes(&mut s, json!({"reversePageOrder": true}), "reverse"), reversed(default)); +} + +#[test] +fn false_or_no_param_keeps_the_default_order() { + let (mut s, _) = session(); + let default = page_sizes(&mut s, json!({}), "none"); + assert_eq!(page_sizes(&mut s, json!({"reversePageOrder": false}), "false"), default); + assert_eq!(page_sizes(&mut s, json!({"reversePageOrder": null}), "null"), default); +} + +#[test] +fn chosen_artboards_come_in_the_reversed_order_too() { + let (mut s, [red, blue, _]) = session(); + let chosen = json!([red, blue]); + let default = page_sizes(&mut s, json!({"artboards": chosen}), "chosen"); + let mut sorted = default.clone(); + sorted.sort_unstable(); + assert_eq!(sorted, [(200, 150), (200, 200)], "only Red and Blue Board"); + assert_eq!(page_sizes(&mut s, json!({"artboards": chosen, "reversePageOrder": true}), "chosen-reverse"), reversed(default)); +} + +#[test] +fn a_non_boolean_value_is_an_error_not_a_panic() { + let (mut s, _) = session(); + for (i, v) in [json!("yes"), json!(1), json!([true]), json!({"on": true})].into_iter().enumerate() { + let (r, bytes) = export(&mut s, json!({"reversePageOrder": v}), &format!("bad-{i}")); + let e = r.unwrap_err().to_string(); + assert!(e.contains("reversePageOrder"), "{e}"); + assert!(bytes.is_empty(), "nothing is written for {v}"); + } +} + +#[test] +fn the_params_doc_names_the_option() { + let spec = specs().into_iter().find(|c| c.id == "file.export.artboardsToPdf").unwrap(); + assert!(spec.params.contains(r#""reversePageOrder":bool=false"#), "{}", spec.params); +} diff --git a/crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs b/crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs new file mode 100644 index 0000000000..b4b0129d08 --- /dev/null +++ b/crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs @@ -0,0 +1,92 @@ +//! #13644: the Artboards to PDF dialog has a Reverse Page Order checkbox. It is unticked on first +//! open, reaches the command, and reopens as the last successful run left it. +use crate::PhotocraftApp; +use egui::accesskit::{Role, Toggled}; +use egui::vec2; +use egui_kittest::Harness; +use egui_kittest::kittest::{NodeT, Queryable}; +use serde_json::json; + +const COMMAND: &str = "file.export.artboardsToPdf"; + +/// A document with two artboards of different sizes, so a page's MediaBox says which board it is. +fn harness() -> Harness<'static, PhotocraftApp> { + let mut h = Harness::builder().with_size(vec2(1440.0, 900.0)).with_max_steps(64).build_eframe(|cc| { + PhotocraftApp::setup_context(&cc.egui_ctx, Default::default()); + PhotocraftApp::new(photocraft_engine::Session::new(), Default::default()) + }); + let app = h.state_mut(); + app.run("file.new", json!({"width": 400, "height": 200})).unwrap(); + app.run("layer.new.artboard", json!({"rect": [0, 0, 200, 150], "name": "Low"})).unwrap(); + app.run("layer.new.artboard", json!({"rect": [250, 0, 100, 100], "name": "High"})).unwrap(); + app.sync_views(); + h +} + +fn open(h: &mut Harness<'_, PhotocraftApp>, path: &str) -> u64 { + let ctx = h.ctx.clone(); + let dialog = crate::menus::invoke(h.state_mut(), &ctx, COMMAND, json!({})).unwrap()["dialog"].as_u64().unwrap(); + h.state_mut().ui.dialog_mut(dialog).unwrap().fields.insert("path".into(), json!(path)); + h.run_steps(4); + dialog +} + +fn ticked(h: &Harness<'_, PhotocraftApp>) -> bool { + h.get_by_role_and_label(Role::CheckBox, "Reverse Page Order").accesskit_node().toggled() == Some(Toggled::True) +} + +fn tick(h: &mut Harness<'_, PhotocraftApp>) { + h.get_by_role_and_label(Role::CheckBox, "Reverse Page Order").click(); + h.run_steps(2); +} + +/// Each page's width in points, in page order. +fn page_widths(path: &str) -> Vec { + let text = String::from_utf8_lossy(&std::fs::read(path).unwrap()).into_owned(); + text.split("/MediaBox [0 0 ").skip(1).map(|rest| rest.split(' ').next().unwrap().parse::().unwrap().round() as u32).collect() +} + +#[test] +fn the_checkbox_starts_unticked_and_reverses_the_pages() { + let t = tempfile::tempdir().unwrap(); + let path = t.path().join("plain.pdf").to_string_lossy().into_owned(); + let mut h = harness(); + let d = open(&mut h, &path); + assert!(!ticked(&h), "unticked on first open"); + crate::dialogs::confirm(h.state_mut(), d).unwrap(); + let plain = page_widths(&path); + assert_eq!(plain.len(), 2); + + let path = t.path().join("reversed.pdf").to_string_lossy().into_owned(); + let d = open(&mut h, &path); + tick(&mut h); + assert!(ticked(&h)); + crate::dialogs::confirm(h.state_mut(), d).unwrap(); + let mut want = plain; + want.reverse(); + assert_eq!(page_widths(&path), want); +} + +#[test] +fn a_successful_run_is_remembered_a_failed_one_is_not() { + let t = tempfile::tempdir().unwrap(); + let mut h = harness(); + let path = t.path().join("out.pdf").to_string_lossy().into_owned(); + let d = open(&mut h, &path); + tick(&mut h); + crate::dialogs::confirm(h.state_mut(), d).unwrap(); + + // Reopens ticked; untick it and fail the run (the destination is a file, not a folder). + let blocked = t.path().join("file"); + std::fs::write(&blocked, b"x").unwrap(); + let bad = blocked.join("out.pdf").to_string_lossy().into_owned(); + let d = open(&mut h, &bad); + assert!(ticked(&h), "remembered after a successful run"); + tick(&mut h); + assert!(!ticked(&h)); + assert!(crate::dialogs::confirm(h.state_mut(), d).is_err()); + + let d = open(&mut h, &path); + assert!(ticked(&h), "a failed run leaves the remembered value alone"); + h.state_mut().ui.close_dialog(d); +} diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index cd5de48bba..49939bb18d 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1057,6 +1057,9 @@ fn confirm_generic_command(app: &mut PhotocraftApp, mut d: Dialog) -> Result String { } /// Handle menu commands that need a shell action or a parameter dialog before execution. +/// Artboards to PDF remembers Reverse Page Order after a successful run (#13644). +pub(crate) fn remember_artboards_to_pdf(app: &mut PhotocraftApp, params: &Value) { + let Some(reverse) = params.get("reversePageOrder").and_then(Value::as_bool) else { return }; + app.session.prefs.edit(|prefs| prefs.dialogs.insert("file.export.artboardsToPdf".into(), json!({"reversePageOrder": reverse}))); +} + pub(super) fn front(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, params: &Value) -> Option> { if id == "file.closeAll" || id == "file.closeOthers" { // Keep the remaining document's view (views are index-aligned with documents). @@ -514,7 +520,14 @@ pub(super) fn front(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, para "file.export.artboardsToPdf" => { let (_, _, name) = doc?; let stem = name.rsplit_once('.').map_or(name.as_str(), |(a, _)| a).to_string(); - dialog(app, json!({"path": format!("{dir}/{stem}.pdf"), "quality": 10}), json!({})) + // Reverse Page Order starts unticked and reopens as the last successful run left it (#13644). + let reverse = app.session.prefs().dialogs.get(id).and_then(|v| v.get("reversePageOrder")).and_then(Value::as_bool).unwrap_or(false); + dialog( + app, + json!({"path": format!("{dir}/{stem}.pdf"), "quality": 10, "reversePageOrder": reverse, "__order": ["path", "quality", "reversePageOrder"], + "__labels": {"reversePageOrder": tl!("Reverse Page Order")}}), + json!({}), + ) } "file.export.dataSetsAsFiles" => { #[cfg(target_arch = "wasm32")] From e72dc193ae9534d64946a293107067e211b3e5a8 Mon Sep 17 00:00:00 2001 From: David Mann Date: Sat, 14 Nov 2026 10:15:05 +0100 Subject: [PATCH 3/7] Artboards to PDF reverse tests: export into a fresh temporary folder Co-Authored-By: Claude Opus 5.5 --- .../pdf_reverse_page_order_tests.rs | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/crates/engine/src/cmd/artboard_cmds/pdf_reverse_page_order_tests.rs b/crates/engine/src/cmd/artboard_cmds/pdf_reverse_page_order_tests.rs index dc23d5858b..b3009e1251 100644 --- a/crates/engine/src/cmd/artboard_cmds/pdf_reverse_page_order_tests.rs +++ b/crates/engine/src/cmd/artboard_cmds/pdf_reverse_page_order_tests.rs @@ -16,22 +16,21 @@ fn session() -> (Session, [u64; 3]) { (s, ids) } -/// Runs the export with `params` (plus a fresh path) and returns its result. -fn export(s: &mut Session, params: Value, tag: &str) -> (Result, Vec) { - let dir = std::env::temp_dir().join(format!("photocraft-pdf-reverse-{}-{tag}", std::process::id())); - std::fs::create_dir_all(&dir).unwrap(); - let path = join(&dir.to_string_lossy(), "boards.pdf"); +/// Runs the export with `params` (plus a path in a fresh temporary folder) and returns its result +/// and the bytes written (empty when nothing was). +fn export(s: &mut Session, params: Value) -> (Result, Vec) { + let dir = tempfile::tempdir().unwrap(); + let path = join(&dir.path().to_string_lossy(), "boards.pdf"); let mut params = params; params["path"] = json!(path); let r = s.execute("file.export.artboardsToPdf", params); let bytes = std::fs::read(&path).unwrap_or_default(); - let _ = std::fs::remove_dir_all(&dir); (r, bytes) } /// Each page's size in points, in page order. -fn page_sizes(s: &mut Session, params: Value, tag: &str) -> Vec<(u32, u32)> { - let (r, bytes) = export(s, params, tag); +fn page_sizes(s: &mut Session, params: Value) -> Vec<(u32, u32)> { + let (r, bytes) = export(s, params); r.unwrap(); let text = String::from_utf8_lossy(&bytes).into_owned(); text.split("/MediaBox [0 0 ") @@ -51,38 +50,38 @@ fn reversed(mut v: Vec<(u32, u32)>) -> Vec<(u32, u32)> { #[test] fn reverse_page_order_turns_the_default_order_round() { let (mut s, _) = session(); - let default = page_sizes(&mut s, json!({}), "default"); + let default = page_sizes(&mut s, json!({})); assert_eq!(default.len(), 3); let mut sorted = default.clone(); sorted.sort_unstable(); assert_eq!(sorted, [(100, 100), (200, 150), (200, 200)], "one page per board"); - assert_eq!(page_sizes(&mut s, json!({"reversePageOrder": true}), "reverse"), reversed(default)); + assert_eq!(page_sizes(&mut s, json!({"reversePageOrder": true})), reversed(default)); } #[test] fn false_or_no_param_keeps_the_default_order() { let (mut s, _) = session(); - let default = page_sizes(&mut s, json!({}), "none"); - assert_eq!(page_sizes(&mut s, json!({"reversePageOrder": false}), "false"), default); - assert_eq!(page_sizes(&mut s, json!({"reversePageOrder": null}), "null"), default); + let default = page_sizes(&mut s, json!({})); + assert_eq!(page_sizes(&mut s, json!({"reversePageOrder": false})), default); + assert_eq!(page_sizes(&mut s, json!({"reversePageOrder": null})), default); } #[test] fn chosen_artboards_come_in_the_reversed_order_too() { let (mut s, [red, blue, _]) = session(); let chosen = json!([red, blue]); - let default = page_sizes(&mut s, json!({"artboards": chosen}), "chosen"); + let default = page_sizes(&mut s, json!({"artboards": chosen})); let mut sorted = default.clone(); sorted.sort_unstable(); assert_eq!(sorted, [(200, 150), (200, 200)], "only Red and Blue Board"); - assert_eq!(page_sizes(&mut s, json!({"artboards": chosen, "reversePageOrder": true}), "chosen-reverse"), reversed(default)); + assert_eq!(page_sizes(&mut s, json!({"artboards": chosen, "reversePageOrder": true})), reversed(default)); } #[test] fn a_non_boolean_value_is_an_error_not_a_panic() { let (mut s, _) = session(); - for (i, v) in [json!("yes"), json!(1), json!([true]), json!({"on": true})].into_iter().enumerate() { - let (r, bytes) = export(&mut s, json!({"reversePageOrder": v}), &format!("bad-{i}")); + for v in [json!("yes"), json!(1), json!([true]), json!({"on": true})] { + let (r, bytes) = export(&mut s, json!({"reversePageOrder": v})); let e = r.unwrap_err().to_string(); assert!(e.contains("reversePageOrder"), "{e}"); assert!(bytes.is_empty(), "nothing is written for {v}"); From 3b6b44d1c89a818f8458f5c081b9363e7b04b395 Mon Sep 17 00:00:00 2001 From: David Mann Date: Sun, 15 Nov 2026 23:02:50 +0100 Subject: [PATCH 4/7] cargo fmt after merging main Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/artboard_cmds.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/artboard_cmds.rs b/crates/engine/src/cmd/artboard_cmds.rs index 8db9463d15..f6b09d0ddd 100644 --- a/crates/engine/src/cmd/artboard_cmds.rs +++ b/crates/engine/src/cmd/artboard_cmds.rs @@ -913,11 +913,11 @@ mod file_names_tests; #[path = "artboard_cmds/first_board_background_tests.rs"] mod first_board_background_tests; #[cfg(test)] -#[path = "artboard_cmds/pdf_reverse_page_order_tests.rs"] -mod pdf_reverse_page_order_tests; -#[cfg(test)] #[path = "artboard_cmds/pdf_page_order_tests.rs"] mod pdf_page_order_tests; #[cfg(test)] +#[path = "artboard_cmds/pdf_reverse_page_order_tests.rs"] +mod pdf_reverse_page_order_tests; +#[cfg(test)] #[path = "artboard_cmds/tests.rs"] mod tests; From 20b36b91ae4b9c8843abec29a3ecdf29713b753a Mon Sep 17 00:00:00 2001 From: David Mann Date: Thu, 19 Nov 2026 18:34:27 +0100 Subject: [PATCH 5/7] Address CodeRabbit review: check that the blocked Artboards to PDF run fails The reverse-order memory test now asserts that the run into a blocked folder really fails (an error or the status bar's error) and writes nothing, before it checks that the dialog reopens with the last successful value. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs b/crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs index abef5f2f69..ebc7371bb7 100644 --- a/crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs +++ b/crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs @@ -99,7 +99,11 @@ fn a_successful_run_is_remembered_a_failed_one_is_not() { assert!(ticked(&h), "remembered after a successful run"); tick(&mut h); assert!(!ticked(&h)); - let _ = confirm(&mut h, d); + assert!(!h.state().ui.status_error, "the first run succeeded: {}", h.state().ui.status); + let r = confirm(&mut h, d); + // The run fails, so it must not be what the next open remembers. + assert!(r.is_err() || h.state().ui.status_error, "the blocked run fails: {r:?}, status {}", h.state().ui.status); + assert!(!std::path::Path::new(&bad).exists(), "the blocked run writes nothing"); if h.state().framework.dialogs.get_dyn(d).is_some() { let ctx = h.ctx.clone(); crate::dialogs::cancel(h.state_mut(), &ctx, d).unwrap(); From d5a3e093a45771eb303f85fcf650c8edd5779a32 Mon Sep 17 00:00:00 2001 From: David Mann Date: Sat, 21 Nov 2026 17:38:14 +0100 Subject: [PATCH 6/7] PR #14361: the Artboards to PDF params doc has a plain arrow again The Reverse Page Order change wrote the arrow before the result as mis-decoded UTF-8 (three Latin-1 characters). Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/artboard_cmds.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/artboard_cmds.rs b/crates/engine/src/cmd/artboard_cmds.rs index d85ddba7e9..c3ebfc8551 100644 --- a/crates/engine/src/cmd/artboard_cmds.rs +++ b/crates/engine/src/cmd/artboard_cmds.rs @@ -1154,7 +1154,7 @@ pub fn specs() -> Vec { "file.export.artboardsToPdf", "Artboards to PDF…", &["File", "Export"], - r##"{"path":str (.pdf),"artboards":[id]?,"quality":0..12=10,"reversePageOrder":bool=false (the default page order the other way round)} → {path, pages} (one raster page per board, bottom artboard of the Layers panel first)"##, + r##"{"path":str (.pdf),"artboards":[id]?,"quality":0..12=10,"reversePageOrder":bool=false (the default page order the other way round)} → {path, pages} (one raster page per board, bottom artboard of the Layers panel first)"##, export_artboards, artboards_to_pdf ), From 9c3a994ed6d5f90f3e5a4e9178266e21214b7cd9 Mon Sep 17 00:00:00 2001 From: David Mann Date: Sat, 21 Nov 2026 18:47:52 +0100 Subject: [PATCH 7/7] PR #14361: the Reverse Page Order dialog test exports every board Export Selected Artboards from main opens ticked while a board is selected, so the dialog exported one page and the test, written before it, expected two. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs b/crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs index ebc7371bb7..50c0e480fe 100644 --- a/crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs +++ b/crates/ui-egui/src/artboards_to_pdf_reverse_tests.rs @@ -35,6 +35,8 @@ fn open(h: &mut H, path: &str) -> DialogId { let dialog = h.state().framework.dialogs.open_dialogs().into_iter().map(|d| d.id).find(|d| d.value().to_string() == want).unwrap(); h.run_steps(4); h.state_mut().framework.dialogs.set_json_field(&ctx, dialog, "path", json!(path)).unwrap(); + // Every board, not only the selected one: Export Selected Artboards opens ticked while a board is selected (#13647). + h.state_mut().framework.dialogs.set_json_field(&ctx, dialog, "artboards", serde_json::Value::Null).unwrap(); h.run_steps(4); dialog }