Tests: check the contrast answer for a Difference square in an isolating group

a_blend_mode_inside_an_isolating_group_answers_over_art_of_several_colors
only checked that color.contrast returned Ok. It now checks that the
answer has a ratio above 1 and a background color, and that the same
square in Normal mode gives a different ratio, so a contrast reading
that drops the blend mode fails the test.
This commit is contained in:
dotCooCoo committed 2026-12-01 07:10:54 -08:00
1 parent e28faa0a94
commit fca9f00cd4
1 file changed
+8 -1
+8 -1
View File
@@ -1184,7 +1184,14 @@ fn a_blend_mode_inside_an_isolating_group_answers_over_art_of_several_colors() {
s.execute("object.group", &json!({"ids": [back, square]})).unwrap();
s.execute("transparency.set", &json!({"opacity": 50, "isolate": true})).unwrap();
s.execute("select.set", &json!({"ids": [square]})).unwrap();
s.execute("color.contrast", &json!({})).unwrap();
let r = s.execute("color.contrast", &json!({})).unwrap();
let isolated = ratio(&r);
assert!(isolated > 1.0, "{r}");
assert!(r["against"].as_str().is_some_and(|h| vectorcraft_color::Color::from_hex(h).is_some()), "{r}");
// The Difference mode is applied: in Normal mode the same square gives another answer.
s.execute("transparency.set", &json!({"blend": "normal"})).unwrap();
let normal = ratio(&s.execute("color.contrast", &json!({})).unwrap());
assert!((isolated - normal).abs() > 0.1, "difference {isolated} against normal {normal}");
}
/// With a fill of None, what a pick would be measured against is still read: the Color Wheel's