fix: close only completed integration panels during native save
This commit is contained in:
1 parent
d40fa3a750
commit
87e10740f7
4 files changed
+71
-5
No files matched your search
@@ -244,3 +244,39 @@ def test_database_open_failure_is_classified_and_declines_log_view():
|
||||
assert decision.category == 'FATAL_ACK'
|
||||
assert decision.error_code == 'MENTOR_DATABASE_LOAD_FAILED'
|
||||
assert dict(decision.target)['control_id'] == 7 # IDNO, never launch another log viewer
|
||||
|
||||
|
||||
def completed_integration_panel():
|
||||
texts={1033:'No connectivity changes to be forward annotated',
|
||||
1032:'No pending schematic CES changes to load into PCB',
|
||||
1035:'No pending PCB changes to be back annotated',
|
||||
1034:'No pending CES changes to load into PCB'}
|
||||
return WindowSnapshot(hwnd=10,pid=20,process_name='ExpeditionPCB.exe',process_role='pcb',
|
||||
window_class='#32770',title='Project Integration',phase=DialogPhase.SAVE,owner_hwnd=99,
|
||||
controls=(ControlSnapshot(handle=12,control_id=2,class_name='Button',name='&Close'),
|
||||
*(ControlSnapshot(handle=i,control_id=i,class_name='Static',name=text) for i,text in texts.items())))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('phase',[DialogPhase.SAVE,DialogPhase.CLOSE])
|
||||
def test_completed_integration_panel_only_closes_its_exact_close_control(phase):
|
||||
from dataclasses import replace
|
||||
decision=decide(replace(completed_integration_panel(),phase=phase),load_rules(ASSETS/'dialog_rules.v1.json'))
|
||||
assert decision.action=='close_completed_integration'
|
||||
assert decision.channels==('win32_button_click',)
|
||||
assert dict(decision.target)=={'control_id':2}
|
||||
assert decision.postcondition=='window_gone' and not decision.error_code
|
||||
|
||||
|
||||
@pytest.mark.parametrize('fault',['pending','missing','duplicate','partial','foreign','unowned','disabled','early'])
|
||||
def test_integration_panel_without_complete_owned_idle_proof_never_closes(fault):
|
||||
from dataclasses import replace
|
||||
panel=completed_integration_panel()
|
||||
if fault=='pending': panel=replace(panel,controls=(*panel.controls[:-1],replace(panel.controls[-1],name='CES changes are pending')))
|
||||
elif fault=='missing': panel=replace(panel,controls=panel.controls[:-1])
|
||||
elif fault=='duplicate': panel=replace(panel,controls=(*panel.controls,panel.controls[-1]))
|
||||
elif fault=='partial': panel=replace(panel,diagnostics=('WINDOW_ENUM_INCOMPLETE',))
|
||||
elif fault=='foreign': panel=replace(panel,process_name='Unrelated.exe',process_role='unknown')
|
||||
elif fault=='unowned': panel=replace(panel,owner_hwnd=0)
|
||||
elif fault=='disabled': panel=replace(panel,controls=(replace(panel.controls[0],enabled=False),*panel.controls[1:]))
|
||||
elif fault=='early': panel=replace(panel,phase=DialogPhase.DOCUMENT_ATTACH)
|
||||
assert decide(panel,load_rules(ASSETS/'dialog_rules.v1.json')).action!='close_completed_integration'
|
||||
Reference in new issue
Block a user