mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-26 23:58:48 +00:00
Preview keeps its 46-point body under the 28-point tab strip; the examples install the UI runtime
This commit is contained in:
@@ -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::<ControlRequest>();
|
||||
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));
|
||||
{
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -255,7 +255,7 @@ fn workspace_floating(name: &str) -> Vec<Floating<PanelKind>> {
|
||||
}
|
||||
|
||||
/// 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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user