Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

UI.9: repin craft-ui; a press on a sequence tab focuses the Timeline

aiongg218c03fd7510
diff --git a/Cargo.lock b/Cargo.lock
index 1fedda6ef..93a9b67d9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1019,7 +1019,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=82a24b006eefa036b43c09
[[package]]
name = "craft-ui"
version = "0.1.0"
-source = "git+https://github.com/storytold/craft-libs?rev=3600104e7632336be5312b6e6f62b5acf2ea37e7#3600104e7632336be5312b6e6f62b5acf2ea37e7"
+source = "git+https://github.com/storytold/craft-libs?rev=07585888d6db7033099e915f5ad2317eec38c40d#07585888d6db7033099e915f5ad2317eec38c40d"
dependencies = [
"egui",
"serde",
diff --git a/Cargo.toml b/Cargo.toml
index aea89196d..8e70fe591 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -74,7 +74,7 @@ craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-l
# ui
# Shared frontend components; keep this dependency above the engine boundary.
-craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3600104e7632336be5312b6e6f62b5acf2ea37e7", features = ["serde"] }
+craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "07585888d6db7033099e915f5ad2317eec38c40d", features = ["serde"] }
egui = "0.36"
eframe = { version = "0.36", default-features = false }
egui_kittest = "0.36"
diff --git a/crates/ui-egui/tests/shared_docking_ui.rs b/crates/ui-egui/tests/shared_docking_ui.rs
index 39af6d24e..ce0dbd444 100644
--- a/crates/ui-egui/tests/shared_docking_ui.rs
+++ b/crates/ui-egui/tests/shared_docking_ui.rs
@@ -663,3 +663,25 @@ fn window_layer(h: &Harness<'_, FilmcraftApp>, panel: PanelKind) -> egui::LayerI
let window = h.state().ui.dock.floating.iter().find(|window| window.contains(&panel)).unwrap();
DockArea::floating_layer(filmcraft_ui_egui::dock_area_id(), window).unwrap()
}
+
+fn demo_harness() -> Harness<'static, FilmcraftApp> {
+ let mut session = Session::default();
+ session.execute("file.openDemoProject", json!({})).unwrap();
+ let app = FilmcraftApp::new(session);
+ let mut h = Harness::builder().with_size(vec2(1400.0, 900.0)).build_eframe(move |_| app);
+ for _ in 0..4 {
+ step(&mut h);
+ }
+ h
+}
+
+/// Clicking the Timeline's active sequence tab, in its group header, focuses the Timeline.
+#[test]
+fn clicking_the_active_sequence_tab_focuses_the_timeline() {
+ let mut h = demo_harness();
+ click(&mut h, "panel.tab.Project");
+ assert_eq!(h.state().ui.focused, PanelKind::Project);
+ let active = h.state().session.state.active_sequence.unwrap().0;
+ click(&mut h, &format!("timeline.tab.{active}"));
+ assert_eq!(h.state().ui.focused, PanelKind::Timeline);
+}