yumi-flutter/test/sc_home_shell_gradient_text_test.dart

49 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:yumi/ui_kit/widgets/sc_home_shell_background.dart';
void main() {
test('gold text gradient matches the Figma colors and direction', () {
expect(scHomeShellGoldTextGradient.begin, Alignment.topCenter);
expect(scHomeShellGoldTextGradient.end, Alignment.bottomCenter);
expect(scHomeShellGoldTextGradient.colors, const [
Color(0xFFFCFBD9),
Color(0xFFDC9D3A),
]);
});
testWidgets('gradient text keeps the title shadow as a separate layer', (
tester,
) async {
await tester.pumpWidget(
const MaterialApp(
home: Center(
child: SCHomeShellGradientText(
'Task',
style: TextStyle(
fontSize: 28,
shadows: [
Shadow(
color: Color(0xB3000000),
offset: Offset(0, 1),
blurRadius: 1,
),
],
),
),
),
),
);
final gradientText = find.byType(SCHomeShellGradientText);
expect(
find.descendant(of: gradientText, matching: find.byType(ShaderMask)),
findsOneWidget,
);
expect(
find.descendant(of: gradientText, matching: find.byType(Text)),
findsNWidgets(2),
);
});
}