mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
This commit is contained in:
commit
b5fed83c79
1 file changed
+11
-6
@@ -390,6 +390,11 @@ fn apply_command_defaults(app: &PhotocraftApp, command: &str, fields: &mut Map<S
|
||||
if command == "edit.assignProfile" {
|
||||
assign_profile_defaults(app, fields);
|
||||
}
|
||||
// Photoshop's Replace Color opens with its sample eyedropper active (#6279): the first click
|
||||
// on the image picks the colour.
|
||||
if command == REPLACE_COLOR {
|
||||
fields.insert(COLOR_EYEDROPPER.into(), json!(true));
|
||||
}
|
||||
}
|
||||
|
||||
/// Assign Profile offers only the profiles the document's colour mode can take (#4951): the
|
||||
@@ -2422,8 +2427,7 @@ mod tests {
|
||||
app.run("tools.setColors", json!({"foreground": "#ff0000"})).unwrap();
|
||||
let id = open(&mut app, REPLACE_COLOR).unwrap();
|
||||
assert_eq!(app.ui.dialogs.last().unwrap().fields["color"], json!("#ff0000"), "the dialog starts from the foreground colour");
|
||||
assert!(!color_eyedropper_armed(&app));
|
||||
app.ui.dialog_mut(id).unwrap().fields.insert(COLOR_EYEDROPPER.into(), json!(true));
|
||||
// #6279: armed as it opens, so the first click on the image samples.
|
||||
assert!(color_eyedropper_armed(&app));
|
||||
assert!(color_eyedropper_sample(&mut app, 4.0, 4.0));
|
||||
assert_eq!(app.ui.dialogs.last().unwrap().fields["color"], json!("#00ff00"));
|
||||
@@ -2439,7 +2443,7 @@ mod tests {
|
||||
assert!(!color_eyedropper_sample(&mut app, 4.0, 4.0));
|
||||
}
|
||||
|
||||
/// #4143: the eyedropper button arms and disarms the canvas picker.
|
||||
/// #4143: the eyedropper button disarms and re-arms the canvas picker (#6279: it opens armed).
|
||||
#[test]
|
||||
fn replace_color_dialog_arms_the_eyedropper_button() {
|
||||
use egui_kittest::Harness;
|
||||
@@ -2452,12 +2456,13 @@ mod tests {
|
||||
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ALL[0]);
|
||||
open(h.state_mut(), REPLACE_COLOR).unwrap();
|
||||
h.run_steps(3);
|
||||
h.get_by_label("Pick Color From Image").click();
|
||||
h.run_steps(2);
|
||||
assert!(color_eyedropper_armed(h.state()));
|
||||
assert!(color_eyedropper_armed(h.state()), "armed as the dialog opens");
|
||||
h.get_by_label("Pick Color From Image").click();
|
||||
h.run_steps(2);
|
||||
assert!(!color_eyedropper_armed(h.state()));
|
||||
h.get_by_label("Pick Color From Image").click();
|
||||
h.run_steps(2);
|
||||
assert!(color_eyedropper_armed(h.state()));
|
||||
}
|
||||
|
||||
/// #6278: the Result swatch shows the sampled colour after the shift, and a colour picked for
|
||||
|
||||
Reference in new issue
Block a user