Unverified Commit f61074c2 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Fix Cuptertino dialog test to check correct fade transition (#87533)

parent 0151359c
...@@ -1039,53 +1039,54 @@ void main() { ...@@ -1039,53 +1039,54 @@ void main() {
// Enter animation. // Enter animation.
await tester.pump(); await tester.pump();
FadeTransition transition = tester.firstWidget(find.byType(FadeTransition)); final Finder fadeTransitionFinder = find.ancestor(of: find.byType(CupertinoAlertDialog), matching: find.byType(FadeTransition));
FadeTransition transition = tester.firstWidget(fadeTransitionFinder);
await tester.pump(const Duration(milliseconds: 25)); await tester.pump(const Duration(milliseconds: 50));
transition = tester.firstWidget(find.byType(FadeTransition)); transition = tester.firstWidget(fadeTransitionFinder);
expect(transition.opacity.value, moreOrLessEquals(0.40, epsilon: 0.001)); expect(transition.opacity.value, moreOrLessEquals(0.081, epsilon: 0.001));
await tester.pump(const Duration(milliseconds: 25)); await tester.pump(const Duration(milliseconds: 50));
transition = tester.firstWidget(find.byType(FadeTransition)); transition = tester.firstWidget(fadeTransitionFinder);
expect(transition.opacity.value, moreOrLessEquals(0.437, epsilon: 0.001)); expect(transition.opacity.value, moreOrLessEquals(0.332, epsilon: 0.001));
await tester.pump(const Duration(milliseconds: 25)); await tester.pump(const Duration(milliseconds: 50));
transition = tester.firstWidget(find.byType(FadeTransition)); transition = tester.firstWidget(fadeTransitionFinder);
expect(transition.opacity.value, moreOrLessEquals(0.55, epsilon: 0.001)); expect(transition.opacity.value, moreOrLessEquals(0.667, epsilon: 0.001));
await tester.pump(const Duration(milliseconds: 25)); await tester.pump(const Duration(milliseconds: 50));
transition = tester.firstWidget(find.byType(FadeTransition)); transition = tester.firstWidget(fadeTransitionFinder);
expect(transition.opacity.value, moreOrLessEquals(0.737, epsilon: 0.001)); expect(transition.opacity.value, moreOrLessEquals(0.918, epsilon: 0.001));
await tester.pump(const Duration(milliseconds: 25)); await tester.pump(const Duration(milliseconds: 50));
transition = tester.firstWidget(find.byType(FadeTransition)); transition = tester.firstWidget(fadeTransitionFinder);
expect(transition.opacity.value, moreOrLessEquals(1.0, epsilon: 0.001)); expect(transition.opacity.value, moreOrLessEquals(1.0, epsilon: 0.001));
await tester.tap(find.text('Delete')); await tester.tap(find.text('Delete'));
// Exit animation, look at reverse FadeTransition. // Exit animation, look at reverse FadeTransition.
await tester.pump(const Duration(milliseconds: 25)); await tester.pump(const Duration(milliseconds: 50));
transition = tester.widgetList(find.byType(FadeTransition)).elementAt(1) as FadeTransition; transition = tester.firstWidget(fadeTransitionFinder);
expect(transition.opacity.value, moreOrLessEquals(0.500, epsilon: 0.001)); expect(transition.opacity.value, moreOrLessEquals(1.0, epsilon: 0.001));
await tester.pump(const Duration(milliseconds: 25)); await tester.pump(const Duration(milliseconds: 50));
transition = tester.widgetList(find.byType(FadeTransition)).elementAt(1) as FadeTransition; transition = tester.firstWidget(fadeTransitionFinder);
expect(transition.opacity.value, moreOrLessEquals(0.332, epsilon: 0.001)); expect(transition.opacity.value, moreOrLessEquals(0.918, epsilon: 0.001));
await tester.pump(const Duration(milliseconds: 25)); await tester.pump(const Duration(milliseconds: 50));
transition = tester.widgetList(find.byType(FadeTransition)).elementAt(1) as FadeTransition; transition = tester.firstWidget(fadeTransitionFinder);
expect(transition.opacity.value, moreOrLessEquals(0.188, epsilon: 0.001)); expect(transition.opacity.value, moreOrLessEquals(0.667, epsilon: 0.001));
await tester.pump(const Duration(milliseconds: 25)); await tester.pump(const Duration(milliseconds: 50));
transition = tester.widgetList(find.byType(FadeTransition)).elementAt(1) as FadeTransition; transition = tester.firstWidget(fadeTransitionFinder);
expect(transition.opacity.value, moreOrLessEquals(0.081, epsilon: 0.001)); expect(transition.opacity.value, moreOrLessEquals(0.332, epsilon: 0.001));
await tester.pump(const Duration(milliseconds: 25)); await tester.pump(const Duration(milliseconds: 50));
transition = tester.widgetList(find.byType(FadeTransition)).elementAt(1) as FadeTransition; transition = tester.firstWidget(fadeTransitionFinder);
expect(transition.opacity.value, moreOrLessEquals(0.019, epsilon: 0.001)); expect(transition.opacity.value, moreOrLessEquals(0.081, epsilon: 0.001));
await tester.pump(const Duration(milliseconds: 25)); await tester.pump(const Duration(milliseconds: 50));
transition = tester.widgetList(find.byType(FadeTransition)).elementAt(1) as FadeTransition; transition = tester.firstWidget(fadeTransitionFinder);
expect(transition.opacity.value, moreOrLessEquals(0.0, epsilon: 0.001)); expect(transition.opacity.value, moreOrLessEquals(0.0, epsilon: 0.001));
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment