c5818b4e51
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
32 lines
1.1 KiB
Dart
32 lines
1.1 KiB
Dart
// client/test/theme/app_tokens_values_test.dart
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:jiu_client/core/theme/app_tokens.g.dart';
|
|
|
|
void main() {
|
|
test('A 经典蓝基准色正确', () {
|
|
expect(kTokensA.primary, const Color(0xFF2563AC));
|
|
expect(kTokensA.surface, const Color(0xFFFFFFFF));
|
|
expect(kTokensA.warn, const Color(0xFFE08E00));
|
|
expect(kTokensA.isDark, false);
|
|
});
|
|
test('B 琥珀为深色且主色为琥珀金', () {
|
|
expect(kTokensB.primary, const Color(0xFFF5A300));
|
|
expect(kTokensB.isDark, true);
|
|
// top-mark-bg 是 linear-gradient → 取首个 hex
|
|
expect(kTokensB.topMarkBg, const Color(0xFFF5A300));
|
|
});
|
|
test('C 酒窖暖浅主色为酒红', () {
|
|
expect(kTokensC.primary, const Color(0xFF7C1F2C));
|
|
expect(kTokensC.isDark, false);
|
|
});
|
|
test('shadow rgba 带 alpha 正确解析', () {
|
|
// a: rgba(20,40,70,.20) → 0x33142846
|
|
expect(kTokensA.shadow, const Color(0x33142846));
|
|
});
|
|
test('appTokensOf 回退到 A', () {
|
|
expect(appTokensOf('x'), kTokensA);
|
|
expect(appTokensOf('b'), kTokensB);
|
|
});
|
|
}
|