feat(client): 字体可注入 + 启用 golden 视觉回归闸
- pangolin_theme: PangolinFonts 加 useBundled 开关 + sora/manrope/jetBrainsMono/ manropeTextTheme 封装(生产走 google_fonts / 测试走 bundled family); PangolinText 与 _build 改调封装,移除散落的 GoogleFonts 直接调用 - test/flutter_test_config.dart: 全测试前置,FontLoader 注册 test/fonts 真实 Sora/Manrope/JetBrainsMono + Lucide 图标字体,置 useBundled=true - 启用 test/golden(去 @Skip):连接键三态+推荐卡+额度卡×明暗 12 基准图 - tool/visual-diff.md: 标注 golden 严格闸已落地 测试: flutter test 76 通过(原 64+1skip → 76 无 skip), analyze 0 error Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@@ -1,21 +1,9 @@
|
||||
// components_golden_test.dart — 关键组件 golden(明/暗两主题)
|
||||
//
|
||||
// 覆盖:连接键三态、智能选择推荐卡、免费额度卡。
|
||||
// 首次生成基准图:`flutter test --update-goldens test/golden`。
|
||||
//
|
||||
// TODO: 字体依赖待解决。
|
||||
// google_fonts 在测试环境中使用内部变体字体族名(如 `Manrope_400italic0`),
|
||||
// 难以通过 FontLoader 预加载。需要:
|
||||
// 1. 确认 google_fonts v6.3.3 各变体的实际族名
|
||||
// 2. 在 setUpAll 中用 FontLoader 加载 test/fonts/*.ttf
|
||||
// 3. 调用 `flutter test --update-goldens test/golden` 生成基准图
|
||||
// 在此之前,跳过 golden 测试以避免 CI 失败;
|
||||
// 组件行为已由 test/widget/ 覆盖。
|
||||
// ignore_for_file: directives_ordering
|
||||
@Skip('Golden tests need bundled fonts + baseline generation. '
|
||||
'See TODO above for setup steps.')
|
||||
library;
|
||||
|
||||
// 重新生成基准图:`flutter test --update-goldens test/golden`。
|
||||
// 字体由 test/flutter_test_config.dart 经 FontLoader 注册 + PangolinFonts.useBundled
|
||||
// 提供真实 Sora/Manrope/JetBrainsMono,无需 google_fonts 运行时拉取。
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pangolin_vpn/l10n/strings_zh.dart';
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 9.2 KiB |