shell-w6: net change of 3 commits

- shell-w6: written from its sheet
- shell-w6: repair 1
- shell-w6: review fixes (review-1)
This commit is contained in:
Dylan M. Taylor committed 2026-11-27 14:51:29 +00:00
1 parent 5b90b50c8c
commit f285bc5bc9
4 files changed
+705 -609

No files matched your search

+17 -15
View File
@@ -500,17 +500,9 @@ pub fn format_for_path(path: &str) -> &'static str {
/// becomes its file. `file.save` calls it after writing; the web host bridge calls it once the
/// page has the bytes.
pub fn mark_saved(s: &mut Session, path: Option<String>) -> Result<()> {
let st = s.doc_mut()?;
st.saved_doc = st.doc.clone();
if path.is_some() {
st.path = path;
}
st.revision += 1;
let uid = st.uid;
if let Some(dir) = &s.recovery_dir {
crate::recovery::discard(dir, uid);
}
Ok(())
let st = s.doc()?;
let (uid, snapshot) = (st.uid, st.doc.clone());
mark_saved_snapshot(s, uid, snapshot, path)
}
fn write_file(path: &str, bytes: &[u8]) -> Result<()> {
@@ -864,13 +856,23 @@ where
M: FnOnce(&str) -> std::result::Result<(bool, u64), String>,
R: FnOnce(&str) -> std::result::Result<Vec<u8>, String>,
{
let _ = (path, metadata, read);
todo!("sh.A27")
let bytes = crate::io::read_file_with(path, metadata, read).map_err(EngineError::Other)?;
loaded_file(path, &bytes)
}
/// Records the serialized snapshot as the saved state of its originating document.
/// Leaves later edits dirty and never switches or redirects a closed document.
pub fn mark_saved_snapshot(s: &mut Session, uid: u64, snapshot: std::sync::Arc<deckcraft_model::Presentation>, path: Option<String>) -> Result<()> {
let _ = (s, uid, snapshot, path);
todo!("sh.A23")
let st = s.docs.iter_mut().find(|d| d.uid == uid).ok_or_else(|| EngineError::Other("the presentation is closed".into()))?;
st.saved_doc = snapshot;
if path.is_some() {
st.path = path;
}
st.revision += 1;
if !st.is_dirty()
&& let Some(dir) = &s.recovery_dir
{
crate::recovery::discard(dir, uid);
}
Ok(())
}
File diff suppressed because it is too large. Load diff
+102 -54
View File
@@ -2,38 +2,36 @@
//! the exports and Print hand that page, under which name, and whether it is a new file.
#![allow(clippy::unwrap_used, clippy::expect_used)]
use std::cell::RefCell;
use std::rc::Rc;
use std::path::Path;
use std::sync::Arc;
use craft::host::{Picked, ScriptedFiles};
use serde_json::json;
use super::{Services, SlideApp};
use crate::Session;
/// What the page was handed: (name, Save As, bytes).
type Got = Rc<RefCell<Vec<(String, bool, Vec<u8>)>>>;
type Got = Arc<ScriptedFiles>;
/// The web app inside such a page, with `host_save` and `download` pointed at it as the bridge
/// does; `fail` makes every save miss the page.
fn host_app(fail: bool) -> (SlideApp, Got) {
let got: Got = Rc::default();
let (saves, downloads) = (got.clone(), got.clone());
let services = Services {
host_save: Some(Box::new(move |name: &str, bytes: &[u8], save_as: bool| {
if fail {
return Err("the page is gone".into());
}
saves.borrow_mut().push((name.to_string(), save_as, bytes.to_vec()));
Ok(())
})),
download: Some(Box::new(move |name: &str, bytes: &[u8]| downloads.borrow_mut().push((name.to_string(), false, bytes.to_vec())))),
..Default::default()
/// Installs the hosted file service through the app's framework harness.
fn host_app(fail: bool) -> (egui_kittest::Harness<'static, SlideApp>, Got) {
let files = if fail {
ScriptedFiles::answering([Picked::Failed("the page is gone".into())]).in_browser().hosted()
} else {
ScriptedFiles::new().in_browser().hosted().saving_suggested()
};
// Host mode starts as the web shell starts it: an empty presentation for the page's file.
// P3(shell-w6): sh.A2
let mut app = SlideApp::new_base(Session::new(), services);
app.start_for_host().unwrap();
(app, got)
host_app_with(files)
}
fn host_app_with(files: ScriptedFiles) -> (egui_kittest::Harness<'static, SlideApp>, Got) {
let files = Arc::new(files);
let installed = files.clone();
let mut h = crate::test_harness::harness_with(Session::new(), Services::default(), egui_kittest::Harness::builder(), move |platform| {
platform.host = platform.host.with_files(installed)
});
h.state_mut().start_for_host().unwrap();
(h, files)
}
/// A .pptx with `slides` slides, as the page would send it.
@@ -51,7 +49,7 @@ fn edit(app: &mut SlideApp) {
}
fn calls(got: &Got) -> Vec<(String, bool)> {
got.borrow().iter().map(|(n, s, _)| (n.clone(), *s)).collect()
got.requests().into_iter().map(|r| (r.file_name.unwrap_or_default(), r.save_as)).collect()
}
fn path(app: &SlideApp) -> Option<String> {
@@ -59,25 +57,26 @@ fn path(app: &SlideApp) -> Option<String> {
}
/// The bug this prevents: Save of a .pptx the page sent came back as `<name>.deckcraft`. Save
/// now hands the page the opened file under its own name and format, not as a new file; Save As
/// hands the page the opened file under its own name and format; Save As
/// says it is a new file and becomes the file the next Save writes.
#[test]
fn host_saves_go_back_to_the_opened_file() {
let (mut app, got) = host_app(false);
let (mut h, got) = host_app(false);
let app = h.state_mut();
app.open_from_host(Some("Lecture 3.pptx"), &pptx(2));
assert_eq!(app.session.documents().len(), 1, "the untouched blank presentation gave way");
edit(&mut app);
edit(app);
app.save();
assert!(!app.session.active().unwrap().is_dirty());
edit(&mut app);
edit(app);
app.save_as_dialog("deckcraft");
assert!(!app.session.active().unwrap().is_dirty());
edit(&mut app);
edit(app);
app.save();
let names = [("Lecture 3.pptx", false), ("Lecture 3.deckcraft", true), ("Lecture 3.deckcraft", false)];
assert_eq!(calls(&got), names.map(|(n, s)| (n.to_string(), s)));
// The first save is a .pptx that reopens with the edit in it.
let first = got.borrow()[0].2.clone();
let first = got.file(Path::new(names[0].0)).unwrap();
assert!(first.windows(20).any(|w| w == b"ppt/presentation.xml"), "Save writes PowerPoint, not .deckcraft");
let reopened = deckcraft_engine::cmd::file::loaded_file("Lecture 3.pptx", &first).unwrap();
assert_eq!(reopened.doc.slides.len(), 3);
@@ -87,11 +86,12 @@ fn host_saves_go_back_to_the_opened_file() {
/// file of the same name. The next Save goes back to it.
#[test]
fn host_save_of_an_untitled_presentation_is_save_as() {
let (mut app, got) = host_app(false);
let (mut h, got) = host_app(false);
let app = h.state_mut();
let name = format!("{}.deckcraft", app.session.active().unwrap().title());
edit(&mut app);
edit(app);
app.save();
edit(&mut app);
edit(app);
app.save();
assert_eq!(calls(&got), [(name.clone(), true), (name, false)]);
}
@@ -100,8 +100,8 @@ fn host_save_of_an_untitled_presentation_is_save_as() {
/// its name isn't one the page holds: Save makes a new file.
#[test]
fn a_file_the_page_never_sent_saves_as_a_new_file() {
let (mut app, got) = host_app(false);
// P3(shell-w6): sh.A23
let (mut h, got) = host_app(false);
let app = h.state_mut();
app.open_or_insert_bytes("dropped.pptx", pptx(1));
app.save();
assert_eq!(calls(&got), [("dropped.deckcraft".to_string(), true)]);
@@ -111,22 +111,24 @@ fn a_file_the_page_never_sent_saves_as_a_new_file() {
/// presentation keeps its own file and its unsaved changes.
#[test]
fn host_exports_and_print_are_copies() {
let (mut app, got) = host_app(false);
let (mut h, got) = host_app(false);
let app = h.state_mut();
app.open_from_host(Some("deck.pptx"), &pptx(1));
edit(&mut app);
edit(app);
assert!(app.export_as("pdf", json!({})));
assert!(app.print_pdf(json!({})));
assert_eq!(calls(&got), [("deck.pdf".to_string(), false), ("deck.pdf".to_string(), false)]);
assert!(app.session.active().unwrap().is_dirty());
assert_eq!(path(&app).as_deref(), Some("deck.pptx"));
assert_eq!(path(app).as_deref(), Some("deck.pptx"));
}
/// The page not getting the file is a failed save: the presentation keeps its changes.
#[test]
fn a_host_save_that_fails_leaves_the_presentation_unsaved() {
let (mut app, _) = host_app(true);
let (mut h, _) = host_app(true);
let app = h.state_mut();
app.open_from_host(Some("deck.pptx"), &pptx(1));
edit(&mut app);
edit(app);
app.save();
assert!(app.session.active().unwrap().is_dirty());
assert!(app.status.as_ref().is_some_and(|(m, _)| m.contains("Couldn't save deck.pptx")));
@@ -135,11 +137,12 @@ fn a_host_save_that_fails_leaves_the_presentation_unsaved() {
/// Only an untouched start presentation gives way: one with changes stays open beside the file.
#[test]
fn an_edited_start_presentation_stays_open() {
let (mut app, _) = host_app(false);
edit(&mut app);
let (mut h, _) = host_app(false);
let app = h.state_mut();
edit(app);
app.open_from_host(Some("deck.pptx"), &pptx(1));
assert_eq!(app.session.documents().len(), 2);
assert_eq!(path(&app).as_deref(), Some("deck.pptx"));
assert_eq!(path(app).as_deref(), Some("deck.pptx"));
}
/// Only the first file from the page takes the start presentation's place. The bug this
@@ -147,21 +150,23 @@ fn an_edited_start_presentation_stays_open() {
/// is, so the page's next file closed it.
#[test]
fn only_the_first_file_from_the_page_replaces_the_start_presentation() {
let (mut app, _) = host_app(false);
let (mut h, _) = host_app(false);
let app = h.state_mut();
app.open_from_host(None, &pptx(2));
app.open_from_host(Some("deck.pptx"), &pptx(3));
let slides: Vec<usize> = app.session.documents().iter().map(|d| d.doc.slides.len()).collect();
assert_eq!(slides, [2, 3], "the file sent without a name stays open beside the next one");
assert_eq!(path(&app).as_deref(), Some("deck.pptx"));
assert_eq!(path(app).as_deref(), Some("deck.pptx"));
}
/// The command palette runs `file.save` by id. With a file of its own the engine would write to
/// that path, which a browser can't; in host mode it goes to the page like Ctrl+S.
#[test]
fn palette_save_goes_to_the_page() {
let (mut app, got) = host_app(false);
let (mut h, got) = host_app(false);
let app = h.state_mut();
app.open_from_host(Some("deck.pptx"), &pptx(1));
edit(&mut app);
edit(app);
let r = app.run("file.save", json!({})).unwrap();
assert_eq!(r["path"], "deck.pptx");
assert_eq!(calls(&got), [("deck.pptx".to_string(), false)]);
@@ -173,11 +178,12 @@ fn palette_save_goes_to_the_page() {
#[test]
fn a_file_sent_without_a_presentation_name_saves_as_a_new_file() {
for (name, saved) in [(None, "Presentation.deckcraft"), (Some("Talk"), "Talk.deckcraft")] {
let (mut app, got) = host_app(false);
let (mut h, got) = host_app(false);
let app = h.state_mut();
app.open_from_host(name, &pptx(2));
assert_eq!(app.session.documents().len(), 1, "{name:?}");
assert_eq!(app.session.active().unwrap().doc.slides.len(), 2, "{name:?}");
assert_eq!(path(&app), None, "{name:?}");
assert_eq!(path(app), None, "{name:?}");
app.save();
assert_eq!(calls(&got), [(saved.to_string(), true)], "{name:?}");
}
@@ -187,11 +193,12 @@ fn a_file_sent_without_a_presentation_name_saves_as_a_new_file() {
/// desktop: the blank start presentation gives way, and Save is a new file.
#[test]
fn an_outline_from_the_page_opens_as_a_new_presentation() {
let (mut app, got) = host_app(false);
let (mut h, got) = host_app(false);
let app = h.state_mut();
app.open_from_host(Some("notes.md"), b"# One\n\n# Two\n\n# Three\n");
assert_eq!(app.session.documents().len(), 1);
assert_eq!(app.session.active().unwrap().doc.slides.len(), 3);
assert_eq!(path(&app), None);
assert_eq!(path(app), None);
app.save();
assert_eq!(calls(&got), [("notes.deckcraft".to_string(), true)]);
}
@@ -206,10 +213,51 @@ fn a_damaged_file_from_the_page_saves_as_a_new_repaired_file() {
// Pictures are stored as they are, so flipping a byte breaks the entry's CRC.
let at = bad.windows(13).position(|w| w == b"PICTURE-BYTES").unwrap();
bad[at] ^= 0xff;
let (mut app, got) = host_app(false);
let (mut h, got) = host_app(false);
let app = h.state_mut();
app.open_from_host(Some("talk.deckcraft"), &bad);
assert_eq!(path(&app), None);
assert_eq!(path(app), None);
assert!(app.session.active().unwrap().title().ends_with("(Repaired)"));
app.save();
assert_eq!(calls(&got), [("talk (Repaired).deckcraft".to_string(), true)]);
}
/// A late acknowledgement records the bytes sent, preserving edits made while it was pending.
#[test]
fn a_delayed_save_records_its_snapshot_and_keeps_later_edits_dirty() {
let (mut h, files) = host_app_with(ScriptedFiles::held().in_browser().hosted());
let app = h.state_mut();
let name = "deck.pptx";
app.open_from_host(Some(name), &pptx(1));
app.session.execute("slide.new", &json!({})).unwrap();
let uid = app.session.active().unwrap().uid;
let serialized = app.session.active().unwrap().doc.clone();
app.save();
let ticket = app.pending_files.last().unwrap().ticket;
app.session.execute("slide.new", &json!({})).unwrap();
let edited = app.session.active().unwrap().doc.clone();
app.session.execute("file.new", &json!({})).unwrap();
let viewing = app.session.active().unwrap().uid;
files.answer_to(ticket, Picked::Saved { path: name.into(), file_type: None });
app.take_file_answers();
app.take_file_answers();
assert_eq!(app.session.active().unwrap().uid, viewing);
let original = app.session.documents().iter().find(|d| d.uid == uid).unwrap();
assert!(original.is_dirty());
assert!(Arc::ptr_eq(&original.doc, &edited));
assert!(Arc::ptr_eq(&original.saved_doc, &serialized));
let written = files.file(Path::new(name)).unwrap();
let reopened = deckcraft_engine::cmd::file::loaded_file(name, &written).unwrap();
assert_eq!(reopened.doc.slides.len(), serialized.slides.len());
assert!(reopened.doc.slides.len() < original.doc.slides.len());
let index = app.session.documents().iter().position(|d| d.uid == uid).unwrap();
app.session.set_active(index);
app.save();
let ticket = app.pending_files.last().unwrap().ticket;
files.answer_to(ticket, Picked::Saved { path: name.into(), file_type: None });
app.take_file_answers();
assert!(!app.session.active().unwrap().is_dirty());
let written = files.file(Path::new(name)).unwrap();
let reopened = deckcraft_engine::cmd::file::loaded_file(name, &written).unwrap();
assert_eq!(reopened.doc.slides.len(), edited.slides.len());
}
+52 -67
View File
@@ -1,12 +1,14 @@
//! #414: a browser file pick finishes on the document, slide and operation that started it.
#![allow(clippy::unwrap_used, clippy::expect_used)]
use std::sync::{Arc, Mutex};
use std::sync::Arc;
use craft::host::{PickId, Picked, ScriptedFiles};
use deckcraft_model::ShapeKind;
use serde_json::json;
use super::{Inbox, InboxEvent, InboxFile, Services, SlideApp};
use super::{Services, SlideApp};
use crate::Session;
fn png() -> Vec<u8> {
@@ -34,23 +36,17 @@ fn wav() -> Vec<u8> {
b
}
fn setup() -> (SlideApp, Inbox, Arc<Mutex<Vec<(String, u64)>>>) {
let inbox: Inbox = Inbox::default();
let started = Arc::new(Mutex::new(Vec::new()));
let record = started.clone();
let services = Services {
inbox: Some(inbox.clone()),
open_async: Some(Box::new(move |purpose, id| {
record.lock().expect("request log").push((purpose.to_string(), id));
})),
..Default::default()
};
// P3(shell-w6): sh.A2
(SlideApp::new_base(Session::with_new(), services), inbox, started)
fn setup() -> (egui_kittest::Harness<'static, SlideApp>, Arc<ScriptedFiles>) {
let files = Arc::new(ScriptedFiles::held());
let installed = files.clone();
let h = crate::test_harness::harness_with(Session::with_new(), Services::default(), egui_kittest::Harness::builder(), move |platform| {
platform.host = platform.host.with_files(installed)
});
(h, files)
}
fn deliver(inbox: &Inbox, id: u64, name: &str, bytes: Vec<u8>) {
inbox.lock().expect("inbox").push(InboxEvent::File(InboxFile { id, name: name.into(), bytes }));
fn deliver(files: &ScriptedFiles, ticket: PickId, name: &str, bytes: Vec<u8>) {
files.answer_to(ticket, Picked::Contents(vec![(name.into(), bytes)]));
}
fn pictures(app: &SlideApp, doc: u64, slide: deckcraft_model::SlideId) -> usize {
@@ -69,7 +65,8 @@ fn audios(app: &SlideApp, doc: u64, slide: deckcraft_model::SlideId) -> usize {
/// Each file uses the operation that was requested and lands on the slide that asked.
#[test]
fn late_picker_files_keep_their_document_slide_and_operation() {
let (mut app, inbox, started) = setup();
let (mut h, files) = setup();
let app = h.state_mut();
let uid_a = app.session.active().unwrap().uid;
let slide0 = app.session.active().unwrap().current_slide().unwrap().id;
app.session.execute("slide.new", &json!({})).unwrap();
@@ -89,35 +86,37 @@ fn late_picker_files_keep_their_document_slide_and_operation() {
// A video was requested on B. Delivering a PNG must not insert a picture anywhere.
app.pick_and_insert("video", "insert.video");
let log = started.lock().expect("request log").clone();
assert_eq!(log.iter().map(|(p, _)| p.as_str()).collect::<Vec<_>>(), vec!["audio", "picture", "open", "video"]);
let audio_id = log[0].1;
let picture_id = log[1].1;
let outline_id = log[2].1;
let video_id = log[3].1;
let purposes: Vec<String> = files.requests().into_iter().map(|r| r.purpose).collect();
assert_eq!(purposes, ["audio", "picture", "document", "video"]);
let audio_id = app.pending_files[0].ticket;
let picture_id = app.pending_files[1].ticket;
let outline_id = app.pending_files[2].ticket;
let video_id = app.pending_files[3].ticket;
// The video request completes first, while B is still current. A PNG must not become a picture.
deliver(&inbox, video_id, "clip.mp4", png());
app.drain_inbox();
deliver(&files, video_id, "clip.mp4", png());
app.take_file_answers();
let status = app.status.as_ref().map(|(t, _)| t.clone()).unwrap_or_default();
assert!(status.contains("not a supported video") || status.contains("no video"), "{status}");
assert_eq!(app.session.active().unwrap().doc.slides[0].shapes.len(), shapes_b);
// The earlier picks then finish in reverse order.
deliver(&inbox, outline_id, "talk.md", b"Brought Later\n".to_vec());
deliver(&inbox, picture_id, "shot.png", png());
deliver(&inbox, audio_id, "tone.wav", wav());
app.drain_inbox();
deliver(&files, outline_id, "talk.md", b"Brought Later\n".to_vec());
app.take_file_answers();
deliver(&files, picture_id, "shot.png", png());
app.take_file_answers();
deliver(&files, audio_id, "tone.wav", wav());
app.take_file_answers();
assert_eq!(app.session.active().unwrap().uid, uid_b, "the view stays on the document the user switched to");
assert_eq!(app.session.active().unwrap().doc.slides[0].shapes.len(), shapes_b, "the video request must not insert the PNG here");
assert_eq!(pictures(&app, uid_b, app.session.documents().iter().find(|d| d.uid == uid_b).unwrap().doc.slides[0].id), 0);
assert_eq!(pictures(app, uid_b, app.session.documents().iter().find(|d| d.uid == uid_b).unwrap().doc.slides[0].id), 0);
let status = app.status.as_ref().map(|(t, _)| t.clone()).unwrap_or_default();
assert_eq!(pictures(&app, uid_a, slide0), 1, "{status}");
assert_eq!(pictures(&app, uid_a, slide1), 0);
assert_eq!(audios(&app, uid_a, slide1), 1);
assert_eq!(audios(&app, uid_a, slide0), 0);
assert_eq!(pictures(app, uid_a, slide0), 1, "{status}");
assert_eq!(pictures(app, uid_a, slide1), 0);
assert_eq!(audios(app, uid_a, slide1), 1);
assert_eq!(audios(app, uid_a, slide0), 0);
let a = app.session.documents().iter().find(|d| d.uid == uid_a).unwrap();
assert!(a.doc.slides.iter().any(|s| s.title() == "Brought Later"), "the outline stays on the document that opened it");
assert_eq!(a.doc.slides.len(), 3);
@@ -129,25 +128,29 @@ fn late_picker_files_keep_their_document_slide_and_operation() {
/// it into whatever is open now.
#[test]
fn a_closed_or_cancelled_request_does_not_insert_into_the_active_document() {
let (mut app, inbox, started) = setup();
let (mut h, files) = setup();
let app = h.state_mut();
let slide = app.session.active().unwrap().current_slide().unwrap().id;
app.pick_and_insert("picture", "insert.picture");
app.session.execute("slide.new", &json!({})).unwrap();
let kept = app.session.active().unwrap().current_slide().unwrap().id;
app.session.execute("slide.delete", &json!({"ids": [slide.0]})).unwrap();
app.pick_and_insert("picture", "insert.picture");
let log = started.lock().expect("request log").clone();
let deleted_slide = log[0].1;
let dismiss = log[1].1;
let deleted_slide = app.pending_files[0].ticket;
let dismiss = app.pending_files[1].ticket;
files.answer_to(dismiss, Picked::Cancelled);
app.take_file_answers();
deliver(&files, dismiss, "late.png", png());
app.take_file_answers();
assert_eq!(pictures(app, app.session.active().unwrap().uid, kept), 0, "a file arriving after cancellation is not inserted");
inbox.lock().expect("inbox").push(InboxEvent::Cancelled { id: dismiss });
deliver(&inbox, dismiss, "late.png", png());
deliver(&inbox, deleted_slide, "gone.png", png());
// An id that was never started must not insert either.
deliver(&inbox, 999, "stray.png", png());
app.drain_inbox();
deliver(&files, deleted_slide, "gone.png", png());
// An unknown ticket has no operation or captured document to apply.
deliver(&files, PickId(999), "stray.png", png());
app.take_file_answers();
app.take_file_answers();
assert_eq!(pictures(&app, app.session.active().unwrap().uid, kept), 0);
assert_eq!(pictures(app, app.session.active().unwrap().uid, kept), 0);
let status = app.status.as_ref().map(|(t, _)| t.as_str()).unwrap_or("");
assert!(status.contains("deleted"), "{status}");
@@ -156,34 +159,16 @@ fn a_closed_or_cancelled_request_does_not_insert_into_the_active_document() {
// The deleted-slide request was already consumed. Start another and close before it arrives.
let closed = app.session.active().unwrap().uid;
app.pick_and_insert("audio", "insert.audio");
let audio_id = started.lock().expect("request log").last().unwrap().1;
let audio_id = app.pending_files.last().unwrap().ticket;
app.session.execute("file.close", &json!({})).unwrap();
app.session.execute("file.new", &json!({})).unwrap();
let other = app.session.active().unwrap().uid;
assert_ne!(closed, other);
deliver(&inbox, audio_id, "tone.wav", wav());
app.drain_inbox();
deliver(&files, audio_id, "tone.wav", wav());
app.take_file_answers();
let st = app.session.documents().iter().find(|d| d.uid == other).unwrap();
let n = st.doc.slides.iter().flat_map(|s| s.shapes.iter()).filter(|s| matches!(s.kind, ShapeKind::Media(_))).count();
assert_eq!(n, 0, "a file for a closed presentation is not inserted into the one now open");
let status = app.status.as_ref().map(|(t, _)| t.as_str()).unwrap_or("");
assert!(status.contains("closed"), "{status}");
}
/// A drop is bound to the slide under the pointer at drop time, not the slide current when
/// the bytes have been read.
#[test]
fn a_dropped_file_stays_on_the_slide_it_was_dropped_on() {
let (mut app, inbox, _) = setup();
let uid = app.session.active().unwrap().uid;
let slide0 = app.session.active().unwrap().current_slide().unwrap().id;
let id = app.begin_external_file("drop");
app.session.execute("slide.new", &json!({})).unwrap();
let slide1 = app.session.active().unwrap().current_slide().unwrap().id;
deliver(&inbox, id, "shot.png", png());
app.drain_inbox();
assert_eq!(app.session.active().unwrap().current_slide().unwrap().id, slide1, "the view stays on the slide the user moved to");
let status = app.status.as_ref().map(|(t, _)| t.clone()).unwrap_or_default();
assert_eq!(pictures(&app, uid, slide0), 1, "{status}");
assert_eq!(pictures(&app, uid, slide1), 0);
}