From 75f6c92eab114652cfb0cd128e2e7843443e52c1 Mon Sep 17 00:00:00 2001 From: aiongg Date: Thu, 22 Oct 2026 02:36:41 +0000 Subject: [PATCH] Integration: #2086 test that the strip beside the column headings is filled in dark mode --- crates/ui-egui/tests/scrollbar_column_fill.rs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 crates/ui-egui/tests/scrollbar_column_fill.rs diff --git a/crates/ui-egui/tests/scrollbar_column_fill.rs b/crates/ui-egui/tests/scrollbar_column_fill.rs new file mode 100644 index 000000000..cd14f09ba --- /dev/null +++ b/crates/ui-egui/tests/scrollbar_column_fill.rs @@ -0,0 +1,28 @@ +//! The strip beside the column headings, above the vertical scrollbar, takes the bar colour in +//! dark mode instead of showing a light square (#2086). + +use egui::{Shape, pos2}; +use gridcraft_engine::Session; +use gridcraft_ui_egui::{SheetApp, theme::Tokens}; +use serde_json::json; + +#[test] +fn dark_theme_fills_the_strip_right_of_the_last_column_heading() { + let mut session = Session::new(); + session.new_workbook(); + let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_ui_state( + |ui, app: &mut SheetApp| { + app.logic(ui.ctx()); + app.ui(ui); + }, + SheetApp::new(session, Default::default()), + ); + h.state_mut().run("view.theme", json!({"mode": "dark"})).unwrap(); + h.run_steps(6); + let grid = h.state().grid.rect.expect("grid rect"); + // Inside the scrollbar column, at the height of the column headings. + let probe = pos2(grid.right() + 7.0, grid.top() + 5.0); + let fill = Tokens::dark().tab_bar; + let covered = h.output().shapes.iter().any(|s| matches!(&s.shape, Shape::Rect(r) if r.fill == fill && r.rect.contains(probe))); + assert!(covered, "no tab_bar fill covers {probe:?}"); +}