Extend incremental search to albums and tracks #152
@ -372,6 +372,50 @@ mod tests {
|
|||||||
assert_eq!(search.inner.selection.artist.state.list.selected(), Some(3));
|
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]
|
#[test]
|
||||||
fn search() {
|
fn search() {
|
||||||
let search = AppMachine::search(inner(music_hoard(COLLECTION.to_owned())), orig(Some(2)));
|
let search = AppMachine::search(inner(music_hoard(COLLECTION.to_owned())), orig(Some(2)));
|
||||||
|
Loading…
Reference in New Issue
Block a user