diff --git a/crates/thing-core/tests/cells.rs b/crates/thing-core/tests/cells.rs index 76bf85d..63be225 100644 --- a/crates/thing-core/tests/cells.rs +++ b/crates/thing-core/tests/cells.rs @@ -1,10 +1,11 @@ //! The Cells text engine: pinned widths, sanitizing, wrapping, and that `measure` and `text` //! agree. Vectors were checked against unicode-width 0.2.3 (ambiguous width narrow). -use thing_contract::NodeId; +use thing_contract::{AssetEntry, NodeId}; use thing_core::bind::Bound; use thing_core::layout::{Avail, Constraint, Leaf, Measure, Run, TextRequest}; use thing_core::text::{CellMeasure, CellText}; +use thing_testkit::build::count; fn widths(s: &str) -> Vec { CellText::new(s).clusters().map(|(_, w)| w).collect() @@ -160,6 +161,8 @@ fn controls_have_shipped_sizes() { assert_eq!(m.measure(&Leaf::Slider { node: &node }, c), (20.0, 1.0)); assert_eq!(m.measure(&Leaf::Select { node: &node, selected: &text }, c), (20.0, 1.0)); assert_eq!(m.measure(&Leaf::Image { node: &node, asset: &Bound::Absent }, c), (0.0, 0.0)); + let entry = AssetEntry { id: "a".into(), media_type: "image/png".into(), uri: "asset://a".into(), width: count(17), height: count(33) }; + assert_eq!(m.measure(&Leaf::Image { node: &node, asset: &Bound::Asset(entry) }, c), (3.0, 3.0), "extent over (8, 16), rounded up"); } /// Random strings, every control among them, never panic and never put a control character into