Extend incremental search to albums and tracks #152

Merged
wojtek merged 7 commits from 145---extend-incremental-search-to-albums-and-tracks into main 2024-03-01 22:04:26 +01:00
Showing only changes of commit 90237fb77e - Show all commits

View File

@ -372,6 +372,50 @@ mod tests {
assert_eq!(search.inner.selection.artist.state.list.selected(), Some(3));
}
#[test]
fn album_incremental_search() {
let mut search =
AppMachine::search(inner(music_hoard(COLLECTION.to_owned())), orig(Some(1)));
search.inner.selection.active = Category::Album;
let sel = &search.inner.selection;
assert_eq!(sel.artist.album.state.list.selected(), Some(0));
search.state.string = String::from("album_title ");
search.incremental_search(false);
let sel = &search.inner.selection;
assert_eq!(sel.artist.album.state.list.selected(), Some(0));
search.state.string = String::from("album_title a.b");
search.incremental_search(false);
let sel = &search.inner.selection;
assert_eq!(sel.artist.album.state.list.selected(), Some(1));
}
#[test]
fn track_incremental_search() {
let mut search =
AppMachine::search(inner(music_hoard(COLLECTION.to_owned())), orig(Some(1)));
search.inner.selection.active = Category::Track;
let sel = &search.inner.selection;
assert_eq!(sel.artist.album.track.state.list.selected(), Some(0));
search.state.string = String::from("track ");
search.incremental_search(false);
let sel = &search.inner.selection;
assert_eq!(sel.artist.album.track.state.list.selected(), Some(0));
search.state.string = String::from("track a.a.2");
search.incremental_search(false);
let sel = &search.inner.selection;
assert_eq!(sel.artist.album.track.state.list.selected(), Some(1));
}
#[test]
fn search() {
let search = AppMachine::search(inner(music_hoard(COLLECTION.to_owned())), orig(Some(2)));