Fix tests and two behaviours after the community batch
- Renderer: no cover step for adjustment layers (#686); their buffer is the comp below. Restores a single CPU step in split adjustment stacks. - Effect Controls rename (#953): focus the name field the frame it exists. Focusing an id not yet drawn left AccessKit with a focus outside its tree (a panic in the consumer). The tests double-click at 60 fps, within egui's double-click time. - i18n: Russian, French and German entries for Copy Frame to Clipboard and the extrusion Front/Bevel/Side/Back Color submenus added by today's other PRs. - Tests: "fr" is now a valid language; the marker dialog's comment is focused on open (#922), so Enter-is-OK is tested with the focus elsewhere; the toolbar gradient tests give the selected layer its paint kind, since the toolbar mirrors it (#732). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
bbc3a231c7
commit
61aaf83612
@@ -528,7 +528,7 @@ fn radial_center_stays_draggable_when_its_property_is_selected() {
|
||||
#[test]
|
||||
fn clicking_an_effect_parameter_activates_its_header_and_handles() {
|
||||
let (app, x) = app();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1700.0, 1100.0)).build_eframe(|_| app);
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1700.0, 1100.0)).with_step_dt(1.0 / 60.0).build_eframe(|_| app);
|
||||
settle(&mut h);
|
||||
let name = rect_of(&h, &format!("effectControls.prop.{}.name", x.point)).center();
|
||||
click(&mut h, name);
|
||||
@@ -660,12 +660,11 @@ fn file_and_text_parameters_have_widgets() {
|
||||
#[test]
|
||||
fn effect_control_name_can_be_renamed_from_its_header() {
|
||||
let (app, x) = app();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1700.0, 1100.0)).build_eframe(|_| app);
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1700.0, 1100.0)).with_step_dt(1.0 / 60.0).build_eframe(|_| app);
|
||||
settle(&mut h);
|
||||
let name = format!("effectControls.effect.{}.name", x.point_fx);
|
||||
let point = rect_of(&h, &name).center();
|
||||
click(&mut h, point);
|
||||
click(&mut h, point);
|
||||
double_click(&mut h, point);
|
||||
h.run_steps(3);
|
||||
assert!(ids(&h).contains(&format!("effectControls.effect.{}.nameEdit", x.point_fx)));
|
||||
h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
|
||||
@@ -683,11 +682,10 @@ fn effect_control_name_can_be_renamed_from_its_header() {
|
||||
#[test]
|
||||
fn effect_rename_escape_keeps_the_name() {
|
||||
let (app, x) = app();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1700.0, 1100.0)).build_eframe(|_| app);
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1700.0, 1100.0)).with_step_dt(1.0 / 60.0).build_eframe(|_| app);
|
||||
settle(&mut h);
|
||||
let point = rect_of(&h, &format!("effectControls.effect.{}.name", x.point_fx)).center();
|
||||
click(&mut h, point);
|
||||
click(&mut h, point);
|
||||
double_click(&mut h, point);
|
||||
h.run_steps(3);
|
||||
assert!(ids(&h).contains(&format!("effectControls.effect.{}.nameEdit", x.point_fx)));
|
||||
h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
|
||||
@@ -699,3 +697,14 @@ fn effect_rename_escape_keeps_the_name() {
|
||||
assert_eq!(name, "Point Control");
|
||||
assert!(!ids(&h).contains(&format!("effectControls.effect.{}.nameEdit", x.point_fx)));
|
||||
}
|
||||
|
||||
/// Two presses within egui's double-click time (one frame apart).
|
||||
fn double_click(h: &mut Harness<'_, EffectcraftApp>, pos: egui::Pos2) {
|
||||
h.event(egui::Event::PointerMoved(pos));
|
||||
h.step();
|
||||
for pressed in [true, false, true, false] {
|
||||
h.event(egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() });
|
||||
h.step();
|
||||
}
|
||||
h.run_steps(2);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,14 @@ fn setup(items: &[&str], tool: serde_json::Value, select: bool) -> (Harness<'sta
|
||||
for kind in items {
|
||||
s.execute("layer.addShapeItem", json!({"layer": l, "kind": kind})).unwrap();
|
||||
}
|
||||
s.execute("shape.toolOptions", tool).unwrap();
|
||||
s.execute("shape.toolOptions", tool.clone()).unwrap();
|
||||
// The toolbar shows a selected shape layer's own Fill / Stroke kind (#732), so the layer gets
|
||||
// the kind too.
|
||||
if select && let Some(o) = tool.as_object() {
|
||||
let mut p = o.clone();
|
||||
p.insert("layers".into(), json!([l]));
|
||||
s.execute("shape.fillStroke", serde_json::Value::Object(p)).unwrap();
|
||||
}
|
||||
s.state.selected_layers = if select { vec![LayerId(l)] } else { vec![] };
|
||||
s.state.selected_props.clear();
|
||||
let mut h = Harness::builder().with_size(vec2(1600.0, 1000.0)).build_eframe(|_| EffectcraftApp::new(s));
|
||||
@@ -104,16 +111,14 @@ fn a_gradient_stroke_swatch_edits_the_gradient_stroke() {
|
||||
assert_eq!((target.layer, target.prop), (l, uid), "on the Gradient Stroke's Colors");
|
||||
}
|
||||
|
||||
/// With no shape layer selected, or one without that gradient, the swatch opens the options (the
|
||||
/// kind new shapes get) as before.
|
||||
/// With no shape layer selected the swatch opens the options (the kind new shapes get) as before.
|
||||
/// (A selected shape layer shows its own kind, #732, so a gradient kind always has its gradient.)
|
||||
#[test]
|
||||
fn without_a_selected_gradient_the_swatch_opens_the_options() {
|
||||
for (items, select) in [(vec![], true), (vec!["gfill"], false)] {
|
||||
let (mut h, _) = setup(&items, json!({"fillType": "linear"}), select);
|
||||
click(&mut h, "header.fill", Modifiers::NONE);
|
||||
assert_eq!(h.state().dialog, None, "{items:?} selected={select}: no editor");
|
||||
assert!(options_open(&h, "fill"), "{items:?} selected={select}: Fill Options");
|
||||
}
|
||||
let (mut h, _) = setup(&["gfill"], json!({"fillType": "linear"}), false);
|
||||
click(&mut h, "header.fill", Modifiers::NONE);
|
||||
assert_eq!(h.state().dialog, None, "no editor");
|
||||
assert!(options_open(&h, "fill"), "Fill Options");
|
||||
}
|
||||
|
||||
/// The rest of the toolbar is unchanged: the words open the options, a Solid Color swatch opens the
|
||||
|
||||
Reference in New Issue
Block a user