test(terminal): add renderer bench smoke script

This commit is contained in:
zhangheng
2026-06-24 14:13:09 +08:00
parent f4c919de40
commit 21019d82e0
7 changed files with 465 additions and 3 deletions

View File

@@ -236,7 +236,11 @@
- context lost 或 WebGL 初始化失败时显示独立 Canvas 2D fallback surface避免同一 canvas 上 WebGL lost 后无法获取 2D context 导致白屏。
- restore 后清空旧 state 并触发重绘,下一帧重建 shader/program/buffer/texture/glyph atlas。
- context lifecycle listener 由 `WebGlContextLifecycle` 持有,组件卸载或 renderer 切换时自动移除。
2. 渲染性能 benchmark 和自动截图 / pixel smoke test
2. **渲染性能 benchmark 和自动截图 / pixel smoke test**
- `scripts/terminal-bench.mjs` 连接已启动的 `/rustui/terminal`,不负责启动/关闭服务。
- 固定覆盖 `200x80``240x100` viewport支持 `--lines``--viewport``--output` 参数。
- 记录行输出耗时、rows/sec、requestAnimationFrame frame time 摘要、`window.__terminalBench` render probe。
- 截图 smoke 默认走 Playwright screenshot PNG 非空/熵检查Canvas 2D fallback 可读时额外做像素采样。
3. Canvas 2D / WebGL runtime switch。
4. 与 Canvas 2D 做 benchmark 对比,按 viewport size / output rate 自动选择 renderer。