aboutsummaryrefslogtreecommitdiffstats
path: root/tests/queue.rs
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2026-05-11 16:25:49 +0200
committersalmonik <raisersoft@proton.me>2026-05-11 16:25:49 +0200
commit455ec54613230f4004a24f8d2798fb0084e00cb4 (patch)
tree5ffb7606a11ebf33ea940f068ed046bfda0f0c54 /tests/queue.rs
parentFix shuffle to not shuffle current track - only shuffle tracks after current ... (diff)
downloadrsplayer-455ec54613230f4004a24f8d2798fb0084e00cb4.tar.gz
rsplayer-455ec54613230f4004a24f8d2798fb0084e00cb4.zip
Add display_format config, fix restart command, clean up config code
- Add display_format option with get/set/list/unset for customizing track display - Add Track::format() supporting $ARTIST, $ALBUM, $TRACK variables - Update queue, status, notifications to use display_format - Fix restart command using wrong subcommand 'start' -> 'start-daemon' - Remove socket_path from config (now computed at runtime from XDG_RUNTIME_DIR) - Consolidate duplicate save() and save_all() into single save() - Fix redundant .clone().clone() in config.rs - Add todo item for caching config in daemon hot paths
Diffstat (limited to '')
-rw-r--r--tests/queue.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/queue.rs b/tests/queue.rs
index 438fa23..a73c312 100644
--- a/tests/queue.rs
+++ b/tests/queue.rs
@@ -248,6 +248,32 @@ fn test_track_display_index_offset() {
248 assert_eq!(t.display_string(4, 10), "05. Artist - Title"); 248 assert_eq!(t.display_string(4, 10), "05. Artist - Title");
249} 249}
250 250
251#[test]
252fn test_track_format_variables() {
253 let t = track(
254 "/music/test.mp3",
255 Some("My Song"),
256 Some("John Doe"),
257 Some("Great Album"),
258 );
259 assert_eq!(t.format("$ARTIST - $TRACK"), "John Doe - My Song");
260 assert_eq!(t.format("$TRACK ($ALBUM)"), "My Song (Great Album)");
261 assert_eq!(t.format("Now playing: $ARTIST"), "Now playing: John Doe");
262}
263
264#[test]
265fn test_track_format_empty_variables() {
266 let t = track_no_meta("/music/test.mp3");
267 assert_eq!(t.format("$ARTIST - $TRACK"), " - test.mp3");
268}
269
270#[test]
271fn test_track_format_missing_variables() {
272 let t = track("/music/test.mp3", Some("My Song"), Some("John Doe"), None);
273 assert_eq!(t.format("Track: $TRACK"), "Track: My Song");
274 assert_eq!(t.format("Album: $ALBUM"), "Album: ");
275}
276
251// ---------- Shuffle ---------- 277// ---------- Shuffle ----------
252 278
253#[test] 279#[test]