[JJ3] show.presenter answers {on, window}

The answer was null. Presenter view is its own window beside the show window,
so window is true; the doc says where it appears.

PowerPoint: Presenter View opens in a separate window on the second display
when the show starts (the Use Presenter View option); same here.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Zach Berry
2026-10-27 20:34:18 -05:00
co-authored by Claude Sonnet 5.5
parent 55e5ee56b4
commit 1ca71474a2
3 changed files with 31 additions and 2 deletions
+5 -1
View File
@@ -162,7 +162,11 @@ impl SlideApp {
self.start_show(from, false);
}
}
"show.presenter" => self.ui.presenter_view = self.flag(p, self.ui.presenter_view),
"show.presenter" => {
self.ui.presenter_view = self.flag(p, self.ui.presenter_view);
// The browser build has one viewport: presenter view is drawn inside the page.
return Ok(json!({"on": self.ui.presenter_view, "window": !cfg!(target_arch = "wasm32")}));
}
"show.end" => {
self.show = None;
self.media.stop_owned(media::Owner::Show);
+8 -1
View File
@@ -109,7 +109,12 @@ pub const UI_COMMANDS: &[(&str, &str, Option<&str>, &str)] = &[
("view.grayscale", "Grayscale", None, "{on?: bool}"),
("view.newWindow", "New Window", None, "{on?: bool, slide?: index, delta?: int}"),
("show.start", "Slide Show", Some("F5"), "{from?: index, custom?: name}"),
("show.presenter", "Presenter View", None, "{on?: bool}"),
(
"show.presenter",
"Presenter View",
None,
"{on?: bool} → {on, window} (presenter view, with notes, a clock and the next slide, appears in its own separate window beside the show window when the show starts; window is false in the browser build, which draws it inside the page)",
),
("show.end", "End Show", None, "{}"),
("animation.preview", "Preview Animations", None, "{on?: bool, from?: effect index}"),
("app.home", "Home", None, "{on?}"),
@@ -445,6 +450,8 @@ mod ime_tests;
#[cfg(test)]
mod last_color_tests;
#[cfg(test)]
mod presenter_tests;
#[cfg(test)]
mod replacefonts_tests;
#[cfg(test)]
mod reuse_picker_tests;
+18
View File
@@ -0,0 +1,18 @@
//! JJ3: `show.presenter` answers the setting and where presenter view appears.
#![allow(clippy::unwrap_used, clippy::expect_used)]
use serde_json::json;
use crate::{Services, SlideApp};
use deckcraft_engine::Session;
#[test]
fn show_presenter_answers_on_and_window() {
let mut app = SlideApp::new(Session::with_new(), Services::default());
let v = app.run("show.presenter", json!({"on": true})).unwrap();
assert_eq!(v, json!({"on": true, "window": true}));
let v = app.run("show.presenter", json!({})).unwrap();
assert_eq!(v["on"], false, "no `on` toggles: {v}");
let doc = crate::UI_COMMANDS.iter().find(|c| c.0 == "show.presenter").unwrap().3;
assert!(doc.contains("separate window"), "{doc}");
}