#4630: test that the scrollbar thumb stays visible under the pointer

The stock thin scroll bar fades its handle to the track's opacity while the
pointer is on it, so the thumb vanished. The test checks every theme's floating
scroll style keeps the handle opaque and more opaque than the track. Without
the override both are 0.6.
This commit is contained in:
skylar taylor-barrick committed 2026-10-22 13:11:14 -06:00
1 parent 377be33714
commit 35ea594196
1 file changed
+23
+23
View File
@@ -1131,6 +1131,29 @@ mod tests {
assert_eq!(ctx.zoom_factor(), 1.0);
}
// Regression test for #4630: the stock thin scroll bar fades its handle to the same opacity
// as its track while the pointer is on it, so the thumb disappeared when it was grabbed.
#[test]
fn scrollbar_thumb_stays_more_visible_than_its_track_in_every_theme() {
for kind in ThemeKind::ALL {
let ctx = egui::Context::default();
apply(&ctx, kind);
for theme in [egui::Theme::Dark, egui::Theme::Light] {
let scroll = ctx.style_of(theme).spacing.scroll;
if !scroll.floating {
continue;
}
assert!(
scroll.interact_handle_opacity > scroll.interact_background_opacity,
"{kind:?}/{theme:?}: handle {} vs track {} under the pointer",
scroll.interact_handle_opacity,
scroll.interact_background_opacity
);
assert_eq!(scroll.interact_handle_opacity, 1.0, "{kind:?}/{theme:?}: the thumb is opaque under the pointer");
}
}
}
/// The desktop app installs fonts and loads the saved UI Font Size in its first frame, while
/// egui's default fonts are still active. Any size but Small then panicked on the next pass
/// ("FontFamily::Name("medium") is not bound to any fonts") because the plugin rescaled a