mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 05:22:58 -05:00
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:
1 parent
e28faa0a94
commit
fca9f00cd4
1 file changed
+8
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user