mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Trim the mid-stroke tool-key test to an each-choice set (#16041)
pencil_tests::a_tool_key_mid_stroke_paints_what_the_stroke_paints_without_it crossed 4 modes with 5 brush changes (56 apps). The brush is captured once at the press whatever the mode, so History Brush keeps all 5 cases and each Erase to History mode one: Brush and Pencil with the sampled tip, Block with smoothing. 8 cases, 24 apps.
This commit is contained in:
1 parent
42c853396d
commit
4ea8bdc827
1 file changed
+10
-10
@@ -434,15 +434,15 @@ fn a_tool_key_mid_stroke_paints_what_the_stroke_paints_without_it() {
|
||||
("no dynamics, then size jitter", round.clone(), json!({"shapeDynamics": {"enabled": true, "size": {"jitter": 1.0}}})),
|
||||
("no smoothing, then 90 %", round.clone(), json!({"smoothing": {"enabled": true, "amount": 0.9}})),
|
||||
];
|
||||
for mode in ["", "brush", "pencil", "block"] {
|
||||
for (what, pressed, switched) in &cases {
|
||||
let plain = history_stroke_pixels(mode, pressed, None);
|
||||
assert!(history_stroke_pixels(mode, pressed, Some(switched)) == plain, "{mode} {what}: the switch changed the stroke");
|
||||
// The switched-to brush paints differently, so the comparison means something; Block
|
||||
// mode keeps only the brush's smoothing.
|
||||
if mode != "block" || what.contains("smoothing") {
|
||||
assert!(history_stroke_pixels(mode, switched, None) != plain, "{mode} {what}: both brushes paint alike");
|
||||
}
|
||||
}
|
||||
// Each choice, not every mode with every case (#16041): the brush is captured once, at the
|
||||
// press, whatever the mode, so History Brush takes every case and each Erase to History mode
|
||||
// one, for its own flags: Brush and Pencil with the sampled tip, Block with smoothing (the only
|
||||
// brush setting Block keeps).
|
||||
let runs = cases.iter().map(|c| ("", c)).chain([("brush", &cases[2]), ("pencil", &cases[2]), ("block", &cases[4])]);
|
||||
for (mode, (what, pressed, switched)) in runs {
|
||||
let plain = history_stroke_pixels(mode, pressed, None);
|
||||
assert!(history_stroke_pixels(mode, pressed, Some(switched)) == plain, "{mode} {what}: the switch changed the stroke");
|
||||
// The switched-to brush paints differently, so the comparison means something.
|
||||
assert!(history_stroke_pixels(mode, switched, None) != plain, "{mode} {what}: both brushes paint alike");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user