From d5bedba5fe3271fbc002da06e94f42a7f2b45157 Mon Sep 17 00:00:00 2001 From: Shouichi Kamiya Date: Fri, 5 Mar 2021 14:07:29 +0900 Subject: [PATCH] Add a simple golden test for BarCodeImage --- .gitignore | 3 + example/pubspec.lock | 108 +++++++++++------------------------ pubspec.yaml | 4 ++ test/barcode_image.png | Bin 0 -> 21051 bytes test/barcode_image_test.dart | 20 +++++++ 5 files changed, 60 insertions(+), 75 deletions(-) create mode 100644 test/barcode_image.png create mode 100644 test/barcode_image_test.dart diff --git a/.gitignore b/.gitignore index a6a4013..e3cdc24 100644 --- a/.gitignore +++ b/.gitignore @@ -32,5 +32,8 @@ android/key.properties !AppFrameworkInfo.plist ios/Flutter/ +# When golden tests fail, diff images go here. +/test/failures + example/ios/Flutter/flutter_export_environment.sh example/android/.idea/ diff --git a/example/pubspec.lock b/example/pubspec.lock index c9c9dcc..21a5306 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,27 +1,13 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.11" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.2" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.5.0-nullsafety.1" barcode_flutter: dependency: "direct main" description: @@ -35,35 +21,35 @@ packages: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" - charcode: + version: "2.1.0-nullsafety.1" + characters: dependency: transitive description: - name: charcode + name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" - collection: + version: "1.1.0-nullsafety.3" + charcode: dependency: transitive description: - name: collection + name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" - convert: + version: "1.2.0-nullsafety.1" + clock: dependency: transitive description: - name: convert + name: clock url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" - crypto: + version: "1.1.0-nullsafety.1" + collection: dependency: transitive description: - name: crypto + name: collection url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "1.15.0-nullsafety.3" cupertino_icons: dependency: "direct main" description: @@ -71,6 +57,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.2" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" flutter: dependency: "direct main" description: flutter @@ -81,55 +74,27 @@ packages: description: flutter source: sdk version: "0.0.0" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0+1" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" + version: "1.8.0-nullsafety.1" sky_engine: dependency: transitive description: flutter @@ -141,62 +106,55 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.0-nullsafety.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.2.19-nullsafety.2" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.5.0" + version: "2.1.0-nullsafety.3" sdks: - dart: ">=2.4.0 <3.0.0" + dart: ">=2.10.0-110 <2.11.0" diff --git a/pubspec.yaml b/pubspec.yaml index 9c34715..1e39207 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,5 +11,9 @@ dependencies: flutter: sdk: flutter +dev_dependencies: + flutter_test: + sdk: flutter + flutter: uses-material-design: true diff --git a/test/barcode_image.png b/test/barcode_image.png new file mode 100644 index 0000000000000000000000000000000000000000..aad485435257993ca32d63388396a24a919b5829 GIT binary patch literal 21051 zcmeHP-%C?r7=AaFZH7ORibyX;h*y=veo&C1V>J(yHQj{~%0e%yK|^+7g5|*=?4nid zreKs8-9@Gsrc%_Xi++GggiBmBygJB6h7rzsY>=lKIFsP*h(d(V4uemv)Sp7;B{ zecyNWM5DK;a9be}6)6p#CL%|GXuaKDpl8OWvo`(55^nOkX>hV)UO%vf-HP9?e|qd4 z{X|YuJoWwyvCOP5(&yS#_qJv^wfns4eSYnVEB58&vEZG1+0N0C#M9!;^4#K?AMowl!g?qF~B$;DuCbhI{fe7s~TvNaJJ zPpzguR8_~colD8)OVyKlZe^i1r7aFv^jjioNiTdV$wkK3XTNoaJWw0dbuun>49SqT zTeir!t}wTv5q=Q5Wi$JQ zifQ{u3xHH$B7guPKnQ{w*fyaCr~ztVF`x~>K)@bhkMvinVRJdXl5+vzTktI%0W@I* z4Pe?ZZKy$7BGmA^)u7Idv>S8N)cVy#c&4?2=cygFu1(E}SDOF4AuaF+Cd@++0)!x_ z0cs$E6~GE$1?&V+0|SBDfZBlCAYB1!fEu6%s6j^nR`4HM!Eo?pZmsC$?+>)0$NR;) z(JIT@#Kl0Fx!?h5K@ecVLIEK_2+DgkylL|tA=)@$>NK{cqo}#Ho6BMDIfJyo gADA!?L5N=^M6+-DMrlV+*LCAW%Hc-OpgYj_6a2(^*#H0l literal 0 HcmV?d00001 diff --git a/test/barcode_image_test.dart b/test/barcode_image_test.dart new file mode 100644 index 0000000..a48f3f2 --- /dev/null +++ b/test/barcode_image_test.dart @@ -0,0 +1,20 @@ +import 'package:barcode_flutter/barcode_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('BarCodeImage', () { + testWidgets('golden test', (WidgetTester tester) async { + await tester.pumpWidget( + BarCodeImage( + params: Code39BarCodeParams("1234ABCD", lineWidth: 3), + ), + ); + + await expectLater( + find.byType(BarCodeImage), + matchesGoldenFile('barcode_image.png'), + ); + }); + }); +}