Files
gridcraft/crates/ui-egui/tests/it/scrollbar_column_fill.rs
T
aiongg a7608ada6d CI: one test binary per crate, nextest, line tables only (#2372)
* CI: dev builds keep line tables only

* CI: one integration-test binary per crate

* CI: xtask runs tests with nextest, doctests apart, --keep-going on clippy and wasm

cargo xtask test runs the workspace tests (--lib --bins --tests) with cargo-nextest when it is installed, else cargo test, then the doctests. cargo xtask ci uses the same two steps.

* CI: docs name cargo xtask test

* CI: agent guides name the moved fuzz test

* CI: tests added on main join their crate's test binary
2026-10-23 12:59:46 -04:00

29 lines
1.2 KiB
Rust

//! 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:?}");
}