Skip to content

Commit

Permalink
Merge pull request #137 from awhitford/taptest
Browse files Browse the repository at this point in the history
Added tap testing to exercise more code.
  • Loading branch information
aagarwal1012 authored Oct 24, 2020
2 parents cd51dbf + 63707f0 commit af36e40
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,10 +1,11 @@
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
// ignore: avoid_relative_lib_imports
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 @@ -21,4 +22,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 af36e40

Please sign in to comment.