FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust
NEST13: sequence tabs get Premiere's menu, drag to reorder and a list for tabs that do not fit
justjohn123456cff0f0b5d89
diff --git a/crates/engine/src/commands.rs b/crates/engine/src/commands.rsindex 589ce012c..2fe4a3d22 100644--- a/crates/engine/src/commands.rs+++ b/crates/engine/src/commands.rs@@ -1280,6 +1280,30 @@ fn build() -> Vec<CommandSpec> {}Ok(Value::Null)}),+ cmd!("sequence.closeOthers", "Close Other Timeline Panels", [], None, r#"{"item":id?}"#, has_seq, |s, p| {+ let id = item_p(p, "item").or(s.state.active_sequence).ok_or(EngineError::NoSequence)?;+ if !s.state.open_sequences.contains(&id) {+ return Err(bad("sequence.closeOthers", "that sequence is not open"));+ }+ let closed = s.state.open_sequences.len().saturating_sub(1);+ s.state.open_sequences = vec![id];+ if s.state.active_sequence != Some(id) {+ s.state.active_sequence = Some(id);+ s.state.selection.clear();+ s.events.push(crate::Event::OpenSequence(id));+ }+ Ok(json!({"closed": closed}))+ }),+ cmd!("sequence.moveTab", "Move Sequence Tab", [], None, r#"{"item":id?,"index":int}"#, has_seq, |s, p| {+ let id = item_p(p, "item").or(s.state.active_sequence).ok_or(EngineError::NoSequence)?;+ let to = u64_p(p, "index").ok_or_else(|| bad("sequence.moveTab", "need `index`"))?;+ let from = s.state.open_sequences.iter().position(|x| *x == id).ok_or_else(|| bad("sequence.moveTab", "that sequence is not open"))?;+ // past the end is the end+ let to = usize::try_from(to).unwrap_or(usize::MAX).min(s.state.open_sequences.len().saturating_sub(1));+ let tab = s.state.open_sequences.remove(from);+ s.state.open_sequences.insert(to, tab);+ Ok(json!({"index": to}))+ }),cmd!("sequence.addEdit", "Add Edit", ["Sequence"], Some("Cmd+K"), r#"{"time":ticks?}"#, has_seq, |s, p| {let t = time_p(s, p, "").unwrap_or(s.playhead());let tg = s.targeting().targeted;diff --git a/crates/engine/src/sequence_tabs_tests.rs b/crates/engine/src/sequence_tabs_tests.rsindex abccd31f8..c0c7b12d0 100644--- a/crates/engine/src/sequence_tabs_tests.rs+++ b/crates/engine/src/sequence_tabs_tests.rs@@ -1,5 +1,5 @@-//! The Timeline's sequence tabs: every sequence has its own view (zoom, scroll, track heights).-//! Premiere's behaviour was observed in Premiere Pro 26.5.2.+//! The Timeline's sequence tabs: every sequence has its own view (zoom, scroll, track heights);+//! closing the other tabs; reordering. Premiere's behaviour was observed in Premiere Pro 26.5.2.use super::*;use filmcraft_project::SequenceView;@@ -21,6 +21,42 @@ fn view(pps: f64, scroll: f64) -> SequenceView {SequenceView { pps, scroll, v_scroll: 12.0, a_scroll: 7.0, video_track_h: 90.0, audio_track_h: 40.0 }}+#[test]+fn close_others_keeps_one_tab_and_shows_it() {+ let (mut s, [main, b, c]) = three_tabs();+ // from the active tab+ assert_eq!(s.execute("sequence.closeOthers", json!({})).unwrap()["closed"], json!(2));+ assert_eq!((s.state.open_sequences.clone(), s.state.active_sequence), (vec![c], Some(c)));+ // from another tab: that one becomes the active one+ let (mut s, _) = three_tabs();+ s.drain_events();+ s.execute("sequence.closeOthers", json!({"item": b.0})).unwrap();+ assert_eq!((s.state.open_sequences.clone(), s.state.active_sequence), (vec![b], Some(b)));+ assert!(s.drain_events().contains(&Event::OpenSequence(b)));+ // a sequence that is not open cannot be the one to keep+ s.execute("sequence.close", json!({})).unwrap();+ assert!(s.execute("sequence.closeOthers", json!({"item": main.0})).is_err());+}++#[test]+fn a_tab_moves_to_another_place_among_the_tabs() {+ let (mut s, [main, b, c]) = three_tabs();+ let (revision, steps) = (s.revision, s.history.undo.len());+ s.execute("sequence.moveTab", json!({"item": c.0, "index": 0})).unwrap();+ assert_eq!(s.state.open_sequences, [c, main, b]);+ assert_eq!(s.state.active_sequence, Some(c), "moving a tab does not change which is shown");+ s.execute("sequence.moveTab", json!({"item": c.0, "index": 1})).unwrap();+ assert_eq!(s.state.open_sequences, [main, c, b]);+ // past the end is the end; the active tab is the default+ assert_eq!(s.execute("sequence.moveTab", json!({"index": u64::MAX})).unwrap()["index"], json!(2));+ assert_eq!(s.state.open_sequences, [main, b, c]);+ // not an undo step, not an edit+ assert_eq!((s.revision, s.history.undo.len()), (revision, steps));+ s.execute("sequence.close", json!({"item": b.0})).unwrap();+ assert!(s.execute("sequence.moveTab", json!({"item": b.0, "index": 0})).is_err());+ assert!(s.execute("sequence.moveTab", json!({"item": c.0})).is_err());+}+#[test]fn the_view_of_a_deleted_sequence_is_forgotten() {let (mut s, [main, b, c]) = three_tabs();diff --git a/crates/ui-egui/src/dock.rs b/crates/ui-egui/src/dock.rsindex e0f1df8fe..d09d80412 100644--- a/crates/ui-egui/src/dock.rs+++ b/crates/ui-egui/src/dock.rs@@ -356,6 +356,8 @@ pub enum DockAction {/// A sequence tab of the Timeline panel was clicked / closed (project item id).OpenSequence(u64),CloseSequence(u64),+ /// A sequence tab was dragged past a neighbour: its new place among the sequence tabs.+ MoveSequence(u64, usize),}/// Size of a split's first child in `avail` points: the requested size, keeping both children at@@ -477,29 +479,67 @@ pub fn draw_group_chrome(None => actions.push(DockAction::Activate(tab.panel)),};let active_at = tabs.iter().position(|tab| tab.active).unwrap_or(0);- let mut x = strip.min.x + 12.0;let text_y = strip.min.y + 16.0;- for (i, tab) in tabs.iter().enumerate() {+ // Which tabs fit. The active tab is always shown: tabs before it are left out until it+ // fits, then as many after it as there is room for. Tabs that are left out are reached+ // through the » list at the right end of the strip.+ let widths: Vec<f32> = tabs+ .iter()+ .map(|tab| {+ let label = painter.layout_no_wrap(tab.title.clone(), Tokens::ui(12.0), t.tab_text).size().x;+ label + 16.0 + if tab.active { 20.0 } else { 0.0 } + if tab.active && tab.seq.is_some() { 16.0 } else { 0.0 }+ })+ .collect();+ let span = |from: usize, to: usize| widths.get(from..=to).map_or(0.0, |w| w.iter().sum::<f32>() + 8.0 * w.len() as f32);+ let room = strip.width() - 12.0;+ let all_fit = span(0, tabs.len().saturating_sub(1)) <= room;+ let room = if all_fit { room } else { room - 24.0 };+ let mut first = 0;+ while first < active_at && span(first, active_at) > room {+ first += 1;+ }+ let mut last = active_at.max(first);+ while last + 1 < tabs.len() && span(first, last + 1) <= room {+ last += 1;+ }+ let list_id = egui::Id::new(("tab-list", g.path.clone()));+ let more = (!all_fit).then(|| Rect::from_min_size(pos2(strip.max.x - 22.0, strip.min.y + 6.0), vec2(18.0, 20.0)));+ let mut list_opened = false;+ if let Some(r) = more {+ let resp = ui.interact(r, egui::Id::new(("tab-overflow", g.path.clone())), Sense::click());+ let name = if g.panels.contains(&PanelKind::Timeline) { "timeline.tabs.more".to_string() } else { format!("panel.tabs.more.{}", g.path) };+ reg.add(&name, r, "more tabs");+ let c = if resp.hovered() { t.tab_text_active } else { t.tab_text };+ icons::paint(&painter, r.shrink(4.0).translate(vec2(-2.0, 0.0)), Icon::ChevronRight, c);+ icons::paint(&painter, r.shrink(4.0).translate(vec2(2.0, 0.0)), Icon::ChevronRight, c);+ if resp.clicked() {+ let open = ui.ctx().data(|d| d.get_temp::<bool>(list_id)).unwrap_or(false);+ ui.ctx().data_mut(|d| d.insert_temp(list_id, !open));+ list_opened = !open;+ }+ }+ let mut x = strip.min.x + 12.0;+ // sequence tabs as drawn (for dragging one past its neighbours), and the one being dragged+ let mut seq_rects: Vec<(u64, Rect)> = Vec::new();+ let mut dragged: Option<u64> = None;+ for (i, tab) in tabs.iter().enumerate().take(last + 1).skip(first) {let p = &tab.panel;let is_active = tab.active;let galley = painter.layout_no_wrap(tab.title.clone(), Tokens::ui(12.0), if is_active { t.tab_text_active } else { t.tab_text });- let menu_w = if is_active { 20.0 } else { 0.0 };let close_w = if is_active && tab.seq.is_some() { 16.0 } else { 0.0 };- let w = galley.size().x + 16.0 + menu_w + close_w;- if x + w > strip.max.x - 20.0 && i > active_at {- let r = Rect::from_min_size(pos2(strip.max.x - 22.0, strip.min.y + 6.0), vec2(18.0, 20.0));- let resp = ui.interact(r, egui::Id::new(("tab-overflow", g.path.clone())), Sense::click());- icons::paint(&painter, r.shrink(4.0).translate(vec2(-2.0, 0.0)), Icon::ChevronRight, t.tab_text);- icons::paint(&painter, r.shrink(4.0).translate(vec2(2.0, 0.0)), Icon::ChevronRight, t.tab_text);- if resp.clicked()- && let Some(next) = tabs.get((active_at + 1) % tabs.len())- {- activate(next, &mut actions);+ let w = widths.get(i).copied().unwrap_or(0.0);+ let tab_rect = Rect::from_min_size(pos2(x, strip.min.y), vec2(w, t.tab_h));+ // a sequence tab keeps its identity when the tabs are reordered under the pointer+ let resp = match tab.seq {+ Some(id) => ui.interact(tab_rect, egui::Id::new(("tab-seq", g.path.clone(), id)), Sense::click_and_drag()),+ None => ui.interact(tab_rect, egui::Id::new(("tab", g.path.clone(), i)), Sense::click()),+ };+ if let Some(id) = tab.seq {+ seq_rects.push((id, tab_rect));+ if resp.dragged() {+ dragged = Some(id);}- break;}- let tab_rect = Rect::from_min_size(pos2(x, strip.min.y), vec2(w, t.tab_h));- let resp = ui.interact(tab_rect, egui::Id::new(("tab", g.path.clone(), i)), Sense::click());if let Some(id) = tab.seq {reg.add(&format!("timeline.tab.{id}"), tab_rect, &tab.title);}@@ -539,10 +579,17 @@ pub fn draw_group_chrome(actions.push(DockAction::PanelMenu(*p, mr.left_bottom()));}}- if resp.clicked() && !closed {+ if (resp.clicked() || resp.drag_started()) && !closed {activate(tab, &mut actions);actions.push(DockAction::Focus(*p));}+ // a right-click shows the tab and opens its panel menu (as in Premiere)+ if resp.secondary_clicked() {+ activate(tab, &mut actions);+ actions.push(DockAction::Focus(*p));+ let at = resp.interact_pointer_pos().unwrap_or(tab_rect.left_bottom());+ actions.push(DockAction::PanelMenu(*p, at));+ }if resp.middle_clicked() {// a sequence tab closes its sequence; the Timeline panel itself staysmatch tab.seq.or(seqs.active.filter(|_| *p == PanelKind::Timeline)) {@@ -552,6 +599,57 @@ pub fn draw_group_chrome(}x += w + 8.0;}+ // Dragging a sequence tab sideways: it changes places with a neighbour when the pointer+ // passes that neighbour's middle.+ if let Some(id) = dragged+ && let Some(px) = ui.input(|i| i.pointer.latest_pos()).map(|p| p.x)+ && let Some(at) = seq_rects.iter().position(|(s, _)| *s == id)+ && let Some(index) = seqs.open.iter().position(|(s, _)| *s == id)+ {+ let before = at.checked_sub(1).and_then(|k| seq_rects.get(k));+ let after = seq_rects.get(at + 1);+ if before.is_some_and(|(_, r)| px < r.center().x) {+ actions.push(DockAction::MoveSequence(id, index.saturating_sub(1)));+ } else if after.is_some_and(|(_, r)| px > r.center().x) {+ actions.push(DockAction::MoveSequence(id, index + 1));+ }+ }+ // the » list: every tab of the group, the shown one ticked+ let list_open = ui.ctx().data(|d| d.get_temp::<bool>(list_id)).unwrap_or(false);+ if let Some(r) = more.filter(|_| list_open) {+ let mut picked = None;+ let area = egui::Area::new(list_id.with("area")).order(egui::Order::Foreground).pivot(Align2::RIGHT_TOP).fixed_pos(r.right_bottom()).show(+ ui.ctx(),+ |ui| {+ egui::Frame::popup(ui.style()).show(ui, |ui| {+ ui.set_min_width(160.0);+ // many open sequences: the list scrolls instead of leaving the window+ egui::ScrollArea::vertical().max_height(360.0).show(ui, |ui| {+ for tab in &tabs {+ let label = if tab.active { format!("✓ {}", tab.title) } else { tab.title.clone() };+ let resp = ui.button(label);+ match tab.seq {+ Some(id) => reg.add(&format!("timeline.tabs.list.{id}"), resp.rect, &tab.title),+ None => reg.add(&format!("panel.tabs.list.{}", tab.panel.id()), resp.rect, &tab.title),+ }+ if resp.clicked() {+ picked = Some(tab);+ }+ }+ });+ });+ },+ );+ if let Some(tab) = picked {+ activate(tab, &mut actions);+ actions.push(DockAction::Focus(tab.panel));+ }+ if picked.is_some() || (!list_opened && area.response.clicked_elsewhere()) {+ ui.ctx().data_mut(|d| d.remove::<bool>(list_id));+ }+ } else if list_open {+ ui.ctx().data_mut(|d| d.remove::<bool>(list_id));+ }}// focus outlineif active_panel == Some(focused) {diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 2b28740d0..508ee965e 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -1307,6 +1307,11 @@ impl FilmcraftApp {self.ui.status = e.to_string();}}+ dock::DockAction::MoveSequence(id, index) => {+ if let Err(e) = self.session.execute("sequence.moveTab", json!({"item": id, "index": index})) {+ self.ui.status = e.to_string();+ }+ }dock::DockAction::PanelMenu(p, pos) => {ui.ctx().data_mut(|d| d.insert_temp(egui::Id::new("panel-menu"), (p, pos)));}diff --git a/crates/ui-egui/src/panels/mod.rs b/crates/ui-egui/src/panels/mod.rsindex 1cf8c14d5..1b7423a57 100644--- a/crates/ui-egui/src/panels/mod.rs+++ b/crates/ui-egui/src/panels/mod.rs@@ -187,10 +187,18 @@ pub fn panel_menu_popup(app: &mut FilmcraftApp, ui: &mut egui::Ui) {// the Timeline's tabs are its open sequences: Close Panel closes the active one and// keeps the panel (Premiere's wording and behaviour)if p == PanelKind::Timeline && app.session.state.active_sequence.is_some() {- if ui.button("Close Panel").clicked() {+ let r = ui.button("Close Panel");+ app.auto.add("panel.menu.Timeline.close", r.rect, "Close Panel");+ if r.clicked() {let _ = app.session.execute("sequence.close", serde_json::json!({}));close = true;}+ let r = ui.add_enabled(app.session.state.open_sequences.len() > 1, egui::Button::new("Close Other Timeline Panels"));+ app.auto.add("panel.menu.Timeline.closeOthers", r.rect, "Close Other Timeline Panels");+ if r.clicked() {+ let _ = app.session.execute("sequence.closeOthers", serde_json::json!({}));+ close = true;+ }} else if ui.button("Close Panel").clicked() {app.ui.dock.close(p);close = true;@@ -206,7 +214,9 @@ pub fn panel_menu_popup(app: &mut FilmcraftApp, ui: &mut egui::Ui) {}if p == PanelKind::Timeline {ui.separator();- if ui.add_enabled(app.session.state.active_sequence.is_some(), egui::Button::new("Reveal Sequence in Project")).clicked() {+ let r = ui.add_enabled(app.session.state.active_sequence.is_some(), egui::Button::new("Reveal Sequence in Project"));+ app.auto.add("panel.menu.Timeline.revealSequence", r.rect, "Reveal Sequence in Project");+ if r.clicked() {let _ = app.session.execute("sequence.revealInProject", serde_json::json!({}));close = true;}diff --git a/crates/ui-egui/tests/timeline_tabs_ui.rs b/crates/ui-egui/tests/timeline_tabs_ui.rsindex 4cda8bbf6..1c02ed527 100644--- a/crates/ui-egui/tests/timeline_tabs_ui.rs+++ b/crates/ui-egui/tests/timeline_tabs_ui.rs@@ -1,6 +1,8 @@//! Headless UI tests of the Timeline's sequence tabs: every sequence keeps its own zoom, scroll-//! and track heights. Premiere's behaviour was observed in Premiere Pro 26.5.2.+//! and track heights; a right-click on a tab opens its menu; tabs are reordered by dragging; tabs+//! that do not fit are in a list. Premiere's behaviour was observed in Premiere Pro 26.5.2.+use std::path::PathBuf;use std::sync::mpsc::{Sender, channel};use egui_kittest::Harness;@@ -13,6 +15,8 @@ use serde_json::{Value, json};struct Driver {harness: Harness<'static, FilmcraftApp>,tx: Sender<ControlRequest>,+ /// `FILMCRAFT_UI_SNAPSHOT_DIR`: where to write PNGs of the window (rendered with wgpu).+ snapshots: Option<PathBuf>,}impl Driver {@@ -21,8 +25,13 @@ impl Driver {s.execute("file.openDemoProject", json!({})).unwrap();let (tx, rx) = channel();let app = FilmcraftApp::new(s).with_control(rx);- let harness = Harness::builder().with_size(egui::vec2(1600.0, 980.0)).with_max_steps(10_000).build_eframe(move |_cc| app);- let mut d = Driver { harness, tx };+ let snapshots = std::env::var_os("FILMCRAFT_UI_SNAPSHOT_DIR").map(PathBuf::from);+ let mut b = Harness::builder().with_size(egui::vec2(1600.0, 980.0)).with_max_steps(10_000);+ if snapshots.is_some() {+ b = b.wgpu();+ }+ let harness = b.build_eframe(move |_cc| app);+ let mut d = Driver { harness, tx, snapshots };d.frames(4);d}@@ -66,17 +75,44 @@ impl Driver {}impl Driver {+ fn snapshot(&mut self, name: &str) {+ let Some(dir) = self.snapshots.clone() else { return };+ self.frames(3);+ match self.harness.render() {+ Ok(img) => {+ std::fs::create_dir_all(&dir).unwrap();+ img.save(dir.join(format!("{name}.png"))).unwrap();+ }+ Err(e) => eprintln!("snapshot {name} skipped: {e}"),+ }+ }+fn click(&mut self, id: &str) {self.ok("ui.click", json!({"id": id}));self.frames(3);}+ fn rect(&mut self, id: &str) -> Option<[f64; 4]> {+ let v = self.ok("ui.elements", json!({"prefix": id}));+ let e = v.as_array().unwrap().iter().find(|e| e["id"] == json!(id))?.clone();+ let r = e["rect"].as_array().unwrap();+ Some([r[0].as_f64().unwrap(), r[1].as_f64().unwrap(), r[2].as_f64().unwrap(), r[3].as_f64().unwrap()])+ }++ fn has(&mut self, id: &str) -> bool {+ self.rect(id).is_some()+ }+fn new_sequence(&mut self, name: &str) -> u64 {let id = self.exec("file.newSequence", json!({"name": name}))["sequence"].as_u64().unwrap();self.frames(3);id}+ fn open(&mut self) -> Vec<u64> {+ self.app().session.state.open_sequences.iter().map(|i| i.0).collect()+ }+fn active(&mut self) -> u64 {self.app().session.state.active_sequence.unwrap().0}@@ -86,6 +122,11 @@ impl Driver {let v = &self.app().ui.timeline;(v.target_pps, v.target_scroll, v.video_track_h)}++ fn show(&mut self, seq: u64) {+ self.exec("sequence.open", json!({"item": seq}));+ self.frames(3);+ }}#[test]@@ -117,3 +158,77 @@ fn each_sequence_tab_keeps_its_own_zoom_scroll_and_track_heights() {d.frames(2);assert_eq!(d.view().0, 55.0);}++#[test]+fn a_right_click_on_a_tab_shows_it_and_opens_its_menu() {+ let mut d = Driver::new();+ let main = d.active();+ let (b, c) = (d.new_sequence("B"), d.new_sequence("C"));+ assert_eq!((d.open(), d.active()), (vec![main, b, c], c));+ // Premiere: a right-click on a tab that is not shown shows it and opens the panel menu+ d.ok("ui.click", json!({"id": format!("timeline.tab.{b}"), "button": "right"}));+ d.frames(3);+ assert_eq!(d.active(), b);+ assert!(d.has("panel.menu.Timeline.close") && d.has("panel.menu.Timeline.closeOthers") && d.has("panel.menu.Timeline.revealSequence"));+ d.snapshot("timeline-tab-menu");+ d.click("panel.menu.Timeline.closeOthers");+ assert_eq!((d.open(), d.active()), (vec![b], b));+ assert!(!d.has("panel.menu.Timeline.closeOthers"), "the menu closes");+ // Close Panel from the menu closes the tab it was opened on+ d.show(main);+ d.ok("ui.click", json!({"id": format!("timeline.tab.{b}"), "button": "right"}));+ d.frames(3);+ d.click("panel.menu.Timeline.close");+ assert_eq!((d.open(), d.active()), (vec![main], main));+}++#[test]+fn a_tab_dragged_past_its_neighbours_changes_places_with_them() {+ let mut d = Driver::new();+ let main = d.active();+ let (b, c) = (d.new_sequence("B"), d.new_sequence("C"));+ // the last tab to the left end+ d.ok("ui.drag", json!({"from": {"id": format!("timeline.tab.{c}")}, "to": {"id": format!("timeline.tab.{main}"), "fx": 0.1}, "steps": 12}));+ d.frames(4);+ assert_eq!(d.open(), [c, main, b]);+ assert_eq!(d.active(), c, "the dragged tab is the one shown");+ // and one place to the right again+ d.ok("ui.drag", json!({"from": {"id": format!("timeline.tab.{c}")}, "to": {"id": format!("timeline.tab.{main}"), "fx": 0.9}, "steps": 12}));+ d.frames(4);+ assert_eq!(d.open(), [main, c, b]);+ // a drag that does not reach the middle of a neighbour changes nothing; neither does a click+ let r = d.rect(&format!("timeline.tab.{c}")).unwrap();+ d.ok("ui.drag", json!({"from": {"x": r[0] + 20.0, "y": r[1] + r[3] / 2.0}, "to": {"x": r[0] + 30.0, "y": r[1] + r[3] / 2.0}, "steps": 4}));+ d.frames(4);+ d.click(&format!("timeline.tab.{b}"));+ assert_eq!((d.open(), d.active()), (vec![main, c, b], b));+}++#[test]+fn tabs_that_do_not_fit_are_reached_through_a_list() {+ let mut d = Driver::new();+ let main = d.active();+ assert!(!d.has("timeline.tabs.more"), "no list while every tab fits");+ let mut last = main;+ for i in 0..24 {+ last = d.new_sequence(&format!("A sequence with a long name {i:02}"));+ }+ // the shown tab is always in the strip; the first one no longer fits+ assert!(d.has(&format!("timeline.tab.{last}")) && !d.has(&format!("timeline.tab.{main}")));+ let strip = d.rect("panel.Timeline").unwrap();+ let tab = d.rect(&format!("timeline.tab.{last}")).unwrap();+ assert!(tab[0] >= strip[0] && tab[0] + tab[2] <= strip[0] + strip[2], "the shown tab is inside the panel: {tab:?} in {strip:?}");+ // the list has every open sequence; picking one shows it, and its tab+ d.click("timeline.tabs.more");+ assert!(d.has(&format!("timeline.tabs.list.{last}")));+ d.snapshot("timeline-tab-list");+ d.click(&format!("timeline.tabs.list.{main}"));+ assert_eq!(d.active(), main);+ assert!(d.has(&format!("timeline.tab.{main}")) && !d.has(&format!("timeline.tab.{last}")));+ assert!(!d.has(&format!("timeline.tabs.list.{main}")), "the list closes");+ // it also closes on a click elsewhere+ d.click("timeline.tabs.more");+ assert!(d.has(&format!("timeline.tabs.list.{last}")));+ d.click("panel.Program");+ assert!(!d.has(&format!("timeline.tabs.list.{last}")));+}