test(topology): verify database-driven presentation rendering

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-09 23:51:18 +08:00
co-authored by Claude
parent 10808fd98b
commit 67261b10a1
2 changed files with 178 additions and 2 deletions
@@ -0,0 +1,46 @@
# 广寒基地拓扑图表现层数据库化验证报告
日期:2026-07-09
## 结论
页面已经切换为 B1 表现层数据库驱动:节点样式、连接样式、散热器样式和图例来自 `layout.presentation`
## 自动化测试
命令:
```powershell
.\.venv\Scripts\python.exe -m unittest tests.test_topology_api tests.test_guanghan_topology_demo tests.test_guanghan_topology_e2e -v
```
结果:**27 tests OK**
- API 测试:14 passed(含 presentation payload 验证、DB 风格变更反映)
- 源码测试:8 passed(含硬编码 CSS 清除、legend 动态渲染)
- E2E 测试:5 passed(含 DB 风格变更浏览器反映、历史快照、legend 验证)
## 服务验证
`http://localhost:8080/health` 返回 200。
## 人工核查
- GHC-05 空间结构保持不变。
- 两条加压走道仍为数据库默认绿色实线(`#51e89c`)。
- 散热器不覆盖加压走道和模块主体。
- 图例由 API 返回并渲染(`renderLegend()``layout.presentation.legendItems` 动态生成)。
- 临时修改数据库连接线颜色后,浏览器渲染随之变化(E2E 验证 `#00ffaa`)。
- 临时修改数据库核心舱填充色后,浏览器渲染随之变化(E2E 验证 `#123456`)。
## 数据库表
新增 5 张表现层表:
| 表 | 用途 |
|----|------|
| `diagram_themes` | 主题元数据(默认 `guanghan_dark_engineering_v1` |
| `diagram_node_styles` | 节点样式(5 种:node-card, core-card, power-card, power-node-card, vehicle-card |
| `diagram_edge_styles` | 连接样式(6 种:structural_mount, pressurized_passage, fuel, power, cooling, docking |
| `diagram_decoration_styles` | 装饰样式(1 种:radiator |
| `diagram_legend_items` | 图例项(4 项:结构直连, 加压走道, 燃料/供电, 大型折叠散热面板) |