From add0ace8f7b3de69679436aba80b1c7c7546633f Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 10 May 2026 00:37:43 +0200 Subject: Add shuffle restore tests, remove debug prints, update TODO --- tests/queue.rs | 50 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 9 deletions(-) (limited to 'tests/queue.rs') diff --git a/tests/queue.rs b/tests/queue.rs index e511612..438fa23 100644 --- a/tests/queue.rs +++ b/tests/queue.rs @@ -549,7 +549,10 @@ fn test_shuffle_all_then_none_exact_scenario() { q.set_position(3); let current_before = q.current().unwrap().path.clone(); - println!("Current before restore: {:?}", current_before.file_name().unwrap()); + println!( + "Current before restore: {:?}", + current_before.file_name().unwrap() + ); println!("Position: {}", q.position()); // Now shuffle none @@ -557,7 +560,11 @@ fn test_shuffle_all_then_none_exact_scenario() { println!("After restore:"); for i in 0..q.len() { - println!(" {}: {:?}", i+1, q.track_at(i).unwrap().path.file_name().unwrap()); + println!( + " {}: {:?}", + i + 1, + q.track_at(i).unwrap().path.file_name().unwrap() + ); } // After restore: @@ -567,7 +574,10 @@ fn test_shuffle_all_then_none_exact_scenario() { assert_eq!(q.position(), 3, "position should stay same"); let current_after = q.current().unwrap().path.clone(); - assert_eq!(current_before, current_after, "current track should stay same"); + assert_eq!( + current_before, current_after, + "current track should stay same" + ); } #[test] @@ -597,10 +607,17 @@ fn test_shuffle_restore_simulation() { println!("After 4 next() calls:"); println!(" Position: {}", q.position()); - println!(" Current: {:?}", q.current().unwrap().path.file_name().unwrap()); + println!( + " Current: {:?}", + q.current().unwrap().path.file_name().unwrap() + ); println!(" Tracks:"); for i in 0..q.len() { - println!(" {}: {:?}", i, q.track_at(i).unwrap().path.file_name().unwrap()); + println!( + " {}: {:?}", + i, + q.track_at(i).unwrap().path.file_name().unwrap() + ); } let current_path = q.current().unwrap().path.clone(); @@ -611,20 +628,35 @@ fn test_shuffle_restore_simulation() { println!("After shuffle none:"); println!(" Position: {}", q.position()); - println!(" Current: {:?}", q.current().unwrap().path.file_name().unwrap()); + println!( + " Current: {:?}", + q.current().unwrap().path.file_name().unwrap() + ); println!(" Tracks:"); for i in 0..q.len() { - println!(" {}: {:?}", i, q.track_at(i).unwrap().path.file_name().unwrap()); + println!( + " {}: {:?}", + i, + q.track_at(i).unwrap().path.file_name().unwrap() + ); } // Assertions assert_eq!(q.position(), pos_before, "position should be preserved"); - assert_eq!(q.current().unwrap().path, current_path, "current track should be preserved"); + assert_eq!( + q.current().unwrap().path, + current_path, + "current track should be preserved" + ); // The key requirement: tracks before current position should remain in played order // and tracks after should be remaining from original in original order let pos = q.position(); for i in 0..pos { - println!("Played track {}: {:?}", i, q.track_at(i).unwrap().path.file_name().unwrap()); + println!( + "Played track {}: {:?}", + i, + q.track_at(i).unwrap().path.file_name().unwrap() + ); } } -- cgit v1.2.3