From 7b6b64f3964162bcce0dfc79b5d205be79c2d239 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 28 Nov 2026 08:09:33 +0100 Subject: [PATCH] Thing 2.0 cut 6b: small asset rect in the fit table --- crates/thing-core/tests/render.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/thing-core/tests/render.rs b/crates/thing-core/tests/render.rs index 7f9b886..b0cdcc8 100644 --- a/crates/thing-core/tests/render.rs +++ b/crates/thing-core/tests/render.rs @@ -802,7 +802,7 @@ fn fills_of(rendered: &Rendered, token: &str) -> Vec { fn fit_table() { let provider = ProviderId::new(PROVIDER); // A row 100 high stretches an image to 100 high and leaves it its extent's width, so the rect - // is the ratio of none of the assets: wide 400x100, tall 100x100, small 40x100. + // is the ratio of none of the assets: wide 400x100, tall 100x100, small 100x100. let run = |asset: &str, fit: ImageFit, at: Rect| { let mut state = MemState::new(); state.put(&provider, &catalog(&[("wide", 400, 200), ("tall", 100, 400), ("small", 40, 20)])); @@ -812,7 +812,7 @@ fn fit_table() { }; let wide = rect(0.0, 0.0, 400.0, 100.0); let tall = rect(0.0, 0.0, 100.0, 100.0); - let small = rect(0.0, 0.0, 40.0, 100.0); + let small = rect(0.0, 0.0, 100.0, 100.0); let img = |r: Rect, uri: &str| RenderCommand::Image { rect: r, uri: format!("asset://{uri}"), alt: "alt".into() }; let clip = |at: Rect, inner: RenderCommand| [RenderCommand::ClipPush { rect: at, radius: 0.0 }, inner, RenderCommand::ClipPop].to_vec(); for (asset, at) in [("wide", wide), ("tall", tall), ("small", small)] { @@ -820,13 +820,13 @@ fn fit_table() { } assert_eq!(run("wide", ImageFit::Contain, wide), [img(rect(100.0, 0.0, 200.0, 100.0), "wide")]); assert_eq!(run("tall", ImageFit::Contain, tall), [img(rect(37.5, 0.0, 25.0, 100.0), "tall")]); - assert_eq!(run("small", ImageFit::Contain, small), [img(rect(0.0, 40.0, 40.0, 20.0), "small")]); + assert_eq!(run("small", ImageFit::Contain, small), [img(rect(0.0, 25.0, 100.0, 50.0), "small")]); assert_eq!(run("wide", ImageFit::Cover, wide), clip(wide, img(rect(0.0, -50.0, 400.0, 200.0), "wide"))); assert_eq!(run("tall", ImageFit::Cover, tall), clip(tall, img(rect(0.0, -150.0, 100.0, 400.0), "tall"))); - assert_eq!(run("small", ImageFit::Cover, small), clip(small, img(rect(-80.0, 0.0, 200.0, 100.0), "small"))); + assert_eq!(run("small", ImageFit::Cover, small), clip(small, img(rect(-50.0, 0.0, 200.0, 100.0), "small"))); assert_eq!(run("wide", ImageFit::Unscaled, wide), clip(wide, img(rect(0.0, -50.0, 400.0, 200.0), "wide"))); assert_eq!(run("tall", ImageFit::Unscaled, tall), clip(tall, img(rect(0.0, -150.0, 100.0, 400.0), "tall"))); - assert_eq!(run("small", ImageFit::Unscaled, small), clip(small, img(rect(0.0, 40.0, 40.0, 20.0), "small"))); + assert_eq!(run("small", ImageFit::Unscaled, small), clip(small, img(rect(30.0, 40.0, 40.0, 20.0), "small"))); } #[test]