更新换行算法和APP-PUSH

This commit is contained in:
吕新雨
2026-02-10 11:39:33 +08:00
parent f03d36b5e9
commit ee2d9f44ea
105 changed files with 9967 additions and 233 deletions

View File

@@ -0,0 +1,57 @@
# golden-tests子模块规范
## 子模块名称
golden-testsGolden Cases 与性质测试)
## 目标描述
建立可持续的回归体系,保证换行算法满足:
- 同输入同输出(确定性)
- 跨端一致(在固定测量/宽度 profile 下)
- 规则变更可控(通过 `configVersion` 回溯)
本模块产出的是测试数据与测试规则,不产出业务功能。
## 输入/输出定义
### 输入
- Golden Case 集合(建议 JSON/TS fixture
- `text`
- `lang`
- `context`
- `availableWidth`
- `maxLines`
- `fontSpec?`APP
- `constraints?`
- `overflowMode?`
- `configVersion`
### 输出
- 对每个 case 的期望输出:
- `expected.lines: string[]`
- `expected.wrappedText: string`
- 可选:`expected.meta.breaks``expected.meta.fallback_type/overflow_type/reason`
并定义性质测试property tests
- **确定性**:同输入多次调用输出一致
- **近似单调性**`availableWidth` 变小不会让任一行变得更宽(在同测量模式下)
- **maxLines 不变差**`maxLines` 增加时至少不从可解变 overflow
## 验收标准(可验证)
- **覆盖度**
- 每种语言至少 20 个样例:短/长、含标点/无标点、含 emoji、含 protectedPhrases、含 shift/accum/self、极窄宽度
- **固定口径**
- 测量可控APP 用稳定的测量 mock或固定字体与平台WIDGET 用固定 width profile
- **CI 可运行**:在自动化环境可一键跑完(不依赖人工操作)
## 依赖与关联
- **依赖**`core-contract``search-engine-*``scoring-tiebreak``overflow-fallback`
- **被依赖**`integration`(接入后验收也可引用 Golden