fix: preserve native error precedence over integration-panel closure
This commit is contained in:
1 parent
7c27f9604e
commit
2149e71b67
2 files changed
+19
-16
No files matched your search
@@ -220,21 +220,6 @@ def archive_version_choice(snapshot, root):
|
||||
|
||||
|
||||
def decide(snapshot: WindowSnapshot, rules: Sequence[DialogRule]) -> RuleDecision:
|
||||
if (snapshot.title == 'Project Integration' and snapshot.phase in (DialogPhase.SAVE, DialogPhase.CLOSE)
|
||||
and snapshot.process_name.casefold() == 'expeditionpcb.exe' and snapshot.process_role == 'pcb'
|
||||
and snapshot.window_class == '#32770' and snapshot.owner_hwnd and not snapshot.diagnostics):
|
||||
idle = {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'}
|
||||
complete = all(len(matches := [c for c in snapshot.controls if c.control_id == identifier]) == 1
|
||||
and matches[0].class_name == 'Static' and matches[0].name == text for identifier, text in idle.items())
|
||||
close = [c for c in snapshot.controls if c.control_id == 2]
|
||||
if (complete and len(close) == 1 and close[0].class_name == 'Button'
|
||||
and close[0].name.replace('&', '') == 'Close' and close[0].enabled):
|
||||
return RuleDecision(rule_id='completed-integration-panel', category='SAFE_CONFIRM',
|
||||
action='close_completed_integration', channels=('win32_button_click',),
|
||||
target=(('control_id', 2),), postcondition='window_gone')
|
||||
# Windows Text Services Framework language-bar window exposed by Mentor's
|
||||
# process is not a Mentor modal: it has no controls and must not abort a run.
|
||||
if (snapshot.window_class.casefold() == 'cicerouiwndframe'
|
||||
@@ -268,6 +253,22 @@ def decide(snapshot: WindowSnapshot, rules: Sequence[DialogRule]) -> RuleDecisio
|
||||
channels=('win32_button_click', 'uia_invoke'),
|
||||
target=(('control_id', 7),), postcondition='window_gone',
|
||||
error_code='MENTOR_DATABASE_LOAD_FAILED', detail=' | '.join(snapshot.texts))
|
||||
if (snapshot.title == 'Project Integration' and snapshot.phase in (DialogPhase.SAVE, DialogPhase.CLOSE)
|
||||
and snapshot.process_name.casefold() == 'expeditionpcb.exe' and snapshot.process_role == 'pcb'
|
||||
and snapshot.window_class == '#32770' and snapshot.owner_hwnd and not snapshot.diagnostics
|
||||
and not re.search(r'\b(?:errors?|failed|inconsistent)\b', combined)):
|
||||
idle = {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'}
|
||||
complete = all(len(matches := [c for c in snapshot.controls if c.control_id == identifier]) == 1
|
||||
and matches[0].class_name == 'Static' and matches[0].name == text for identifier, text in idle.items())
|
||||
close = [c for c in snapshot.controls if c.control_id == 2]
|
||||
if (complete and len(close) == 1 and close[0].class_name == 'Button'
|
||||
and close[0].name.replace('&', '') == 'Close' and close[0].enabled):
|
||||
return RuleDecision(rule_id='completed-integration-panel', category='SAFE_CONFIRM',
|
||||
action='close_completed_integration', channels=('win32_button_click',),
|
||||
target=(('control_id', 2),), postcondition='window_gone')
|
||||
matches = [rule for rule in rules if _matches(rule, snapshot, include_phase=True)]
|
||||
if matches:
|
||||
best_priority = max(rule.priority for rule in matches)
|
||||
|
||||
@@ -267,7 +267,7 @@ def test_completed_integration_panel_only_closes_its_exact_close_control(phase):
|
||||
assert decision.postcondition=='window_gone' and not decision.error_code
|
||||
|
||||
|
||||
@pytest.mark.parametrize('fault',['pending','missing','duplicate','partial','foreign','unowned','disabled','early'])
|
||||
@pytest.mark.parametrize('fault',['pending','missing','duplicate','partial','foreign','unowned','disabled','early','error'])
|
||||
def test_integration_panel_without_complete_owned_idle_proof_never_closes(fault):
|
||||
from dataclasses import replace
|
||||
panel=completed_integration_panel()
|
||||
@@ -279,4 +279,6 @@ def test_integration_panel_without_complete_owned_idle_proof_never_closes(fault)
|
||||
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)
|
||||
elif fault=='error': panel=replace(panel,controls=(*panel.controls,
|
||||
ControlSnapshot(handle=500,control_id=500,class_name='Static',name='There were errors during Project Integration.')))
|
||||
assert decide(panel,load_rules(ASSETS/'dialog_rules.v1.json')).action!='close_completed_integration'
|
||||
Reference in new issue
Block a user