Skip to content

Commit 03850f1

Browse files
committed
test: avoid font-metric flake in preset strip refresh test
1 parent a3d0a57 commit 03850f1

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

tests/integration/test_wizard_navigation_extra.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ def test_clinical_preset_buttons_survive_settings_refresh(wizard, qtbot):
8686
updated = dict(step1.clinical_presets)
8787
updated[preset_name] = ["MDS-UPDRS", "Y-BOCS-o"]
8888
step1._on_presets_changed(updated)
89-
qtbot.wait(50)
90-
91-
assert step1.get_preset_button(preset_name) is not None
92-
assert step1.preset_scroll_content.width() > 20
93-
assert step1.preset_scroll_area.height() > 10
94-
long_name_btn = step1.get_preset_button(preset_name)
95-
assert long_name_btn is not None
96-
assert (
97-
long_name_btn.minimumWidth()
98-
>= long_name_btn.fontMetrics().horizontalAdvance(preset_name)
99-
)
89+
90+
def strip_ready() -> bool:
91+
btn = step1.get_preset_button(preset_name)
92+
return (
93+
btn is not None
94+
and btn.text() == preset_name
95+
and step1.preset_scroll_content.width() > 20
96+
and step1.preset_scroll_area.height() > 10
97+
)
98+
99+
qtbot.waitUntil(strip_ready, timeout=2000)

0 commit comments

Comments
 (0)