fix: bound native edit messages and identify empty IE infrastructure
This commit is contained in:
1 parent
bb98fe66dd
commit
8e486c1097
4 files changed
+132
-3
No files matched your search
@@ -230,3 +230,26 @@ def test_custom_prompt_must_disappear_before_main_close(tmp_path, monkeypatch):
|
||||
result = failed_session.close_failed_startup(job, 12, timeout_seconds=1)
|
||||
assert result['status'] == 'CLOSED' and ticks[0] > 0
|
||||
assert len(messages) == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize('obstacle', ['', 'title', 'area', 'children', 'near_class'])
|
||||
def test_only_exact_empty_zero_area_childless_ie_infrastructure_is_benign(tmp_path, monkeypatch, obstacle):
|
||||
import win32gui, win32con
|
||||
job, records, messages = startup_fixture(tmp_path, monkeypatch)
|
||||
monkeypatch.setattr(win32gui, 'EnumWindows', lambda fn, arg: [fn(hwnd, arg) for hwnd in (100, 200)])
|
||||
monkeypatch.setattr(win32gui, 'GetClassName', lambda hwnd: 'Afx:main' if hwnd == 100 else
|
||||
'Internet Explorer_Hidden_other' if obstacle == 'near_class' else 'Internet Explorer_Hidden')
|
||||
monkeypatch.setattr(win32gui, 'GetWindowText', lambda hwnd: 'Expedition PCB' if hwnd == 100 else
|
||||
'Active prompt' if obstacle == 'title' else '')
|
||||
monkeypatch.setattr(win32gui, 'GetWindowRect', lambda hwnd: (0, 0, 100, 50) if obstacle == 'area' else (0, 0, 0, 0))
|
||||
monkeypatch.setattr(win32gui, 'EnumChildWindows', lambda hwnd, fn, arg:
|
||||
fn(201, arg) if hwnd == 200 and obstacle == 'children' else None)
|
||||
result = failed_session.close_failed_startup(job, 12, timeout_seconds=0)
|
||||
if obstacle:
|
||||
assert result['status'] == 'RETAINED' and messages == []
|
||||
assert result['unknown_windows'][0]['hwnd'] == 200
|
||||
else:
|
||||
assert result['status'] == 'CLOSED' and messages == [(100, win32con.WM_CLOSE)]
|
||||
entry = result['benign_auxiliary_windows'][0]
|
||||
assert entry['class'] == 'Internet Explorer_Hidden' and entry['rect'] == [0, 0, 0, 0]
|
||||
assert entry['children'] == []
|
||||
Reference in new issue
Block a user