From 63707f005d25c86e00f6758b57a17f93bd109686 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Fri, 23 Oct 2020 18:57:15 -0700 Subject: [PATCH] Added tap testing to exercise more code. --- test/smoke_test.dart | 77 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/test/smoke_test.dart b/test/smoke_test.dart index aadcf14..fd4d9d6 100644 --- a/test/smoke_test.dart +++ b/test/smoke_test.dart @@ -1,9 +1,10 @@ +import 'package:animated_text_kit/animated_text_kit.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import '../example/lib/main.dart'; void main() { - testWidgets('Check button smoke test', (WidgetTester tester) async { + testWidgets('Animation smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); @@ -20,4 +21,78 @@ void main() { tester.verifyTickersWereDisposed(); }); + + testWidgets('Animation tap test', (WidgetTester tester) async { + const tripleText = [ + 'Alpha', + 'Beta', + 'Omega', + ]; + const textStyle = TextStyle(fontSize: 32.0, fontWeight: FontWeight.bold); + + final tapableWidgets = [ + ColorizeAnimatedTextKit( + text: tripleText, + textStyle: textStyle, + colors: const [ + Colors.red, + Colors.blue, + Colors.green, + ], + onTap: () { + print(' > ColorizeAnimatedTextKit was tapped'); + }, + ), + FadeAnimatedTextKit( + text: tripleText, + textStyle: textStyle, + displayFullTextOnTap: true, + onTap: () { + print(' > FadeAnimatedTextKit was tapped'); + }, + ), + RotateAnimatedTextKit( + text: tripleText, + textStyle: textStyle, + displayFullTextOnTap: true, + onTap: () { + print(' > RotateAnimatedTextKit was tapped'); + }, + ), + ScaleAnimatedTextKit( + text: tripleText, + textStyle: textStyle, + displayFullTextOnTap: true, + onTap: () { + print(' > ScaleAnimatedTextKit was tapped'); + }, + ), + TyperAnimatedTextKit( + text: tripleText, + textStyle: textStyle, + displayFullTextOnTap: true, + onTap: () { + print(' > TyperAnimatedTextKit was tapped'); + }, + ), + TypewriterAnimatedTextKit( + text: tripleText, + textStyle: textStyle, + displayFullTextOnTap: true, + onTap: () { + print(' > TypewriterAnimatedTextKit was tapped'); + }, + ), + ]; + + for (var widget in tapableWidgets) { + print('Testing ${widget.runtimeType}'); + + await tester.pumpWidget(MaterialApp(home: widget)); + await tester.tap(find.byWidget(widget)); + await tester.pumpAndSettle(); + } + + tester.verifyTickersWereDisposed(); + }); }