Skip to content

Commit

Permalink
Added tap testing to exercise more code.
Browse files Browse the repository at this point in the history
  • Loading branch information
awhitford committed Oct 24, 2020
1 parent 5b78fa0 commit 63707f0
Showing 1 changed file with 76 additions and 1 deletion.
77 changes: 76 additions & 1 deletion test/smoke_test.dart
Original file line number Diff line number Diff line change
@@ -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());

Expand All @@ -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 = <Widget>[
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();
});
}

0 comments on commit 63707f0

Please sign in to comment.