From 081b598f40286ffe6d260cbea13a1ecf89a13d40 Mon Sep 17 00:00:00 2001 From: Anthony <591699+clocksmith@users.noreply.github.com> Date: Wed, 16 Sep 2020 01:22:08 -0400 Subject: [PATCH] Update Navigation Rail test with regression comment and cleaner size checking (#65877) --- .../flutter/test/material/navigation_rail_test.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/flutter/test/material/navigation_rail_test.dart b/packages/flutter/test/material/navigation_rail_test.dart index 7b9971f649..d85dfb2341 100644 --- a/packages/flutter/test/material/navigation_rail_test.dart +++ b/packages/flutter/test/material/navigation_rail_test.dart @@ -1794,6 +1794,7 @@ void main() { 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 { bool extended = false; StateSetter stateSetter; @@ -1833,9 +1834,10 @@ void main() { ), ); - final RenderBox rail = tester.firstRenderObject(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(() { extended = true; @@ -1845,10 +1847,10 @@ void main() { // Create very close to 0, but non-zero, animation value. await tester.pump(const Duration(milliseconds: 1)); // 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 // 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 {