Merge branch 'fix/f3': community issue fixes
# Conflicts: # crates/ui-egui/src/widgets.rs
This commit is contained in:
@@ -318,3 +318,47 @@ fn panels_snapshot() {
|
||||
img.save(format!("{dir}/{panel}{scope}.png")).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
/// Drag the automation element `id` horizontally by `dx` points.
|
||||
fn drag_x(h: &mut Harness<'_, EffectcraftApp>, id: &str, dx: f32) {
|
||||
let e = h.state().auto.find(id).unwrap_or_else(|| panic!("no {id}")).clone();
|
||||
let from: Pos2 = pos2(e.rect[0] + e.rect[2] / 2.0, e.rect[1] + e.rect[3] / 2.0);
|
||||
h.input_mut().events.push(Event::PointerMoved(from));
|
||||
h.step();
|
||||
h.input_mut().events.push(Event::PointerButton { pos: from, button: egui::PointerButton::Primary, pressed: true, modifiers: Default::default() });
|
||||
h.step();
|
||||
for k in 1..=10 {
|
||||
h.input_mut().events.push(Event::PointerMoved(from + egui::vec2(dx * k as f32 / 10.0, 0.0)));
|
||||
h.step();
|
||||
}
|
||||
let to = from + egui::vec2(dx, 0.0);
|
||||
h.input_mut().events.push(Event::PointerButton { pos: to, button: egui::PointerButton::Primary, pressed: false, modifiers: Default::default() });
|
||||
h.run_steps(3);
|
||||
}
|
||||
|
||||
/// #338: an Essential Graphics Scale control keeps After Effects' Constrain Proportions link, on
|
||||
/// by default: dragging X scales Y with it; unlinked, X moves alone.
|
||||
#[test]
|
||||
fn essential_graphics_scale_keeps_constrain_proportions() {
|
||||
let mut h = harness();
|
||||
let layer = h.state().session.active_comp().unwrap().layers[0].id.0;
|
||||
h.state_mut().session.execute("prop.set", json!({"layer": layer, "path": "transform/scale", "value": [100.0, 50.0]})).unwrap();
|
||||
let c =
|
||||
h.state_mut().session.execute("essential.addProperty", json!({"layer": layer, "path": "transform/scale"})).unwrap()["controls"][0].as_u64().unwrap();
|
||||
open(&mut h, "essentialGraphics");
|
||||
let value = format!("essential.control.{c}.value");
|
||||
let scale = |h: &Harness<'_, EffectcraftApp>| {
|
||||
let comp = h.state().session.active_comp().unwrap();
|
||||
let l = comp.layers.iter().find(|l| l.id.0 == layer).unwrap();
|
||||
l.props.prop("transform/scale").unwrap().value.components()
|
||||
};
|
||||
assert!(h.state().auto.find(&format!("{value}.link")).is_some(), "the chain link is drawn");
|
||||
drag_x(&mut h, &format!("{value}.0"), 40.0);
|
||||
let linked = scale(&h);
|
||||
assert!(linked[0] > 100.0, "{linked:?}");
|
||||
assert!((linked[1] / linked[0] - 0.5).abs() < 1e-6, "Y follows X in proportion: {linked:?}");
|
||||
click(&mut h, &format!("{value}.link"));
|
||||
drag_x(&mut h, &format!("{value}.0"), 40.0);
|
||||
let unlinked = scale(&h);
|
||||
assert!(unlinked[0] > linked[0] && unlinked[1] == linked[1], "unlinked, X moves alone: {unlinked:?}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user