Make sure that a TabPageSelector doesn't crash in 0x0 environment#178156
Make sure that a TabPageSelector doesn't crash in 0x0 environment#178156auto-submit[bot] merged 4 commits intoflutter:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a regression test for an issue where TabPageSelector crashes when it has a zero size. The added test case is a good start, but it doesn't fully cover the scenario described in the issue, as it doesn't trigger a tab change. I've left a suggestion to improve the test to properly reproduce the crash condition. Additionally, the pull request seems to be missing the actual fix for the crash in TabPageSelector. Please ensure the fix is included before merging.
| testWidgets('TabPageSelector does not crash at zero area', (WidgetTester tester) async { | ||
| await tester.pumpWidget( | ||
| const MaterialApp( | ||
| home: Center( | ||
| child: SizedBox.shrink(child: DefaultTabController(length: 2, child: TabPageSelector())), | ||
| ), | ||
| ), | ||
| ); | ||
| expect(tester.getSize(find.byType(TabPageSelector)), Size.zero); | ||
| }); |
There was a problem hiding this comment.
This test case is intended to verify that TabPageSelector doesn't crash when it has a zero size, which is great. However, the current implementation only checks the initial build state. The crash described in the associated issue occurs when changing tabs while the widget has zero area, because the TabController's animation might not run correctly.
To properly test for the regression, the test should also trigger a tab change to ensure the crash condition is covered.
testWidgets('TabPageSelector does not crash at zero area when changing tabs', (WidgetTester tester) async {
final TabController controller = TabController(length: 2, vsync: tester);
addTearDown(controller.dispose);
await tester.pumpWidget(
MaterialApp(
home: Center(
child: SizedBox.shrink(
child: TabPageSelector(controller: controller),
),
),
),
);
expect(tester.getSize(find.byType(TabPageSelector)), Size.zero);
// Change the tab index to trigger the animation that could cause a crash.
controller.animateTo(1);
await tester.pump(); // Start animation.
// The test passes if it doesn't crash here.
await tester.pumpAndSettle();
});cf8699a to
0ceb283
Compare
Added tear down for tester view reset after test.
victorsanni
left a comment
There was a problem hiding this comment.
Hi, can you resolve the merge conflicts?
flutter/flutter@cb7b7df...de4be4f 2025-11-19 [email protected] Roll Skia from 2054d87c6a85 to b5dc8c3494ac (1 revision) (flutter/flutter#178793) 2025-11-19 [email protected] Roll Skia from a30b02d57637 to 2054d87c6a85 (2 revisions) (flutter/flutter#178787) 2025-11-19 [email protected] Roll Skia from 547e3e5441b4 to a30b02d57637 (3 revisions) (flutter/flutter#178782) 2025-11-19 [email protected] Fix train hopping animation status listeners (flutter/flutter#178372) 2025-11-19 [email protected] Make sure that a ReorderableListView doesn't crash in 0x0 environment (flutter/flutter#177646) 2025-11-19 [email protected] Roll Skia from 9ce01a452f63 to 547e3e5441b4 (1 revision) (flutter/flutter#178775) 2025-11-19 [email protected] Roll Dart SDK from 1ed6b56bb323 to f7e9bd245fd9 (1 revision) (flutter/flutter#178774) 2025-11-19 [email protected] Roll Skia from f3ddc700abc7 to 9ce01a452f63 (8 revisions) (flutter/flutter#178769) 2025-11-19 [email protected] Make sure that a TabPageSelector doesn't crash in 0x0 environment (flutter/flutter#178156) 2025-11-19 [email protected] Small cleanup in `DeferredComponentManager.java` (flutter/flutter#178585) 2025-11-19 [email protected] Roll Dart SDK from a33149cb6643 to 1ed6b56bb323 (1 revision) (flutter/flutter#178763) 2025-11-18 [email protected] Roll Skia from 8557300f84c2 to f3ddc700abc7 (5 revisions) (flutter/flutter#178751) 2025-11-18 [email protected] Remove unnecessary `String.valueOf` in `TextInputChannel.java` (flutter/flutter#178592) 2025-11-18 [email protected] [tool] Further cleanup of proxy logic (flutter/flutter#178683) 2025-11-18 [email protected] Restore OpenGL state modified by fl_compositor_opengl_present_layers (flutter/flutter#178697) 2025-11-18 [email protected] Replace `equals("")` with `isEmpty` in `SpellCheckPlugin.java` (flutter/flutter#178596) 2025-11-18 [email protected] Roll Dart SDK from 312845b06afc to a33149cb6643 (2 revisions) (flutter/flutter#178738) 2025-11-18 [email protected] Roll Skia from ca906091e199 to 8557300f84c2 (2 revisions) (flutter/flutter#178739) 2025-11-18 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Add framework-side hitTestBehavior support for Semantics widget and apply to ModalRoute (#177570)" (flutter/flutter#178744) 2025-11-18 [email protected] Roll Packages from ce44ebb to 34746bb (6 revisions) (flutter/flutter#178734) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…utter#178156) This is my attempt to handle flutter#6537 for the TabPageSelector widget.
…utter#178156) This is my attempt to handle flutter#6537 for the TabPageSelector widget.
…utter#178156) This is my attempt to handle flutter#6537 for the TabPageSelector widget.
…utter#178156) This is my attempt to handle flutter#6537 for the TabPageSelector widget.
This is my attempt to handle #6537 for the TabPageSelector widget.