test(da07): cover off-status dash and type-delegate pending routing; uniform delegate routing in on_check

This commit is contained in:
2026-06-11 12:36:58 -04:00
parent 7d64d3a8a6
commit 8b96fe4e15
2 changed files with 20 additions and 1 deletions

View File

@@ -216,7 +216,7 @@ class DevicesTab(TableTab):
dev = self._devices[row]
if dev.present:
self._ctrl.set_device_active(dev.index, checked)
self.delegate.mark_pending(row, col)
self._delegate_for(col).mark_pending(row, col)
self._pending_writes.add((row, col))
def _row_actions(self, row: int, col: int):

View File

@@ -71,3 +71,22 @@ def test_edit_marks_pending_and_rebuild_resolves(qtbot):
assert (0, 4) in tab.delegate._pending
tab.rebuild()
assert (0, 4) not in tab.delegate._pending
def test_no_report_yet_renders_off_dash(qtbot):
tab, ctrl = _tab(qtbot)
ctrl.devices.set_status(0, "") # present, no 'H' report yet
tab.rebuild()
item = tab.table.item(0, 2)
assert item.data(STATUS_ROLE) == "off"
assert item.text() == ""
def test_type_edit_pending_routes_to_the_type_delegate(qtbot):
tab, ctrl = _tab(qtbot, devices=1, capacity=4)
label = ctrl.device_types.all()[0].id
tab.on_edit(3, 3, label) # add via an empty slot's Type
assert (3, 3) in tab._type_delegate._pending # painted by the combo delegate
assert (3, 3) not in tab.delegate._pending
tab.rebuild()
assert (3, 3) not in tab._type_delegate._pending