From 984b10c5a66a65e68ed1ae035330ecaf4cb84228 Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 25 Nov 2026 20:44:58 +0000 Subject: [PATCH] Preview keeps its 46-point body under the 28-point tab strip; the examples install the UI runtime --- crates/ui-egui/examples/cache_bench.rs | 5 ++++- crates/ui-egui/examples/snapshot.rs | 1 + crates/ui-egui/src/dock.rs | 2 +- crates/ui-egui/tests/it/ui_tabs.rs | 8 ++++---- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/examples/cache_bench.rs b/crates/ui-egui/examples/cache_bench.rs index 43e937c92..0efcdea21 100644 --- a/crates/ui-egui/examples/cache_bench.rs +++ b/crates/ui-egui/examples/cache_bench.rs @@ -225,7 +225,10 @@ fn main() { fn play(session: effectcraft_engine::Session, cid: ItemId, secs: f64, gpu: bool) { use effectcraft_ui_egui::{ControlRequest, EffectcraftApp}; let (tx, rx) = std::sync::mpsc::channel::(); - let builder = egui_kittest::Harness::builder().with_size(egui::vec2(1920.0, 1200.0)).with_pixels_per_point(1.0); + let builder = egui_kittest::Harness::builder() + .with_size(egui::vec2(1920.0, 1200.0)) + .with_pixels_per_point(1.0) + .with_context_setup(effectcraft_ui_egui::framework::install_headless); let builder = if gpu { builder.wgpu() } else { builder }; let mut h = builder.build_eframe(move |_| EffectcraftApp::new(session).with_control(rx)); { diff --git a/crates/ui-egui/examples/snapshot.rs b/crates/ui-egui/examples/snapshot.rs index e15c135bd..0646e5e79 100644 --- a/crates/ui-egui/examples/snapshot.rs +++ b/crates/ui-egui/examples/snapshot.rs @@ -103,6 +103,7 @@ fn main() { .with_size(egui::vec2(args.size.0, args.size.1)) .with_pixels_per_point(args.scale) .wgpu() + .with_context_setup(effectcraft_ui_egui::framework::install_headless) .build_eframe(move |_cc| EffectcraftApp::new(session).with_control(rx)); settle(&mut harness, args.settle); for step in &args.steps { diff --git a/crates/ui-egui/src/dock.rs b/crates/ui-egui/src/dock.rs index 1addcd88c..32bc6ba98 100644 --- a/crates/ui-egui/src/dock.rs +++ b/crates/ui-egui/src/dock.rs @@ -255,7 +255,7 @@ fn workspace_floating(name: &str) -> Vec> { } /// The height of a frame's tab strip ([`Tokens::tab_h`]). -pub const TAB_STRIP: f32 = 30.0; +pub const TAB_STRIP: f32 = 28.0; /// The height of Default's Preview frame: its tab strip over a 46-point body that fits the /// playback controls. pub const PREVIEW_FRAME: f32 = TAB_STRIP + 46.0; diff --git a/crates/ui-egui/tests/it/ui_tabs.rs b/crates/ui-egui/tests/it/ui_tabs.rs index a9df1b556..56104aef6 100644 --- a/crates/ui-egui/tests/it/ui_tabs.rs +++ b/crates/ui-egui/tests/it/ui_tabs.rs @@ -234,20 +234,20 @@ fn preview_divider(h: &Harness<'_, EffectcraftApp>) -> egui::Rect { .expect("a gutter between Preview and Properties") } -/// Default's right column: a short Preview frame (48 points of body under next's 28-point strip) and the Properties frame +/// Default's right column: a short Preview frame (46 points of body) and the Properties frame /// below it taking the rest of the column, at any window height. #[test] fn the_default_preview_frame_is_short_and_properties_takes_the_rest() { let (mut h, _, _) = harness(); let body = |h: &Harness<'_, EffectcraftApp>| rect(h, "panel.Preview").height(); - assert!((body(&h) - 48.0).abs() < 1.5, "Preview {}", body(&h)); + assert!((body(&h) - 46.0).abs() < 1.5, "Preview {}", body(&h)); let props = rect(&h, "panel.Properties"); assert!(props.height() > 300.0, "Properties {props:?}"); // A taller window gives the room to Properties. let size = h.ctx.content_rect().size(); h.set_size(size + egui::vec2(0.0, 200.0)); h.run_steps(3); - assert!((body(&h) - 48.0).abs() < 1.5, "Preview {}", body(&h)); + assert!((body(&h) - 46.0).abs() < 1.5, "Preview {}", body(&h)); assert!((rect(&h, "panel.Properties").height() - props.height() - 200.0).abs() < 2.0); } @@ -504,7 +504,7 @@ fn open_comps_are_tabs_in_the_timeline_row_and_the_rest_are_in_its_overflow_menu } #[test] -fn an_inactive_comp_tab_shows_its_close_button_on_hover_and_closes_without_showing_its_comp() { +fn an_inactive_comp_tab_shows_its_close_button_and_closes_without_showing_its_comp() { let (mut h, pre, main) = harness(); h.state_mut().session.state.open_comps = vec![ItemId(main), ItemId(pre)]; h.run_steps(3);