mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Move tool nudge alert tests: name the lock case type for clippy (#18130)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c14937595d
commit
eee2b42d5b
1 file changed
+5
-3
@@ -13,6 +13,9 @@ use super::{MESSAGE, NUDGE_MESSAGE};
|
||||
use crate::PhotocraftApp;
|
||||
use crate::state::Tool;
|
||||
|
||||
/// A name and the locks it sets.
|
||||
type LockCase = (&'static str, fn(&mut Locks));
|
||||
|
||||
/// A document of a Background and one red-filled layer, the Move tool picked and the layer selected.
|
||||
fn harness() -> Harness<'static, Box<PhotocraftApp>> {
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_max_steps(64).build_eframe(|cc| {
|
||||
@@ -78,7 +81,7 @@ fn press(h: &mut Harness<'_, Box<PhotocraftApp>>, mods: Modifiers, key: Key) {
|
||||
|
||||
#[test]
|
||||
fn a_nudge_of_a_layer_locked_in_place_opens_one_alert_of_its_own() {
|
||||
let cases: [(&str, fn(&mut Locks)); 3] = [("Lock all", |l| l.all = true), ("Lock position", |l| l.position = true), ("Background", |_| {})];
|
||||
let cases: [LockCase; 3] = [("Lock all", |l| l.all = true), ("Lock position", |l| l.position = true), ("Background", |_| {})];
|
||||
for (name, lock) in cases {
|
||||
for mods in [Modifiers::NONE, Modifiers::SHIFT] {
|
||||
let mut h = harness();
|
||||
@@ -125,8 +128,7 @@ fn enter_space_escape_and_ok_close_the_alert_and_no_press_is_replayed() {
|
||||
|
||||
#[test]
|
||||
fn layers_with_only_a_pixel_lock_still_nudge() {
|
||||
let cases: [(&str, fn(&mut Locks)); 3] =
|
||||
[("no lock", |_| {}), ("Lock image pixels", |l| l.pixels = true), ("Lock transparent pixels", |l| l.transparency = true)];
|
||||
let cases: [LockCase; 3] = [("no lock", |_| {}), ("Lock image pixels", |l| l.pixels = true), ("Lock transparent pixels", |l| l.transparency = true)];
|
||||
for (name, lock) in cases {
|
||||
let mut h = harness();
|
||||
let id = layer(&h);
|
||||
|
||||
Reference in new issue
Block a user