Merge pull request #1989 from yonatan-langer83/prefs-slider-label

Preferences: the Interface size slider is labelled again
This commit is contained in:
FredApps authored and GitHub committed 2026-11-18 16:30:53 +07:00
commit d159b890d7
2 files changed
+20 -2

No files matched your search

+8 -2
View File
@@ -1351,8 +1351,14 @@ fn dlg_preferences(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool {
// on release, and at once from the keyboard.
let pending = d.fields.get("uiScale").and_then(|v| v.parse::<f32>().ok());
let mut scale = pending.unwrap_or(app.ui.ui_scale);
let r = ui.add(egui::Slider::new(&mut scale, 0.75..=1.75));
// No visible label here (the row is laid out to fit); the accessible name only.
// Labelled like the Measurement units row below it. The egui 0.37 migration (#1350) dropped
// the slider's own text and kept only its accessible name, which left a bare "1.00".
let r = ui
.horizontal(|ui| {
ui.label("Interface size:");
ui.add(egui::Slider::new(&mut scale, 0.75..=1.75))
})
.inner;
let enabled = r.enabled();
r.widget_info(|| egui::WidgetInfo::slider(enabled, f64::from(scale), "Interface size"));
if r.is_pointer_button_down_on() {
@@ -39,6 +39,18 @@ fn dark(app: &SlideApp) -> bool {
app.ui.brightness == Brightness::Dark
}
/// The interface size slider has a visible label, not just a bare "1.00" beside it.
#[test]
fn the_interface_size_slider_is_labelled_on_screen() {
let mut h = harness();
open_options(&mut h);
let label = h.query_by_label("Interface size:").expect("the slider's label is shown");
let slider = interface_size(&h);
let (label, slider) = (label.rect(), slider.rect());
assert!(label.max.x <= slider.min.x, "the label sits before the slider: {label:?}, {slider:?}");
assert!(label.center().y > slider.min.y && label.center().y < slider.max.y, "on the same row: {label:?}, {slider:?}");
}
/// A checkbox applies as it is toggled and Cancel puts the old value back.
#[test]
fn options_cancel_undoes_the_changes() {