Files
voculinux/tests
Kacper PaczosandGitHub e330f9db70 fix(settings): size the unused downloads list to its real rows (#686)
* fix(settings): size the unused downloads list to its real rows

The list reserved 56px per row, but a row renders taller than that once
its margins and the Delete button are counted. With two leftover models
the header read "2 leftover models" while only the first row fitted in
the viewport, and the second could neither be seen nor deleted. The
overlay scrollbar gave no hint either, since it stays invisible until
hovered.

Measure the list once its rows are in place and cap that at the existing
220px, and keep the scrollbar in the layout so a list that does reach the
cap looks scrollable.

* fix(settings): test the list sizing without reimporting the dialog

Review follow-ups on #686.

The test helper popped vocalinux.ui.settings_dialog from sys.modules at
collection time and reimported it under a patched Gtk, restoring only
sys.modules and not the attribute on the package. Whichever module object
a later test reached then depended on collection order, which is why
test_model_deletion::test_whisper_list_and_delete failed on 3.9/3.10 with
assert [] == ['tiny'] while main stayed green.

Move the arithmetic into a module-level _clamp_unused_downloads_height()
and unit-test that directly, the way _list_downloaded_whisper_models is
already tested. Nothing touches sys.modules now.

The dialog cannot be instantiated under the mocked-GTK harness, so the
wiring the old tests never covered is asserted against the method source,
following test_settings_mode_change.py: refresh calls the fit, the fit
measures the listbox and feeds set_min_content_height, the per-row
estimate stays gone, and the scrollbar stays out of overlay mode.

* fix(settings): remeasure the unused-downloads list when it expands

The refresh measures while the expander is collapsed and the dialog may
not be mapped; if that first measurement ever comes back short, the
expand handler remeasures so the rows cannot stay clipped.
2026-08-26 23:58:55 -07:00
..
2026-07-25 13:04:52 -07:00