Unverified Commit 081b598f authored by Anthony's avatar Anthony Committed by GitHub

Update Navigation Rail test with regression comment and cleaner size checking (#65877)

parent 13fcedc7
...@@ -1794,6 +1794,7 @@ void main() { ...@@ -1794,6 +1794,7 @@ void main() {
expect(rail.size.width, equals(300.0)); expect(rail.size.width, equals(300.0));
}); });
/// Regression test for https://github.com/flutter/flutter/issues/65657
testWidgets('Extended rail transition does not jump from the beginning', (WidgetTester tester) async { testWidgets('Extended rail transition does not jump from the beginning', (WidgetTester tester) async {
bool extended = false; bool extended = false;
StateSetter stateSetter; StateSetter stateSetter;
...@@ -1833,9 +1834,10 @@ void main() { ...@@ -1833,9 +1834,10 @@ void main() {
), ),
); );
final RenderBox rail = tester.firstRenderObject<RenderBox>(find.byType(NavigationRail)); final Finder rail = find.byType(NavigationRail);
expect(rail.size.width, equals(72.0)); // Before starting the animation, the rail has a width of 72.
expect(tester.getSize(rail).width, 72.0);
stateSetter(() { stateSetter(() {
extended = true; extended = true;
...@@ -1845,10 +1847,10 @@ void main() { ...@@ -1845,10 +1847,10 @@ void main() {
// Create very close to 0, but non-zero, animation value. // Create very close to 0, but non-zero, animation value.
await tester.pump(const Duration(milliseconds: 1)); await tester.pump(const Duration(milliseconds: 1));
// Expect that it has started to extend. // Expect that it has started to extend.
expect(rail.size.width, greaterThan(72.0)); expect(tester.getSize(rail).width, greaterThan(72.0));
// Expect that it has only extended by a small amount, or that the first // Expect that it has only extended by a small amount, or that the first
// frame does not jump. This helps verify that it is a smooth animation. // frame does not jump. This helps verify that it is a smooth animation.
expect(rail.size.width, closeTo(72.0, 1.0)); expect(tester.getSize(rail).width, closeTo(72.0, 1.0));
}); });
testWidgets('Extended rail animation can be consumed', (WidgetTester tester) async { testWidgets('Extended rail animation can be consumed', (WidgetTester tester) async {
......
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