Merge #13476 into the merge queue batch

Add Stroke Emboss to the Bevel & Emboss style menu
This commit is contained in:
David Mann committed 2026-11-29 21:15:39 +01:00
commit 2700a1332c
1 file changed
+28
@@ -500,6 +500,20 @@ fn unchanged_global_light_angle_is_not_applied() {
assert_eq!(app.session.active().unwrap().doc.global_light.angle, light);
}
/// #13413: a Stroke Emboss bevel drafts as a Style the page's menu offers, so the dropdown names it, and an
/// unchanged OK keeps it Stroke Emboss.
#[test]
fn stroke_emboss_bevel_is_a_style_menu_choice() {
let (s, style) = row(&[("layer.layerStyle.bevelEmboss", json!({"style": "stroke"}))]);
let bevel = style.instances(EffectKind::BevelEmboss).next().unwrap();
assert_eq!(text(&style, bevel, "style").as_deref(), Some("stroke"));
let spec = EffectSpec::photoshop(EffectKind::BevelEmboss);
let Some(FieldKind::Choice(choices)) = spec.field("style").map(|f| &f.kind) else { panic!("Style is a choice") };
assert!(choices.iter().any(|c| c.value == "stroke"), "the Style menu offers Stroke Emboss");
let Effect::BevelEmboss(b) = &layer_effects(&s)[0] else { panic!("bevel") };
assert_eq!(b.style, photocraft_doc::effects::BevelStyle::StrokeEmboss);
}
#[test]
fn unedited_bevel_shading_keeps_imported_precision() {
for size in [None, Some(12.0)] {
@@ -663,6 +677,20 @@ fn issue_steps_disable_stroke_add_overlay_untick_preview() {
assert!(blue[2] > 0.9 && blue[1] < 0.1, "after OK only the overlay renders: {blue:?}");
}
/// A Stroke Emboss bevel (#13413) shows by name in the Bevel & Emboss page's Style menu, not as a blank.
#[test]
fn a_stroke_emboss_bevel_shows_its_style() {
let mut app = app_with_layer(16);
app.run("layer.layerStyle.bevelEmboss", json!({"style": "stroke"})).unwrap();
let id = open(&mut app, Some(EffectKind::BevelEmboss.key())).unwrap();
let bevel = first_of(&app, id, EffectKind::BevelEmboss);
assert_eq!(text(&draft(&app, id).style, bevel, "style").as_deref(), Some("stroke"));
let mut h = harness(app);
h.run_steps(3);
let style = h.get_by_role_and_label(egui::accesskit::Role::ComboBox, "Style");
assert_eq!(style.value().as_deref(), Some("Stroke Emboss"));
}
/// New Style… saves the enabled instances and the pending opacity; a preset row applies it to the draft only.
#[test]
fn new_style_saves_pending_state_and_a_swatch_apply_restores_it() {