Committed by
Nipodemos
update num and widget extensions tests
Showing
2 changed files
with
102 additions
and
0 deletions
| 1 | +import 'package:flutter_test/flutter_test.dart'; | ||
| 2 | +import 'package:get/utils.dart'; | ||
| 3 | + | ||
| 4 | +void main() { | ||
| 5 | + num x = 5; | ||
| 6 | + num y = 7; | ||
| 7 | + test('Test for var.isLowerThan(value)', () { | ||
| 8 | + expect(x.isLowerThan(y), true); | ||
| 9 | + expect(y.isLowerThan(x), false); | ||
| 10 | + }); | ||
| 11 | + test('Test for var.isGreaterThan(value)', () { | ||
| 12 | + expect(x.isGreaterThan(y), false); | ||
| 13 | + expect(y.isGreaterThan(x), true); | ||
| 14 | + }); | ||
| 15 | + test('Test for var.isGreaterThan(value)', () { | ||
| 16 | + expect(x.isEqual(y), false); | ||
| 17 | + expect(y.isEqual(x), false); | ||
| 18 | + expect(x.isEqual(5), true); | ||
| 19 | + expect(y.isEqual(7), true); | ||
| 20 | + }); | ||
| 21 | +} |
| 1 | +import 'package:flutter/widgets.dart'; | ||
| 2 | +import 'package:flutter_test/flutter_test.dart'; | ||
| 3 | +import 'package:get/utils.dart'; | ||
| 4 | + | ||
| 5 | +void main() { | ||
| 6 | + group('Group test for PaddingX Extension', () { | ||
| 7 | + testWidgets('Test of paddingAll', (WidgetTester tester) async { | ||
| 8 | + Widget containerTest; | ||
| 9 | + | ||
| 10 | + expect(find.byType(Padding), findsNothing); | ||
| 11 | + | ||
| 12 | + await tester.pumpWidget(containerTest.paddingAll(16)); | ||
| 13 | + | ||
| 14 | + expect(find.byType(Padding), findsOneWidget); | ||
| 15 | + }); | ||
| 16 | + | ||
| 17 | + testWidgets('Test of paddingOnly', (WidgetTester tester) async { | ||
| 18 | + Widget containerTest; | ||
| 19 | + | ||
| 20 | + expect(find.byType(Padding), findsNothing); | ||
| 21 | + | ||
| 22 | + await tester.pumpWidget(containerTest.paddingOnly(top: 16)); | ||
| 23 | + | ||
| 24 | + expect(find.byType(Padding), findsOneWidget); | ||
| 25 | + }); | ||
| 26 | + | ||
| 27 | + testWidgets('Test of paddingSymmetric', (WidgetTester tester) async { | ||
| 28 | + Widget containerTest; | ||
| 29 | + | ||
| 30 | + expect(find.byType(Padding), findsNothing); | ||
| 31 | + | ||
| 32 | + await tester.pumpWidget(containerTest.paddingSymmetric(vertical: 16)); | ||
| 33 | + | ||
| 34 | + expect(find.byType(Padding), findsOneWidget); | ||
| 35 | + }); | ||
| 36 | + | ||
| 37 | + testWidgets('Test of paddingZero', (WidgetTester tester) async { | ||
| 38 | + Widget containerTest; | ||
| 39 | + | ||
| 40 | + expect(find.byType(Padding), findsNothing); | ||
| 41 | + | ||
| 42 | + await tester.pumpWidget(containerTest.paddingZero); | ||
| 43 | + | ||
| 44 | + expect(find.byType(Padding), findsOneWidget); | ||
| 45 | + }); | ||
| 46 | + }); | ||
| 47 | + | ||
| 48 | + group('Group test for MarginX Extension', () { | ||
| 49 | + testWidgets('Test of marginAll', (WidgetTester tester) async { | ||
| 50 | + Widget containerTest; | ||
| 51 | + | ||
| 52 | + await tester.pumpWidget(containerTest.marginAll(16)); | ||
| 53 | + | ||
| 54 | + expect(find.byType(Container), findsOneWidget); | ||
| 55 | + }); | ||
| 56 | + | ||
| 57 | + testWidgets('Test of marginOnly', (WidgetTester tester) async { | ||
| 58 | + Widget containerTest; | ||
| 59 | + | ||
| 60 | + await tester.pumpWidget(containerTest.marginOnly(top: 16)); | ||
| 61 | + | ||
| 62 | + expect(find.byType(Container), findsOneWidget); | ||
| 63 | + }); | ||
| 64 | + | ||
| 65 | + testWidgets('Test of marginSymmetric', (WidgetTester tester) async { | ||
| 66 | + Widget containerTest; | ||
| 67 | + | ||
| 68 | + await tester.pumpWidget(containerTest.marginSymmetric(vertical: 16)); | ||
| 69 | + | ||
| 70 | + expect(find.byType(Container), findsOneWidget); | ||
| 71 | + }); | ||
| 72 | + | ||
| 73 | + testWidgets('Test of marginZero', (WidgetTester tester) async { | ||
| 74 | + Widget containerTest; | ||
| 75 | + | ||
| 76 | + await tester.pumpWidget(containerTest.marginZero); | ||
| 77 | + | ||
| 78 | + expect(find.byType(Container), findsOneWidget); | ||
| 79 | + }); | ||
| 80 | + }); | ||
| 81 | +} |
-
Please register or login to post a comment