Add control_patterns: extended UIA patterns (Expand/Select/Range/Scroll)#397
Merged
Conversation
The accessibility backend had only Value/Invoke/Toggle/Grid-read, so treeviews, listboxes/combos, sliders and off-screen rows had no native pattern path. Add ExpandCollapse / SelectionItem / RangeValue / ScrollItem actions on top of the existing backend ABC, dispatched through the injectable get_backend() seam (headless-testable via a fake backend; real UIA calls in the Windows backend).
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 55 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
The test's _FakeBackend overrode pattern methods with **kw instead of the explicit name/role/app_name/automation_id signature, which Codacy/Pylint flags as arguments-differ. Use the same signatures as AccessibilityBackend.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



摘要
新增
expand_control/collapse_control/control_expand_state/select_control_item/control_range/set_control_range/scroll_control_into_view— 在既有無障礙後端 ABC 之上補上擴充 UIA 控制模式。後端原本只有 Value/Invoke/Toggle/Grid-read 四種模式,使得樹狀檢視、清單/下拉、滑桿與螢幕外列無法以原生模式驅動,只能退回脆弱的像素猜測。新增 ExpandCollapse / SelectionItem / RangeValue / ScrollItem 物件層級動作,透過可注入的
accessibility.backends.get_backend()接縫分派(與無障礙模組其餘部分相同接縫),因此無頭核心可在任何平台以 fake backend 單元測試;真正的 UI Automation 呼叫位於 Windows 後端。未實作某模式的後端拋出AccessibilityNotAvailableError。Qt-free。五層
accessibility/backends/base.py加 7 個 method(預設 _unsupported);Windows 後端:真正 UIA pattern 呼叫(pattern IDs 10005/10010/10003/10017)。utils/control_patterns/— 7 個 facade 函式分派 get_backend()。測試
test_control_patterns_batch.py— 注入 fake backend 驗證 expand/collapse 分派、expand_state、select、range get/set、scroll、unsupported backend 正確 raise、wiring + facade。8 passed。ruff / bandit / radon / Qt-free 全乾淨。