fix: cancel owned prewrite PCB at the license selector
This commit is contained in:
1 parent
d45a29503d
commit
e4fc37a291
2 files changed
+59
No files matched your search
@@ -33,6 +33,38 @@ def test_proved_ordinary_cancel_finishes_tip_to_loaded_without_annotation_or_sec
|
||||
assert messages==([(100,16),(31,245)] if prior_close else [(201,245),(31,245),(100,16)])
|
||||
|
||||
|
||||
@pytest.mark.parametrize('obstacle', [None, 'unknown_control', 'other_window', 'write'])
|
||||
def test_cancel_at_owned_license_selector(tmp_path, monkeypatch, obstacle):
|
||||
import win32gui
|
||||
from cbb_refresh_verify.dialog_models import ControlSnapshot, DialogPhase, WindowSnapshot
|
||||
|
||||
job, records, messages, state = loaded_fixture(tmp_path, monkeypatch)
|
||||
ordinary_proof(job, tmp_path, job['diagnostic_log_baseline'])
|
||||
if obstacle == 'write':
|
||||
(tmp_path/'save.log').touch()
|
||||
controls = (ControlSnapshot(201, 5225, 'Button', 'Select the desired product license', enabled=True),
|
||||
ControlSnapshot(202, 1522, 'GXWND', ''),
|
||||
ControlSnapshot(203, 1, 'Button', 'OK', enabled=True),
|
||||
ControlSnapshot(204, 2, 'Button', 'Cancel' if obstacle != 'unknown_control' else 'Next',
|
||||
enabled=True))
|
||||
snapshot = WindowSnapshot(200, 12, 'ExpeditionPCB.exe', 'pcb', '#32770', '',
|
||||
DialogPhase.PCB_STARTING, controls)
|
||||
monkeypatch.setattr(failed_session, '_startup_snapshot', lambda *args: snapshot)
|
||||
monkeypatch.setattr(win32gui, 'EnumWindows', lambda fn, arg:
|
||||
[fn(hwnd, arg) for hwnd in ((200, 300) if obstacle == 'other_window' else (200,))])
|
||||
monkeypatch.setattr(win32gui, 'GetClassName', lambda hwnd: '#32770' if hwnd == 200 else 'Afx:other')
|
||||
monkeypatch.setattr(win32gui, 'GetWindowText', lambda hwnd: '')
|
||||
def post(hwnd, message, *_):
|
||||
messages.append((hwnd, message))
|
||||
records.clear()
|
||||
monkeypatch.setattr(win32gui, 'PostMessage', post)
|
||||
|
||||
result = failed_session.close_failed_startup(job, 12, timeout_seconds=1)
|
||||
|
||||
assert messages == ([(204, 245)] if obstacle is None else [])
|
||||
assert result['status'] == ('CLOSED' if obstacle is None else 'RETAINED')
|
||||
|
||||
|
||||
@pytest.mark.parametrize('obstacle',['missing_ready','missing_cancel_phase','supervisor_write','worker_write',
|
||||
'missing_supervisor','missing_baseline','foreign_worker','foreign_target','save','missing_cancel','interactive','native_lm'])
|
||||
def test_ordinary_cleanup_requires_positive_bound_no_write_evidence(tmp_path,monkeypatch,obstacle):
|
||||
|
||||
Reference in new issue
Block a user