Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Warp Text: the dialog lists Style, orientation, then Bend and distortions (#2689) (#2819)

Valentin Klein444323ee74e8
diff --git a/crates/engine/src/type_extra_cmds.rs b/crates/engine/src/type_extra_cmds.rs
index 1ca11526a..022146f11 100644
--- a/crates/engine/src/type_extra_cmds.rs
+++ b/crates/engine/src/type_extra_cmds.rs
@@ -554,7 +554,7 @@ pub fn specs() -> Vec<CommandSpec> {
"type.warpText",
"Warp Text…",
&["Type"],
- r##"{"layer":id? or "layers":[id,…]? (default selected Type layers),"style":"none|arc|arcLower|arcUpper|arch|bulge|shellLower|shellUpper|flag|wave|fish|rise|fisheye|inflate|squeeze|twist"="arc","bend":-100..100=50,"horizontalDistortion":-100..100=0,"verticalDistortion":-100..100=0,"orientation":"horizontal|vertical"="horizontal"}"##,
+ r##"{"layer":id? or "layers":[id,…]? (default selected Type layers),"style":"none|arc|arcLower|arcUpper|arch|bulge|shellLower|shellUpper|flag|wave|fish|rise|fisheye|inflate|squeeze|twist"="arc","orientation":"horizontal|vertical"="horizontal","bend":-100..100=50,"horizontalDistortion":-100..100=0,"verticalDistortion":-100..100=0}"##,
has_format_target,
warp_text
),
diff --git a/crates/ui-egui/src/warp_text_dialog_tests.rs b/crates/ui-egui/src/warp_text_dialog_tests.rs
index 6057b8582..2431c840c 100644
--- a/crates/ui-egui/src/warp_text_dialog_tests.rs
+++ b/crates/ui-egui/src/warp_text_dialog_tests.rs
@@ -193,3 +193,16 @@ fn confirming_warp_text_is_one_undoable_step() {
app.run("edit.undo", json!({})).unwrap();
assert_eq!(warp(app), before);
}
+
+/// #2689: as in Photoshop, the dialog lists Style, then the orientation, then Bend and the two
+/// distortions.
+#[test]
+fn warp_text_dialog_lists_style_orientation_then_bend_and_distortions() {
+ let mut app = app_with_type();
+ open(&mut app);
+ let h = harness(app);
+ let top = |name: &str| h.query_all_by_label(name).map(|n| n.rect().top()).fold(f32::INFINITY, f32::min);
+ let order = ["Style", "Orientation", "Bend", "Horizontal Distortion", "Vertical Distortion"].map(top);
+ assert!(order.iter().all(|y| y.is_finite()), "every field is shown: {order:?}");
+ assert!(order.windows(2).all(|w| w[0] < w[1]), "fields top to bottom: {order:?}");
+}