给全部源码补中文注释,并新增代码导览

- 67 个 .cs 文件加中文注释:每个文件顶部说明职责/调用方/线程与节拍/
  已知限制/「要改什么就改哪里」,字段与方法逐条一行说明,复杂逻辑内插关键步骤
- 纯注释改动:脚本校验所有新增行都是注释、无非注释改动(仅 2 个文件的 BOM
  随新头部注释下移,文件仍以 BOM 开头)
- 新增 docs/代码导览.md:模块地图、「我要改 X 看哪个文件」对照表、易踩的坑、
  悬浮条显示规则、测试与验收指引
- 编译通过,回归测试 23/23 通过

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
zimoyin
2026-10-13 15:44:15 +08:00
parent 9eff3ec410
commit 66ab309939
72 changed files with 3907 additions and 2 deletions
+24
View File
@@ -1,3 +1,16 @@
// =====================================================================================
// PathTests —— XPath 定位的解析 / 生成 / 转义 / 歧义 / 拒绝 回归。
//
// 覆盖范围:ControlPath 的 Select / SelectUnique / Build / PreparePaths / Quote /
// ValidateSyntax,以及 ControlLocatorBuilder 与 ControlLocatorService.ResolveFromTree
// 的端到端行为。
//
// 为什么这样测:全部跑在纯内存 ControlTreeNode 快照(TreeFixture)上,
// 不触碰真实 UIA / HWND / provider——UIA 自读本进程会崩溃,这里根本不需要它。
//
// 新增用例:在 Register(...) 的列表里加一行「用例名 → 委托」,再在本类实现一个
// private static void 方法;断言统一用 Check.Matches / Rejected / Equal / Same。
// =====================================================================================
using System;
using System.Collections.Generic;
using pacs_win_uia.Models;
@@ -9,16 +22,27 @@ namespace PacsWinUia.RegressionTests
{
public static void Register(IList<KeyValuePair<string, Action>> tests)
{
// 防:XPath 属性 / contains / 轴 / 位置谓词解析回归。
tests.Add(new KeyValuePair<string, Action>("XPath attributes, contains, axes and positional predicates", XPathQueries));
// 防:重复 AutomationId 与结构序号导致路径不唯一、roundtrip 丢节点。
tests.Add(new KeyValuePair<string, Action>("All nodes roundtrip with duplicate IDs and structural indices", AllNodesRoundtrip));
// 防:祖先 Name 变化后生成路径失效(生成路径不得依赖可变的 Name)。
tests.Add(new KeyValuePair<string, Action>("Generated paths survive names changing on every ancestor", ChangingNames));
// 防:ClassName 兜底与「稳定祖先锚定」能力丢失。
tests.Add(new KeyValuePair<string, Action>("Class-qualified paths and stable ancestor anchors", ClassAndAnchor));
// 防:含单双引号 / 斜杠 / 中文的名称转义错误。
tests.Add(new KeyValuePair<string, Action>("XPath quoting for both quotes, slash and Chinese", Escaping));
// 防:旧显示格式 / 结构化旧路径被当作 XPath 执行。
tests.Add(new KeyValuePair<string, Action>("Old display and structured paths are not executed", RejectLegacy));
// 防:非法 / 标量 / 属性型 XPath 被静默接受。
tests.Add(new KeyValuePair<string, Action>("Invalid, scalar and attribute XPath rejected", RejectedPaths));
// 防:歧义路径被武断解析成第一个节点。
tests.Add(new KeyValuePair<string, Action>("Ambiguity never resolves to an arbitrary first node", AmbiguousPaths));
// 防:陈旧的 RuntimeId / locator 提示反过来覆盖当前 XPath。
tests.Add(new KeyValuePair<string, Action>("Changed XPath is authoritative over stale locator hints", AuthoritativeXPath));
// 防:根节点、外部节点、不完整快照等边界处理回归。
tests.Add(new KeyValuePair<string, Action>("Root, outsider and incomplete snapshot handling", RootAndIncomplete));
// 防:XPath 解析丢失 MSAA / Win32 载荷或来源标记。
tests.Add(new KeyValuePair<string, Action>("XPath resolution preserves MSAA and Win32 payloads", OtherSources));
}