From bbdb779de9ae04d3fe904a1df1902694f1d82f5a Mon Sep 17 00:00:00 2001 From: SGavrl <277843151+SGavrl@users.noreply.github.com> Date: Thu, 23 Jul 2026 15:04:03 +0000 Subject: [PATCH] test: gate opposing float geometry --- crates/obscura-render/tests/layout_test.rs | 30 +++++++++++++++++ render-repros/checks.json | 5 +++ render-repros/opposing-header-floats.html | 38 ++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 render-repros/opposing-header-floats.html diff --git a/crates/obscura-render/tests/layout_test.rs b/crates/obscura-render/tests/layout_test.rs index f3a3e71..0d6281a 100644 --- a/crates/obscura-render/tests/layout_test.rs +++ b/crates/obscura-render/tests/layout_test.rs @@ -391,3 +391,33 @@ fn replaced_image_contributes_intrinsic_size_in_ordered_grid() { "image: {image:?}" ); } + +#[test] +fn opposing_floats_share_header_band_through_inline_wrapper() { + let tree = parse_html(include_str!("../../../render-repros/opposing-header-floats.html")); + let layout = layout_dom(&tree, (900.0, 1000.0)); + let rect = |id| layout.rects[&tree.get_element_by_id(id).unwrap()]; + let logo = rect("logo"); + let tagline = rect("tagline"); + let menu = rect("menu"); + assert!( + (logo.x - 0.0).abs() < 0.01 + && (logo.y - 0.0).abs() < 0.01 + && (logo.width - 200.0).abs() < 0.01 + && (logo.height - 100.0).abs() < 0.01, + "logo: {logo:?}" + ); + assert!( + (tagline.x - 600.0).abs() < 0.01 + && (tagline.y - 60.0).abs() < 0.01 + && (tagline.width - 300.0).abs() < 0.01 + && (tagline.height - 40.0).abs() < 0.01, + "tagline: {tagline:?}" + ); + assert!( + (menu.x - 0.0).abs() < 0.01 + && (menu.y - 100.0).abs() < 0.01 + && (menu.width - 900.0).abs() < 0.01, + "menu: {menu:?}" + ); +} diff --git a/render-repros/checks.json b/render-repros/checks.json index d6b4c5e..23f5b5f 100644 --- a/render-repros/checks.json +++ b/render-repros/checks.json @@ -89,6 +89,11 @@ "modern-streams": [ {"name": "streamed hydration contracts", "color": "#186aa5", "width": 360, "height": 90} ], + "opposing-header-floats": [ + {"name": "inline wrapper exposes left float to header BFC", "color": "#1971c2", "x": 0, "y": 0, "width": 200, "height": 100}, + {"name": "opposing float shares the same band", "color": "#e8590c", "x": 600, "y": 60, "width": 300, "height": 40}, + {"name": "cleared navigation follows the float band", "color": "#087f5b", "x": 0, "y": 100, "width": 900, "height": 50} + ], "relative-box-edges": [ {"name": "vh margin resolves against viewport height", "color": "#087f5b", "x": 0, "y": 150, "width": 100, "height": 40}, {"name": "vw margin resolves against viewport width", "color": "#1971c2", "x": 90, "y": 200, "width": 100, "height": 40}, diff --git a/render-repros/opposing-header-floats.html b/render-repros/opposing-header-floats.html new file mode 100644 index 0000000..fbfd231 --- /dev/null +++ b/render-repros/opposing-header-floats.html @@ -0,0 +1,38 @@ + + +
+ +