Enhance Samsung monitor detection logic and add unit tests for trigger candidate selection

This commit is contained in:
Lago
2026-03-27 15:16:56 +01:00
parent 37eb9e9fa0
commit c06799f7b9
3 changed files with 88 additions and 28 deletions
+27
View File
@@ -0,0 +1,27 @@
from __future__ import annotations
from app.hardware import _select_trigger_candidate_index
def test_select_trigger_candidate_by_unique_trigger_code() -> None:
candidates = [
("DELL U2720Q", 60),
("Generic PnP Monitor", 19),
]
assert _select_trigger_candidate_index(candidates) == 1
def test_select_trigger_candidate_by_generic_tiebreaker() -> None:
candidates = [
("DELL U2720Q", 15),
("Generic PnP Monitor", 19),
]
assert _select_trigger_candidate_index(candidates) == 1
def test_select_trigger_candidate_none_when_still_ambiguous() -> None:
candidates = [
("Generic PnP Monitor #1", 15),
("Generic PnP Monitor #2", 19),
]
assert _select_trigger_candidate_index(candidates) is None