fix: preserve video selection order for playback
This commit is contained in:
+14
-4
@@ -68,7 +68,7 @@ fn app(args: &[&str]) -> App {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn playback_checks_follow_ids_across_feed_sort_and_clear_on_replacement() {
|
||||
fn playback_checks_preserve_check_order_across_feed_sort_and_clear_on_replacement() {
|
||||
let mut app = app(&["tubular"]);
|
||||
app.view_index = 1;
|
||||
app.feed_channels = vec!["https://www.youtube.com/@fixture".into()];
|
||||
@@ -87,7 +87,7 @@ fn playback_checks_follow_ids_across_feed_sort_and_clear_on_replacement() {
|
||||
.iter()
|
||||
.map(|video| video.id.as_str())
|
||||
.collect::<Vec<_>>(),
|
||||
["rQ_J9WH6CGk", "jNQXAC9IVRw"],
|
||||
["jNQXAC9IVRw", "rQ_J9WH6CGk"],
|
||||
);
|
||||
finish_feed_fixture(
|
||||
&mut app,
|
||||
@@ -96,6 +96,16 @@ fn playback_checks_follow_ids_across_feed_sort_and_clear_on_replacement() {
|
||||
);
|
||||
let view = &mut app.views[1];
|
||||
assert_eq!(view.selection.selected(), Some(1));
|
||||
assert_eq!(
|
||||
view.playback_videos()
|
||||
.iter()
|
||||
.map(|video| video.id.as_str())
|
||||
.collect::<Vec<_>>(),
|
||||
["jNQXAC9IVRw", "rQ_J9WH6CGk"],
|
||||
);
|
||||
view.selection.select(Some(2));
|
||||
view.toggle_checked();
|
||||
view.toggle_checked();
|
||||
assert_eq!(
|
||||
view.playback_videos()
|
||||
.iter()
|
||||
@@ -251,7 +261,7 @@ fn playback_checks_survive_spawn_failure_clear_after_spawn_and_fall_back_to_hove
|
||||
app.options.player = "/nonexistent/tubular-test-player".into();
|
||||
app.key(KeyEvent::new(KeyCode::Enter, modifiers));
|
||||
assert!(app.player_launch.is_none());
|
||||
assert!(app.views[0].checked.contains("rQ_J9WH6CGk"));
|
||||
assert!(app.views[0].checked.iter().any(|id| id == "rQ_J9WH6CGk"));
|
||||
assert_eq!(app.views[0].playback_videos()[0].id, "rQ_J9WH6CGk");
|
||||
app.options.player = "/usr/bin/true".into();
|
||||
app.key(KeyEvent::new(KeyCode::Enter, modifiers));
|
||||
@@ -6069,7 +6079,7 @@ fn escape_discards_checks_without_consuming_view_history() {
|
||||
app.views[0].loaded = true;
|
||||
app.views[1].loaded = true;
|
||||
app.switch_view(1);
|
||||
app.views[1].checked.insert("jNQXAC9IVRw".into());
|
||||
app.views[1].checked.push("jNQXAC9IVRw".into());
|
||||
app.key(KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE));
|
||||
assert!(app.views[1].checked.is_empty());
|
||||
assert_eq!(app.view_index, 1);
|
||||
|
||||
Reference in New Issue
Block a user