From 5ac14f20150539670df70151f833752faf516d0d Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Mon, 19 Oct 2026 00:44:03 +0200 Subject: [PATCH] Test: modify the slide through Arc::make_mut (#1005) --- crates/ui-egui/src/show.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/show.rs b/crates/ui-egui/src/show.rs index 3f5aba28..4915c2ea 100644 --- a/crates/ui-egui/src/show.rs +++ b/crates/ui-egui/src/show.rs @@ -1973,14 +1973,15 @@ mod tests { } let mut doc = (*session.active().unwrap().doc).clone(); // Keep only the three inserted rects (a new slide may start with placeholders). - let keep = doc.slides[0].shapes.len() - 3; - doc.slides[0].shapes.drain(..keep); - let ids: Vec = doc.slides[0].shapes.iter().map(|s| s.id).collect(); - doc.slides[0].shapes[1].kind = deckcraft_model::ShapeKind::Media(deckcraft_model::MediaClip { video: true, ..Default::default() }); + let slide = std::sync::Arc::make_mut(&mut doc.slides[0]); + let keep = slide.shapes.len() - 3; + slide.shapes.drain(..keep); + let ids: Vec = slide.shapes.iter().map(|s| s.id).collect(); + slide.shapes[1].kind = deckcraft_model::ShapeKind::Media(deckcraft_model::MediaClip { video: true, ..Default::default() }); // Video in the middle: the shape above it is drawn over it. assert_eq!(below_playing_video(&doc, 0, &[ids[1]]), vec![ids[0], ids[1]]); // Video on top: nothing above it, the frame is painted last as before. - doc.slides[0].shapes.swap(1, 2); + std::sync::Arc::make_mut(&mut doc.slides[0]).shapes.swap(1, 2); assert!(below_playing_video(&doc, 0, &[ids[1]]).is_empty()); // No video playing. assert!(below_playing_video(&doc, 0, &[]).is_empty());