Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion crates/ui-egui/tests/it/header_autofit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ fn table_filter_autofit_works_through_command_and_header_double_click() {
let rect = geo.cell_rect(sheet, cell);
let button = gridcraft_ui_egui::grid::filter_button_rect(&geo, sheet, cell);
let style = app.session.active().unwrap().wb.styles.get(sheet.style_id(cell));
let text_width = gridcraft_engine::cmd::format::approx_text_width("Quarterly Revenue", style.font.size, style.font.bold) * geo.z;
// Measured as AutoFit measured it, with the app's fonts (they differ from machine to
// machine). The app installs them before AutoFit runs; AutoFit without them, on the
// engine's estimate, is `autofit_filter_buttons` in the engine's tests.
let measure = app.session.text_width.as_ref().expect("the app measures text with its fonts");
let measured = measure("Quarterly Revenue", &style.font, true);
let text_width = measured * geo.z;
assert!(rect.left() + text_width + 2.5 * geo.z < button.left(), "heading overlaps filter: zoom={zoom}, double_click={double_click}");
assert_eq!(app.session.active().unwrap().undo.len(), 1);
h.state_mut().session.execute("edit.undo", json!({})).unwrap();
Expand Down
Loading