Support embedding whole items into Graphic variants so their attributes survive the conversion (#4440)

Add embedding conversion adapters that move a whole ranked value inside a Graphic variant
This commit is contained in:
Keavon Chambers
2026-08-16 19:51:58 -07:00
committed by GitHub
parent f635c56eab
commit 104b8b71e6
5 changed files with 132 additions and 11 deletions

View File

@@ -3975,10 +3975,10 @@ mod test {
let fill = appearance.first_paint_of(Cover::Fill).expect("Morph should keep the fill paint at the midpoint");
// Interpolated color between red and blue should have >0 value on both R and B
let Graphic::ColorList(colors) = fill else {
let Graphic::Color(color) = fill else {
panic!("Expected a solid color fill, got {fill:?}");
};
let color = *colors.element(0).expect("Color present");
let color = *color.element();
assert!(color.r() > 0. && color.b() > 0., "Fill should be a red-to-blue blend, got {color:?}");
}
@@ -3992,10 +3992,10 @@ mod test {
let paint_color = |appearance: &Appearance, cover| {
let paint = appearance.first_paint_of(cover).expect("Morph should keep both paints at the midpoint");
let Graphic::ColorList(colors) = paint else {
let Graphic::Color(color) = paint else {
panic!("Expected a solid color paint, got {paint:?}");
};
*colors.element(0).expect("Color present")
*color.element()
};
// The two endpoints list their covers in opposite paint orders, which pairing by position would cross