forked from eatvio/eatvio_app
chore(version): update app version to 1.3.5+85 and improve test coverage reporting in CI
This commit is contained in:
204
test/core/theme/app_decoration_test.dart
Normal file
204
test/core/theme/app_decoration_test.dart
Normal file
@@ -0,0 +1,204 @@
|
||||
import 'package:eatvio_app/core/theme/app_decoration.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
group('AppDecoration', () {
|
||||
testWidgets('fillOnPrimary returns correct BoxDecoration', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final decoration = AppDecoration.fillOnPrimary;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.color, isNotNull);
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('outlineBlueA returns correct BoxDecoration with border', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final decoration = AppDecoration.outlineBlueA;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.border, isNotNull);
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('outlinePrimary returns correct BoxDecoration with border', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final decoration = AppDecoration.outlinePrimary;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.border, isNotNull);
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
test('fillDeepOrange returns correct BoxDecoration', () {
|
||||
final decoration = AppDecoration.fillDeepOrange;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.color, isNotNull);
|
||||
});
|
||||
|
||||
test('fillGray returns correct BoxDecoration', () {
|
||||
final decoration = AppDecoration.fillGray;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.color, isNotNull);
|
||||
});
|
||||
|
||||
test('fillGray100 returns correct BoxDecoration', () {
|
||||
final decoration = AppDecoration.fillGray100;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.color, isNotNull);
|
||||
});
|
||||
|
||||
test('fillGray60002 returns correct BoxDecoration', () {
|
||||
final decoration = AppDecoration.fillGray60002;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.color, isNotNull);
|
||||
});
|
||||
|
||||
test('fillGreenA returns correct BoxDecoration', () {
|
||||
final decoration = AppDecoration.fillGreenA;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.color, isNotNull);
|
||||
});
|
||||
|
||||
testWidgets('fillPrimary returns correct BoxDecoration', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final decoration = AppDecoration.fillPrimary;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.color, isNotNull);
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
test('fillWhiteA returns correct BoxDecoration', () {
|
||||
final decoration = AppDecoration.fillWhiteA;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.color, isNotNull);
|
||||
});
|
||||
|
||||
test('outlineBlueGray returns correct BoxDecoration with border', () {
|
||||
final decoration = AppDecoration.outlineBlueGray;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.border, isNotNull);
|
||||
});
|
||||
});
|
||||
|
||||
group('BorderRadiusStyle', () {
|
||||
test('circleBorder8 returns correct BorderRadius', () {
|
||||
final borderRadius = BorderRadiusStyle.circleBorder8;
|
||||
expect(borderRadius, isA<BorderRadius>());
|
||||
});
|
||||
|
||||
test('roundedBorder1 returns correct BorderRadius', () {
|
||||
final borderRadius = BorderRadiusStyle.roundedBorder1;
|
||||
expect(borderRadius, isA<BorderRadius>());
|
||||
});
|
||||
|
||||
test('outlineBlack returns correct BoxDecoration', () {
|
||||
final decoration = BorderRadiusStyle.outlineBlack;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.boxShadow, isNotNull);
|
||||
});
|
||||
|
||||
test('outlineBlueGray returns correct BoxDecoration with border', () {
|
||||
final decoration = BorderRadiusStyle.outlineBlueGray;
|
||||
expect(decoration, isA<BoxDecoration>());
|
||||
expect(decoration.border, isNotNull);
|
||||
});
|
||||
|
||||
test('circleBorder17 returns correct BorderRadius', () {
|
||||
final borderRadius = BorderRadiusStyle.circleBorder17;
|
||||
expect(borderRadius, isA<BorderRadius>());
|
||||
});
|
||||
|
||||
test('circleBorder20 returns correct BorderRadius', () {
|
||||
final borderRadius = BorderRadiusStyle.circleBorder20;
|
||||
expect(borderRadius, isA<BorderRadius>());
|
||||
});
|
||||
|
||||
test('circleBorder62 returns correct BorderRadius', () {
|
||||
final borderRadius = BorderRadiusStyle.circleBorder62;
|
||||
expect(borderRadius, isA<BorderRadius>());
|
||||
});
|
||||
|
||||
test('customBorderBL8 returns correct BorderRadius', () {
|
||||
final borderRadius = BorderRadiusStyle.customBorderBL8;
|
||||
expect(borderRadius, isA<BorderRadius>());
|
||||
});
|
||||
|
||||
test('customBorderTL5 returns correct BorderRadius', () {
|
||||
final borderRadius = BorderRadiusStyle.customBorderTL5;
|
||||
expect(borderRadius, isA<BorderRadius>());
|
||||
});
|
||||
|
||||
test('customBorderTL51 returns correct BorderRadius', () {
|
||||
final borderRadius = BorderRadiusStyle.customBorderTL51;
|
||||
expect(borderRadius, isA<BorderRadius>());
|
||||
});
|
||||
|
||||
test('roundedBorder12 returns correct BorderRadius', () {
|
||||
final borderRadius = BorderRadiusStyle.roundedBorder12;
|
||||
expect(borderRadius, isA<BorderRadius>());
|
||||
});
|
||||
|
||||
test('roundedBorder5 returns correct BorderRadius', () {
|
||||
final borderRadius = BorderRadiusStyle.roundedBorder5;
|
||||
expect(borderRadius, isA<BorderRadius>());
|
||||
});
|
||||
|
||||
test('roundedBorder8 returns correct BorderRadius', () {
|
||||
final borderRadius = BorderRadiusStyle.roundedBorder8;
|
||||
expect(borderRadius, isA<BorderRadius>());
|
||||
});
|
||||
});
|
||||
|
||||
group('Stroke align constants', () {
|
||||
test('strokeAlignInside returns correct value', () {
|
||||
expect(strokeAlignInside, BorderSide.strokeAlignInside);
|
||||
});
|
||||
|
||||
test('strokeAlignCenter returns correct value', () {
|
||||
expect(strokeAlignCenter, BorderSide.strokeAlignCenter);
|
||||
});
|
||||
|
||||
test('strokeAlignOutside returns correct value', () {
|
||||
expect(strokeAlignOutside, BorderSide.strokeAlignOutside);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
561
test/core/theme/custom_text_style_test.dart
Normal file
561
test/core/theme/custom_text_style_test.dart
Normal file
@@ -0,0 +1,561 @@
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
group('CustomTextStyles', () {
|
||||
testWidgets('headlineSmallMulish returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.headlineSmallMulish;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleMediumSegoeUI returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleMediumSegoeUI;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
test('bodyMediumBlack900 returns TextStyle', () {
|
||||
expect(CustomTextStyles.bodyMediumBlack900, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('bodyMediumBlack90013 returns TextStyle', () {
|
||||
expect(CustomTextStyles.bodyMediumBlack90013, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('bodyMediumBluegray800 returns TextStyle', () {
|
||||
expect(CustomTextStyles.bodyMediumBluegray800, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('bodyMediumBluegray800_1 returns TextStyle', () {
|
||||
expect(CustomTextStyles.bodyMediumBluegray800_1, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('bodyMediumBluegray800_2 returns TextStyle', () {
|
||||
expect(CustomTextStyles.bodyMediumBluegray800_2, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('bodyMediumWhiteA700 returns TextStyle', () {
|
||||
expect(CustomTextStyles.bodyMediumWhiteA700, isA<TextStyle>());
|
||||
});
|
||||
|
||||
testWidgets('bodySmallMulishBlack900 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.bodySmallMulishBlack900;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('bodySmallMulishBluegray800 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.bodySmallMulishBluegray800;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('bodySmallMulishBluegray80012 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.bodySmallMulishBluegray80012;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('bodySmallMulishBluegray80012_1 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.bodySmallMulishBluegray80012_1;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('bodySmallMulishBluegray900 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.bodySmallMulishBluegray900;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('bodySmallMulishGray600 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.bodySmallMulishGray600;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('bodySmallMulishPrimary returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.bodySmallMulishPrimary;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('bodySmallSegoeUIBlack900 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.bodySmallSegoeUIBlack900;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('labelLargeGray60003 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.labelLargeGray60003;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('labelLargeWhiteA700 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.labelLargeWhiteA700;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleMedium16 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleMedium16;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
});
|
||||
|
||||
group('TextStyles', () {
|
||||
test('textMMedium returns TextStyle', () {
|
||||
expect(TextStyles.textMMedium, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('textSMedium returns TextStyle', () {
|
||||
expect(TextStyles.textSMedium, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('headingXLSemibold returns TextStyle', () {
|
||||
expect(TextStyles.headingXLSemibold, isA<TextStyle>());
|
||||
});
|
||||
});
|
||||
|
||||
group('TextStyles', () {
|
||||
test('headingFS40FW600 returns TextStyle', () {
|
||||
expect(TextStyles.headingFS40FW600, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('textLSemibold returns TextStyle', () {
|
||||
expect(TextStyles.textLSemibold, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('textLMedium returns TextStyle', () {
|
||||
expect(TextStyles.textLMedium, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('textMSemibold returns TextStyle', () {
|
||||
expect(TextStyles.textMSemibold, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('textMMediumAuto returns TextStyle', () {
|
||||
expect(TextStyles.textMMediumAuto, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('textSSemibold returns TextStyle', () {
|
||||
expect(TextStyles.textSSemibold, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('textFS13FW400 returns TextStyle', () {
|
||||
expect(TextStyles.textFS13FW400, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('textXSSemibold returns TextStyle', () {
|
||||
expect(TextStyles.textXSSemibold, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('textFS10FW500 returns TextStyle', () {
|
||||
expect(TextStyles.textFS10FW500, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('textFS24FW700 returns TextStyle', () {
|
||||
expect(TextStyles.textFS24FW700, isA<TextStyle>());
|
||||
});
|
||||
|
||||
test('textFS22FW600 returns TextStyle', () {
|
||||
expect(TextStyles.textFS22FW600, isA<TextStyle>());
|
||||
});
|
||||
});
|
||||
|
||||
group('CustomTextStyles additional styles', () {
|
||||
testWidgets('titleMediumBlack returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleMediumBlack;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleMediumBlack900 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleMediumBlack900;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleMediumSemiBold returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleMediumSemiBold;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleMediumWhiteA700 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleMediumWhiteA700;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleSmallBlue800 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleSmallBlue800;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleSmallBluegray800 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleSmallBluegray800;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleSmallBluegray800Bold returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleSmallBluegray800Bold;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleSmallBluegray800ExtraBold returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleSmallBluegray800ExtraBold;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleSmallBold returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleSmallBold;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleSmallGreenA70001 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleSmallGreenA70001;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleSmallGreenA70001ExtraBold returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleSmallGreenA70001ExtraBold;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleSmallLightgreen300 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleSmallLightgreen300;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleSmallRed200 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleSmallRed200;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleSmallSecondaryContainer returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleSmallSecondaryContainer;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleSmallSecondaryContainer_1 returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleSmallSecondaryContainer_1;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('titleSmallSegoeUIOnPrimary returns TextStyle', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final style = CustomTextStyles.titleSmallSegoeUIOnPrimary;
|
||||
expect(style, isA<TextStyle>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
207
test/core/theme/theme_helper_test.dart
Normal file
207
test/core/theme/theme_helper_test.dart
Normal file
@@ -0,0 +1,207 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ThemeHelper', () {
|
||||
late ThemeHelper themeHelper;
|
||||
|
||||
setUp(() {
|
||||
themeHelper = ThemeHelper();
|
||||
});
|
||||
|
||||
test('themeColor returns PrimaryColors', () {
|
||||
final colors = themeHelper.themeColor();
|
||||
|
||||
expect(colors, isA<PrimaryColors>());
|
||||
});
|
||||
|
||||
testWidgets('themeData returns ThemeData', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: themeHelper.themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final themeData = themeHelper.themeData();
|
||||
expect(themeData, isA<ThemeData>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('themeData has correct colorScheme', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: themeHelper.themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final themeData = themeHelper.themeData();
|
||||
expect(themeData.colorScheme, isA<ColorScheme>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('themeData has scaffoldBackgroundColor', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: themeHelper.themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final themeData = themeHelper.themeData();
|
||||
expect(themeData.scaffoldBackgroundColor, isA<Color>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('themeData has appBarTheme', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: themeHelper.themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final themeData = themeHelper.themeData();
|
||||
expect(themeData.appBarTheme, isA<AppBarThemeData>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('themeData has outlinedButtonTheme', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: themeHelper.themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final themeData = themeHelper.themeData();
|
||||
expect(themeData.outlinedButtonTheme, isA<OutlinedButtonThemeData>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
});
|
||||
|
||||
group('PrimaryColors', () {
|
||||
test('has all color getters', () {
|
||||
final colors = PrimaryColors();
|
||||
|
||||
expect(colors.blue400, isA<Color>());
|
||||
expect(colors.blueA400, isA<Color>());
|
||||
expect(colors.blueGray400, isA<Color>());
|
||||
expect(colors.black900, isA<Color>());
|
||||
expect(colors.blue800, isA<Color>());
|
||||
expect(colors.blueGray300, isA<Color>());
|
||||
expect(colors.black, isA<Color>());
|
||||
expect(colors.blueGray900, isA<Color>());
|
||||
expect(colors.deepOrange900, isA<Color>());
|
||||
expect(colors.gray100, isA<Color>());
|
||||
expect(colors.gray200, isA<Color>());
|
||||
expect(colors.gray400, isA<Color>());
|
||||
expect(colors.gray40001, isA<Color>());
|
||||
expect(colors.gray50, isA<Color>());
|
||||
expect(colors.gray500, isA<Color>());
|
||||
expect(colors.gray600, isA<Color>());
|
||||
expect(colors.gray60001, isA<Color>());
|
||||
expect(colors.gray60002, isA<Color>());
|
||||
expect(colors.gray60003, isA<Color>());
|
||||
expect(colors.gray60005, isA<Color>());
|
||||
expect(colors.greenA700, isA<Color>());
|
||||
expect(colors.greenA70001, isA<Color>());
|
||||
expect(colors.green, isA<Color>());
|
||||
expect(colors.darkGreen, isA<Color>());
|
||||
expect(colors.transparentGreen, isA<Color>());
|
||||
expect(colors.lightGreen300, isA<Color>());
|
||||
expect(colors.lightGreenA700, isA<Color>());
|
||||
expect(colors.red200, isA<Color>());
|
||||
expect(colors.teal100, isA<Color>());
|
||||
expect(colors.teal900, isA<Color>());
|
||||
expect(colors.whiteA700, isA<Color>());
|
||||
expect(colors.backgroundAvatar, isA<Color>());
|
||||
expect(colors.cardBackground, isA<Color>());
|
||||
expect(colors.dividerColor, isA<Color>());
|
||||
expect(colors.gray, isA<Color>());
|
||||
expect(colors.lightGray600, isA<Color>());
|
||||
expect(colors.lightGray, isA<Color>());
|
||||
expect(colors.transparentBlue, isA<Color>());
|
||||
expect(colors.lightGray0, isA<Color>());
|
||||
expect(colors.darkGrey, isA<Color>());
|
||||
expect(colors.lightGray00, isA<Color>());
|
||||
expect(colors.dottedBorder, isA<Color>());
|
||||
expect(colors.red, isA<Color>());
|
||||
expect(colors.strongRed, isA<Color>());
|
||||
expect(colors.lightRed, isA<Color>());
|
||||
expect(colors.transparentRed, isA<Color>());
|
||||
expect(colors.transparentBlack, isA<Color>());
|
||||
expect(colors.gray60004, isA<Color>());
|
||||
expect(colors.blueGray, isA<Color>());
|
||||
expect(colors.dialogShadow, isA<Color>());
|
||||
expect(colors.darkGray, isA<Color>());
|
||||
expect(colors.commentBg, isA<Color>());
|
||||
expect(colors.cardNotificationsBG, isA<Color>());
|
||||
expect(colors.grey7B, isA<Color>());
|
||||
expect(colors.greyD9, isA<Color>());
|
||||
});
|
||||
});
|
||||
|
||||
group('ColorSchemes', () {
|
||||
test('primaryColorScheme is defined', () {
|
||||
expect(ColorSchemes.primaryColorScheme, isA<ColorScheme>());
|
||||
});
|
||||
|
||||
test('primaryColorScheme has primary color', () {
|
||||
final colorScheme = ColorSchemes.primaryColorScheme;
|
||||
|
||||
expect(colorScheme.primary, isA<Color>());
|
||||
});
|
||||
|
||||
test('primaryColorScheme has onPrimary color', () {
|
||||
final colorScheme = ColorSchemes.primaryColorScheme;
|
||||
|
||||
expect(colorScheme.onPrimary, isA<Color>());
|
||||
});
|
||||
|
||||
test('primaryColorScheme has onPrimaryContainer color', () {
|
||||
final colorScheme = ColorSchemes.primaryColorScheme;
|
||||
|
||||
expect(colorScheme.onPrimaryContainer, isA<Color>());
|
||||
});
|
||||
});
|
||||
|
||||
group('Global theme getters', () {
|
||||
test('appTheme returns PrimaryColors', () {
|
||||
expect(appTheme, isA<PrimaryColors>());
|
||||
});
|
||||
|
||||
testWidgets('theme returns ThemeData', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final themeData = theme;
|
||||
expect(themeData, isA<ThemeData>());
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user