Files
jiu/client/test/golden/license_golden_test.dart
T

51 lines
1.8 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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/core/auth/auth_state.dart';
import 'package:jiu_client/core/utils/clock.dart';
import 'package:jiu_client/providers/license_provider.dart';
import 'package:jiu_client/screens/license/license_screen.dart';
import '../support/shell_harness.dart';
/// 授权管理独立一级屏 golden × 三主题(回归闸 + 保真基准),照原型
/// design/prototype/screens/license.html:默认落「授权信息」tab(与原型截图
/// 默认态一致),三 tab 均可见(admin + 非 iOS)。到期日照抄 about/settings
/// 现有 golden 基准 2027-03-15appClock 冻结 2026-07-13 09:30:15。
/// node tools/fidelity.mjs license
/// 窄屏另见 license_mobile_golden_test.dart。
/// 更新基准:flutter test --update-goldens test/golden/license_golden_test.dart
class _FakeLicenseActive extends LicenseNotifier {
@override
Future<LicenseInfo?> build() async => LicenseInfo(
id: 1,
type: 'annual',
isActive: true,
maxDevices: 3,
phase: 'normal',
expiresAt: DateTime(2027, 3, 15),
);
}
List<Override> _overrides() => [
licenseProvider.overrideWith(() => _FakeLicenseActive()),
isReadonlyProvider.overrideWithValue(false),
];
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
SharedPreferences.setMockInitialValues({});
appClock = () => DateTime(2026, 7, 13, 9, 30, 15);
shellGoldenAcrossThemes(
'license 授权信息 tab 整框(桌面)',
path: '/license',
screen: (_) => const LicenseScreen(),
goldenPrefix: 'license',
overrides: _overrides,
logical: const Size(1280, 900),
);
}