From 0f00616dca071750381234b5c59c8ec1e71b28ed Mon Sep 17 00:00:00 2001 From: salmonik Date: Fri, 8 May 2026 01:12:31 +0200 Subject: Fix shuffle first song not being shuffled update_shuffle_indices now shuffles all indices when position is 0 (no tracks have been played yet), so the first track played is random instead of always being tracks[0]. Directory playback now uses q.current() to pick the first track, resolving through shuffled indices when shuffle is active. Also pins notify-rust version in Cargo.toml and removes PLAN.md (superseded by TODO.md). --- tests/queue.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/queue.rs b/tests/queue.rs index 0ceaba0..d3e923e 100644 --- a/tests/queue.rs +++ b/tests/queue.rs @@ -269,8 +269,6 @@ fn test_shuffle_all_navigates_in_shuffled_order() { add_track(&mut q, &format!("/music/song{}.mp3", i)); } q.set_shuffle(ShuffleMode::All); - // Current should still return the first track - assert_eq!(q.current().unwrap().path, PathBuf::from("/music/song0.mp3")); // Navigate through all tracks, should visit all 10 (in shuffled order) let mut visited = std::collections::HashSet::new(); visited.insert(q.current().unwrap().path.clone()); @@ -291,7 +289,9 @@ fn test_shuffle_all_current_stays_at_position_zero() { } q.set_shuffle(ShuffleMode::All); assert_eq!(q.position(), 0); - assert_eq!(q.shuffled_indices()[0], 0); + let mut sorted = q.shuffled_indices().to_vec(); + sorted.sort(); + assert_eq!(sorted, vec![0, 1, 2, 3, 4]); } #[test] -- cgit v1.2.3