diff options
| author | salmonik <raisersoft@proton.me> | 2026-05-08 01:20:43 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-05-08 01:20:43 +0200 |
| commit | 5c3110c7843773e617c224e16f150b25884d3fb6 (patch) | |
| tree | 883b436437ee8c81794a261b242f750e286d8c82 /tests/queue.rs | |
| parent | Fix shuffle first song not being shuffled (diff) | |
| download | rsplayer-5c3110c7843773e617c224e16f150b25884d3fb6.tar.gz rsplayer-5c3110c7843773e617c224e16f150b25884d3fb6.zip | |
Pad queue display numbers with leading zeros
display_string now takes a total parameter to compute the
zero-padding width. Queue positions are formatted as 01, 02, ..., 10
instead of 1, 2, ..., 10, keeping columns aligned.
Diffstat (limited to '')
| -rw-r--r-- | tests/queue.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/queue.rs b/tests/queue.rs index d3e923e..bff83ca 100644 --- a/tests/queue.rs +++ b/tests/queue.rs | |||
| @@ -214,7 +214,7 @@ fn test_track_display_with_metadata() { | |||
| 214 | Some("Test Artist"), | 214 | Some("Test Artist"), |
| 215 | Some("Test Album"), | 215 | Some("Test Album"), |
| 216 | ); | 216 | ); |
| 217 | let display = t.display_string(0); | 217 | let display = t.display_string(0, 1); |
| 218 | assert_eq!(display, "1. Test Artist - Test Title"); | 218 | assert_eq!(display, "1. Test Artist - Test Title"); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| @@ -226,14 +226,14 @@ fn test_track_display_artist_fallback_to_album() { | |||
| 226 | None, | 226 | None, |
| 227 | Some("Test Album"), | 227 | Some("Test Album"), |
| 228 | ); | 228 | ); |
| 229 | let display = t.display_string(0); | 229 | let display = t.display_string(0, 1); |
| 230 | assert_eq!(display, "1. Test Album - Test Title"); | 230 | assert_eq!(display, "1. Test Album - Test Title"); |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | #[test] | 233 | #[test] |
| 234 | fn test_track_display_no_metadata() { | 234 | fn test_track_display_no_metadata() { |
| 235 | let t = track_no_meta("/music/song.mp3"); | 235 | let t = track_no_meta("/music/song.mp3"); |
| 236 | let display = t.display_string(0); | 236 | let display = t.display_string(0, 1); |
| 237 | assert_eq!(display, "1. song.mp3"); | 237 | assert_eq!(display, "1. song.mp3"); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| @@ -245,7 +245,7 @@ fn test_track_display_index_offset() { | |||
| 245 | Some("Artist"), | 245 | Some("Artist"), |
| 246 | Some("Album"), | 246 | Some("Album"), |
| 247 | ); | 247 | ); |
| 248 | assert_eq!(t.display_string(4), "5. Artist - Title"); | 248 | assert_eq!(t.display_string(4, 10), "05. Artist - Title"); |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | // ---------- Shuffle ---------- | 251 | // ---------- Shuffle ---------- |
