update at 2026-01-21 21:48:08

This commit is contained in:
douboer@gmail.com
2026-01-21 21:48:08 +08:00
parent 54f3fd93f2
commit 78d8801a07
8 changed files with 184 additions and 271 deletions

View File

@@ -22,26 +22,23 @@ tests/
- 角度数组和半径数组的有效性验证
- 不同类型示例的存在性检查
### 2. utils.test.ts (48 个测试)
### 2. utils.test.ts (39 个测试)
测试所有工具函数的核心逻辑:
- **polarToXY**: 极坐标转换
- **normalizeDeg**: 角度归一化
- **annularSectorCentroid**: 扇形形心计算
- **annularSectorPath**: SVG 路径生成
- **annularSectorInsetPath**: 内缩路径生成
- **calculateLabelRotation**: 文字旋转角度
- **generateSectorColor**: 扇区颜色生成
- **generateTextPath**: 文字路径生成
- **generateVerticalTextPath**: 竖排文字路径
- **getTextColorForBackground**: 文字颜色适配
- **calculateSectorFontSize**: 字体大小计算
### 3. useLuopan.test.ts (32 个测试)
### 3. useLuopan.test.ts (29 个测试)
测试罗盘业务逻辑组合函数:
- 基本功能和返回值验证
- 扇区生成逻辑
- 文字位置模式middle/centroid
- 文字方向判断
- 竖排文字判断
- 内部填色逻辑
- 响应式更新
@@ -90,7 +87,7 @@ npm test -- --coverage
## 测试统计
- **总测试文件**: 4 个
- **总测试用例**: 159
- **总测试用例**: 147
- **测试通过率**: 100%
- **测试运行时间**: ~1.8 秒