DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge PR #648
Brandon Thomas4cd3a8fa5e62
diff --cc crates/engine/src/cmd/style.rsindex c1f74df0b,9f0321560..3b04df131--- a/crates/engine/src/cmd/style.rs+++ b/crates/engine/src/cmd/style.rs@@@ -1900,8 -1750,15 +1900,19 @@@ mod sample_color_testsassert_eq!(text.format_after(0).over.stroke.as_deref(), r["swatch"].as_str(), "selected text stroke: {command}");}}++ #[test]+ fn sampling_with_the_stroke_in_front_colours_a_lines_stroke() {+ let (mut s, _) = session_with_image();+ let line = s.execute("line.create", &json!({"a": [300, 300], "b": [500, 300]})).unwrap()["id"].as_u64().unwrap();+ s.execute("selection.set", &json!({"ids": [line]})).unwrap();+ let r = s.execute("color.sample", &json!({"at": [100, 100], "target": "stroke"})).unwrap();+ let it = s.doc().unwrap().doc.item(ItemId(line)).unwrap().clone();+ assert_eq!(it.stroke.swatch, r["swatch"].as_str().unwrap(), "{r}");+ assert!(it.fill.is_none(), "the fill stays empty");+ }}++#[cfg(test)]+#[path = "text_color_tests.rs"]+mod text_color_tests;