test(client): 关于我们整屏 golden ×三主题(桌面+移动)
该屏正文已全 token 化,加 golden 锁住版本/帮助/关于卡片随主题换色入回归闸 (覆盖更新检查器避免后台 Timer 泄漏)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSKEiHsvauyxYUW2itzUXX
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:jiu_client/providers/update_provider.dart';
|
||||||
|
import 'package:jiu_client/screens/about/about_screen.dart';
|
||||||
|
|
||||||
|
import '../support/golden_harness.dart';
|
||||||
|
|
||||||
|
// 覆盖更新检查器,避免其后台 Timer 在 golden 结束后仍 pending。
|
||||||
|
class _FakeUpdateNotifier extends UpdateNotifier {
|
||||||
|
@override
|
||||||
|
Future<AppUpdateInfo?> build() async => null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Override> _overrides() => [
|
||||||
|
updateProvider.overrideWith(() => _FakeUpdateNotifier()),
|
||||||
|
appVersionProvider.overrideWith((ref) => 'v1.0.72'),
|
||||||
|
];
|
||||||
|
|
||||||
|
/// design-distill 阶段4:关于我们整屏 golden × 三主题(桌面 + 移动)。
|
||||||
|
/// 该屏正文已全 token 化;golden 锁住版本/帮助/关于卡片随主题换色。
|
||||||
|
/// 版本/更新 provider 在测试环境降级为默认值(无插件/无网络)。
|
||||||
|
/// 更新基准:flutter test --update-goldens test/golden/about_golden_test.dart
|
||||||
|
void main() {
|
||||||
|
TestWidgetsFlutterBinding.ensureInitialized();
|
||||||
|
SharedPreferences.setMockInitialValues({});
|
||||||
|
|
||||||
|
goldenAcrossThemes(
|
||||||
|
'about 整屏(桌面)',
|
||||||
|
goldenPrefix: 'about',
|
||||||
|
child: () => const Scaffold(body: AboutScreen()),
|
||||||
|
overrides: _overrides,
|
||||||
|
logical: const Size(1280, 1000),
|
||||||
|
);
|
||||||
|
|
||||||
|
goldenAcrossThemes(
|
||||||
|
'about 整屏(移动)',
|
||||||
|
goldenPrefix: 'about_mobile',
|
||||||
|
child: () => const Scaffold(body: AboutScreen()),
|
||||||
|
overrides: _overrides,
|
||||||
|
logical: const Size(390, 1100),
|
||||||
|
);
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
Reference in New Issue
Block a user