mirror of
https://github.com/flutter/flutter
synced 2024-08-25 11:07:06 +00:00
Add test for animated_padding.0.dart API example. (#146718)
This PR contributes to https://github.com/flutter/flutter/issues/130459 ### Description - Adds `examples/api/test/widgets/implicit_animations/animated_padding.0_test.dart` test
This commit is contained in:
parent
3b21c27c08
commit
a4e9026589
|
@ -475,7 +475,6 @@ final Set<String> _knownMissingTests = <String>{
|
|||
'examples/api/test/widgets/implicit_animations/animated_fractionally_sized_box.0_test.dart',
|
||||
'examples/api/test/widgets/implicit_animations/animated_align.0_test.dart',
|
||||
'examples/api/test/widgets/implicit_animations/animated_positioned.0_test.dart',
|
||||
'examples/api/test/widgets/implicit_animations/animated_padding.0_test.dart',
|
||||
'examples/api/test/widgets/implicit_animations/sliver_animated_opacity.0_test.dart',
|
||||
'examples/api/test/widgets/scroll_view/custom_scroll_view.1_test.dart',
|
||||
'examples/api/test/widgets/inherited_notifier/inherited_notifier.0_test.dart',
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/widgets/implicit_animations/animated_padding.0.dart'
|
||||
as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'AnimatedPadding animates on ElevatedButton tap',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.AnimatedPaddingExampleApp(),
|
||||
);
|
||||
|
||||
Padding padding = tester.widget(
|
||||
find.descendant(
|
||||
of: find.byType(AnimatedPadding),
|
||||
matching: find.byType(Padding),
|
||||
),
|
||||
);
|
||||
expect(padding.padding, equals(EdgeInsets.zero));
|
||||
|
||||
await tester.tap(find.byType(ElevatedButton));
|
||||
await tester.pump();
|
||||
|
||||
padding = tester.widget(
|
||||
find.descendant(
|
||||
of: find.byType(AnimatedPadding),
|
||||
matching: find.byType(Padding),
|
||||
),
|
||||
);
|
||||
expect(padding.padding, equals(EdgeInsets.zero));
|
||||
|
||||
// Advance animation to the end by the 2-second duration specified in
|
||||
// the example app.
|
||||
await tester.pump(const Duration(seconds: 2));
|
||||
|
||||
padding = tester.widget(
|
||||
find.descendant(
|
||||
of: find.byType(AnimatedPadding),
|
||||
matching: find.byType(Padding),
|
||||
),
|
||||
);
|
||||
expect(padding.padding, equals(const EdgeInsets.all(100.0)));
|
||||
},
|
||||
);
|
||||
}
|
Loading…
Reference in a new issue