feat: scope CBB search selection and maintenance to visible non-READY rows

This commit is contained in:
阿白叔 committed 2026-11-02 18:47:25 +08:00
1 parent c823a4b92d
commit 747ce1add2
5 files changed
+572 -106

No files matched your search

+8 -7
View File
@@ -51,11 +51,12 @@ def test_backup_dialog_keeps_ui_responsive_and_cannot_close_during_restore(qtbot
assert dialog.close_button.isEnabled()
def test_main_window_opens_simple_dialog_and_failure_clears_ready(qtbot, tmp_path):
def test_main_window_opens_non_ready_dialog_and_failure_retains_ready_untargeted(qtbot, tmp_path):
from cbb_refresh_verify.ui.main_window import MainWindow
from cbb_refresh_verify.library_reader import CbbRecord, LibraryReadResult
window = MainWindow(reader=lambda _: LibraryReadResult((
CbbRecord('A', 'LP', status='READY'), CbbRecord('B', 'LP'))), data_root=tmp_path)
CbbRecord('A', 'LP', status='READY'), CbbRecord('B', 'LP'))), data_root=tmp_path,
status_refresher=lambda names, _: {name: 'UNKNOWN' for name in names})
qtbot.addWidget(window)
window.lmc_edit.setText('lib.lmc'); window.load_library()
qtbot.waitUntil(lambda: not window.busy)
@@ -63,12 +64,12 @@ def test_main_window_opens_simple_dialog_and_failure_clears_ready(qtbot, tmp_pat
window.backup_restore_button.click()
dialog = window.backup_dialog
assert dialog.isVisible()
assert dialog.block_combo.currentText() == 'A'
dialog.started.emit('A')
assert dialog.block_combo.currentText() == 'B'
dialog.started.emit('B')
assert window.busy
assert 'A' not in window.ready_names
dialog.completed.emit('A', VerifyResult('FAIL', stderr='损坏'))
assert window.cbb_table.item(0, 2).text() == '未知 / 需确认'
assert 'A' in window.ready_names
dialog.completed.emit('B', VerifyResult('FAIL', stderr='无法确认', safe_to_continue=False))
assert window.cbb_table.item(1, 2).text() == '未知 / 需确认'
dialog.reject()
qtbot.waitUntil(lambda: not window.busy)