fix: stabilize native refresh and complete toolbar acceptance

This commit is contained in:
阿白叔 committed 2026-10-11 15:41:50 +08:00
1 parent b8acbc6de5
commit b203806fd1
22 files changed
+898 -102

No files matched your search

+7 -4
View File
@@ -24,6 +24,9 @@ def main():
request = Path(args[args.index("--request") + 1].strip('"'))
snapshot = json.loads(request.read_text(encoding="utf-8-sig"))
ui = ToolbarUI(tool.pid)
if not ui.panel.exists(timeout=0.2) or not ui.panel.is_visible():
ui.expand()
panel_handle = ui.panel.handle
evidence = options.evidence or Path(os.environ["LOCALAPPDATA"]) / "DxProductivity/acceptance/toolbar-20261011"
evidence.mkdir(parents=True, exist_ok=True)
handle = ui.toolbar.handle
@@ -35,7 +38,7 @@ def main():
if button.element_info.control_type in ('Button', 'CheckBox')]
centers = [(rect.top + rect.bottom) / 2 for rect in buttons]
assert max(centers) - min(centers) <= 2, buttons
ui.toolbar.capture_as_image().save(str(evidence / "toolbar.png"))
ui.capture(ui.toolbar).save(str(evidence / "toolbar.png"))
if ui.panel.exists(timeout=0.2) and ui.panel.is_visible():
ui.collapse()
pages = []
@@ -45,7 +48,7 @@ def main():
panel_dpi = ctypes.windll.user32.GetDpiForWindow(ui.panel.handle)
assert panel_bounds[2] * 96 / panel_dpi <= 800, (name, panel_bounds)
assert panel_bounds[3] * 96 / panel_dpi <= 520, (name, panel_bounds)
ui.panel.capture_as_image().save(str(evidence / f"page-{len(pages)}.png"))
ui.capture(ui.panel).save(str(evidence / f"page-{len(pages)}.png"))
pages.append({"page": name, "client_rect": panel_bounds, "dpi": panel_dpi})
ui.collapse()
progress = request.with_name("apply-progress.json")
@@ -63,10 +66,10 @@ def main():
mouse.release(coords=win32gui.GetCursorPos())
win32api.SetCursorPos(pointer)
moved = wait_for(lambda: win32gui.GetWindowRect(handle) if win32gui.GetWindowRect(handle) != first else None)
assert not ui.panel.is_visible()
assert not win32gui.IsWindowVisible(panel_handle)
ui.feature("PDF 导出")
ui.panel.minimize()
wait_for(lambda: not ui.panel.is_visible())
wait_for(lambda: not win32gui.IsWindowVisible(panel_handle))
ui.expand()
assert "PDF 导出" in ui.texts(ui.panel)
if options.leave_collapsed: