Files
ReelShort/test/theme/glass_panel_test.dart

44 lines
1.3 KiB
Dart

// Author: fruit.com.cn
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fruitshorts/core/theme/app_colors.dart';
import 'package:fruitshorts/core/widgets/glass_panel.dart';
void main() {
testWidgets('should_blur_and_paint_a_bordered_glass_surface', (tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: Center(
child: GlassPanel(
radius: 26,
padding: EdgeInsets.all(16),
child: Text('glass'),
),
),
),
),
);
final filter = tester.widget<BackdropFilter>(find.byType(BackdropFilter));
expect(filter.filter, isNotNull);
expect(find.text('glass'), findsOneWidget);
final clip = tester.widget<ClipRRect>(find.byType(ClipRRect).first);
expect(clip.borderRadius, BorderRadius.circular(26));
final decorated = tester.widget<DecoratedBox>(
find
.descendant(
of: find.byType(GlassPanel),
matching: find.byType(DecoratedBox),
)
.first,
);
final decoration = decorated.decoration as BoxDecoration;
expect(decoration.gradient, isA<LinearGradient>());
expect(decoration.border!.top.color, AppColors.glassBorder);
});
}