mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-30 21:47:00 -06:00
Merge pull request #1480
show.presenter answers {on, window} (part of #298)
This commit is contained in:
@@ -164,7 +164,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);
|
||||
|
||||
@@ -118,7 +118,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?}"),
|
||||
@@ -454,6 +459,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;
|
||||
|
||||
@@ -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}");
|
||||
}
|
||||
Reference in New Issue
Block a user