diff --git a/test/pages/new_private_chat/widget/contact_status_widget_test.dart b/test/pages/new_private_chat/widget/contact_status_widget_test.dart new file mode 100644 index 0000000000..df5ef4b85b --- /dev/null +++ b/test/pages/new_private_chat/widget/contact_status_widget_test.dart @@ -0,0 +1,47 @@ +import 'package:fluffychat/pages/new_private_chat/widget/contact_status_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:flutter_gen/gen_l10n/l10n.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:fluffychat/domain/model/contact/contact_status.dart'; +import 'package:linagora_design_flutter/colors/linagora_ref_colors.dart'; + +void main() { + group('ContactStatusWidget', () { + testWidgets('renders correctly for inactive status', + (WidgetTester tester) async { + await tester.pumpWidget( + MaterialApp( + localizationsDelegates: L10n.localizationsDelegates, + supportedLocales: L10n.supportedLocales, + home: Scaffold( + body: ContactStatusWidget(status: ContactStatus.inactive), + ), + ), + ); + + expect(find.byType(SvgPicture), findsOneWidget); + + expect(find.byType(Text), findsOneWidget); + + final svgPicture = tester.widget(find.byType(SvgPicture)); + expect( + svgPicture.colorFilter, + ColorFilter.mode( + LinagoraRefColors.material().neutral[60]!, + BlendMode.srcIn, + ), + ); + + final text = tester.widget(find.byType(Text)); + expect(text.style?.color, LinagoraRefColors.material().neutral[60]); + expect( + text.style?.fontSize, + Theme.of(tester.element(find.byType(ContactStatusWidget))) + .textTheme + .bodySmall + ?.fontSize, + ); + }); + }); +}