Skip to content

Add more 0x0 size tests part 4#185187

Merged
auto-submit[bot] merged 22 commits into
flutter:masterfrom
ahmedsameha1:add_more_0x0_size_tests_part_4
Jul 13, 2026
Merged

Add more 0x0 size tests part 4#185187
auto-submit[bot] merged 22 commits into
flutter:masterfrom
ahmedsameha1:add_more_0x0_size_tests_part_4

Conversation

@ahmedsameha1

Copy link
Copy Markdown
Contributor

This is my attempt to handle #6537 for the following widgets:
SafeArea
CustomScrollView
ListView
GridView
Scrollable
TwoDimensionalScrollable
SelectableRegion
SelectionContainer
SemanticsDebugger
SensitiveContent

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) f: scrolling Viewports, list views, slivers, etc. labels Apr 17, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces regression tests across several widget test files to ensure that layout and scrollable widgets, such as CustomScrollView, ListView, and SelectableRegion, do not crash when rendered with zero area. Feedback includes addressing a missing required focusNode in the SelectableRegion test to prevent compilation errors, using SizedBox.shrink in the SensitiveContent test for consistency and better resource management, and standardizing test descriptions to include "area" for naming consistency across the suite.

Comment on lines +876 to +890
testWidgets('SelectableRegion does not crash at zero area', (WidgetTester tester) async {
await tester.pumpWidget(
TestWidgetsApp(
home: Center(
child: SizedBox.shrink(
child: SelectableRegion(
selectionControls: materialTextSelectionControls,
child: const SelectionSpy(),
),
),
),
),
);
expect(tester.getSize(find.byType(SelectableRegion)), Size.zero);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The SelectableRegion widget requires a focusNode parameter which is missing in this test. This will cause a compilation error. Additionally, for proper resource management in tests, the FocusNode should be disposed using addTearDown.

Suggested change
testWidgets('SelectableRegion does not crash at zero area', (WidgetTester tester) async {
await tester.pumpWidget(
TestWidgetsApp(
home: Center(
child: SizedBox.shrink(
child: SelectableRegion(
selectionControls: materialTextSelectionControls,
child: const SelectionSpy(),
),
),
),
),
);
expect(tester.getSize(find.byType(SelectableRegion)), Size.zero);
});
testWidgets('SelectableRegion does not crash at zero area', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode();
addTearDown(focusNode.dispose);
await tester.pumpWidget(
TestWidgetsApp(
home: Center(
child: SizedBox.shrink(
child: SelectableRegion(
focusNode: focusNode,
selectionControls: materialTextSelectionControls,
child: const SelectionSpy(),
),
),
),
),
);
expect(tester.getSize(find.byType(SelectableRegion)), Size.zero);
});

Comment on lines +128 to +139
testWidgets('SensitiveContent does not crash at zero area', (WidgetTester tester) async {
tester.view.physicalSize = Size.zero;
addTearDown(tester.view.reset);
await tester.pumpWidget(
const TestWidgetsApp(
home: Center(
child: SensitiveContent(sensitivity: ContentSensitivity.sensitive, child: Placeholder()),
),
),
);
expect(tester.getSize(find.byType(SensitiveContent)), Size.zero);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the other tests added in this pull request, it is better to use SizedBox.shrink to constrain the widget to a zero area rather than modifying the global tester.view.physicalSize. This approach is more idiomatic for widget-level size testing and avoids the need for manual view reset.

Suggested change
testWidgets('SensitiveContent does not crash at zero area', (WidgetTester tester) async {
tester.view.physicalSize = Size.zero;
addTearDown(tester.view.reset);
await tester.pumpWidget(
const TestWidgetsApp(
home: Center(
child: SensitiveContent(sensitivity: ContentSensitivity.sensitive, child: Placeholder()),
),
),
);
expect(tester.getSize(find.byType(SensitiveContent)), Size.zero);
});
testWidgets('SensitiveContent does not crash at zero area', (WidgetTester tester) async {
await tester.pumpWidget(
const TestWidgetsApp(
home: Center(
child: SizedBox.shrink(
child: SensitiveContent(sensitivity: ContentSensitivity.sensitive, child: Placeholder()),
),
),
),
);
expect(tester.getSize(find.byType(SensitiveContent)), Size.zero);
});

expect(tester.binding.semanticsEnabled, isTrue);
}, semanticsEnabled: false);

testWidgets('SemanticsDebugger does not crash at zero', (WidgetTester tester) async {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the other test names in this PR (e.g., in custom_scroll_view_test.dart, list_view_test.dart, etc.), please update the test description to include 'area'.

Suggested change
testWidgets('SemanticsDebugger does not crash at zero', (WidgetTester tester) async {
testWidgets('SemanticsDebugger does not crash at zero area', (WidgetTester tester) async {

});
});

testWidgets('TwoDimensionalScrollable does not crash at zero', (WidgetTester tester) async {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the other test names in this PR, please update the test description to include 'area'.

Suggested change
testWidgets('TwoDimensionalScrollable does not crash at zero', (WidgetTester tester) async {
testWidgets('TwoDimensionalScrollable does not crash at zero area', (WidgetTester tester) async {

@chunhtai

Copy link
Copy Markdown
Contributor

looks like there is some gemini suggestion, can you take a look and resolve them? @ahmedsameha1

@chunhtai chunhtai added the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 22, 2026
victorsanni
victorsanni previously approved these changes Apr 23, 2026
@victorsanni victorsanni added the CICD Run CI/CD label Apr 23, 2026
@github-actions github-actions Bot removed the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 23, 2026
@ahmedsameha1
ahmedsameha1 force-pushed the add_more_0x0_size_tests_part_4 branch from 86f2710 to 4f39bc1 Compare April 23, 2026 11:55
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Apr 23, 2026
@victorsanni victorsanni added the CICD Run CI/CD label Apr 23, 2026
@ahmedsameha1

Copy link
Copy Markdown
Contributor Author

Can you fix the analyzer failures by running

dart format packages/flutter/test/widgets/semantics_debugger_test.dart packages/flutter/test/widgets/scrollable_test.dart packages/flutter/test/widgets/two_dimensional_viewport_test.dart

I ran this command, and 0 files changed

@Piinks

Piinks commented May 26, 2026

Copy link
Copy Markdown
Contributor

Can you fix the analyzer failures by running

dart format packages/flutter/test/widgets/semantics_debugger_test.dart packages/flutter/test/widgets/scrollable_test.dart packages/flutter/test/widgets/two_dimensional_viewport_test.dart

I ran this command, and 0 files changed

Hmm, sounds like it might be a cache issue, run flutter clean?

@chunhtai

chunhtai commented May 27, 2026

Copy link
Copy Markdown
Contributor

Will probably need to run flutter update-packages in the flutter root

@hannah-hyj hannah-hyj added the CICD Run CI/CD label Jun 10, 2026
@hannah-hyj

Copy link
Copy Markdown
Member

Hi @ahmedsameha1 ! looks like there are some tests failing, can you run

dart format packages/flutter/test/widgets/semantics_debugger_test.dart

to fix the formatting issues?

@ahmedsameha1
ahmedsameha1 force-pushed the add_more_0x0_size_tests_part_4 branch from 94875ab to c10f735 Compare June 18, 2026 09:28
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 18, 2026
dkwingsmt
dkwingsmt previously approved these changes Jul 9, 2026

@dkwingsmt dkwingsmt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dkwingsmt dkwingsmt added the CICD Run CI/CD label Jul 9, 2026
@hannah-hyj

hannah-hyj commented Jul 9, 2026

Copy link
Copy Markdown
Member

code LGTM but CI is still not happy because there're some lint errors

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8676780489335975505/+/u/run_test.dart_for_analyze_shard_and_subshard_None/stdout

info • Sort directive sections alphabetically. Try sorting the directives • packages/flutter/test/widgets/semantics_debugger_test.dart:10:1 • directives_ordering
warning • Duplicate import. Try removing all but one import of the library • packages/flutter/test/widgets/semantics_debugger_test.dart:14:8 • duplicate_import

@hannah-hyj
hannah-hyj self-requested a review July 9, 2026 17:58
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Jul 10, 2026
@dkwingsmt dkwingsmt added the CICD Run CI/CD label Jul 10, 2026

@hannah-hyj hannah-hyj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 13, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Jul 13, 2026
Merged via the queue into flutter:master with commit a3693b0 Jul 13, 2026
99 of 100 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 13, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jul 14, 2026
flutter/flutter@cf9e8af...846664b

2026-07-14 [email protected] Roll Skia from dfcff99566c3 to 88954ef8f36d (1 revision) (flutter/flutter#189440)
2026-07-14 [email protected] refactor: remove material import from scrollable_semantics_test and selectable_region_context_menu_test (flutter/flutter#186611)
2026-07-14 [email protected] Roll Skia from 3d1fc554f1a2 to dfcff99566c3 (17 revisions) (flutter/flutter#189428)
2026-07-14 [email protected] Roll Dart SDK from 2c587df8f05a to 05bf153370c4 (5 revisions) (flutter/flutter#189426)
2026-07-14 [email protected] [flutter_tools] Remove web hot reload flag (flutter/flutter#185994)
2026-07-14 [email protected] [iOS] Fix flaky keyboard animation test (flutter/flutter#189353)
2026-07-14 [email protected] [Impeller] Playground expanded role (flutter/flutter#188889)
2026-07-14 [email protected] Roll pub packages (flutter/flutter#189409)
2026-07-13 [email protected] Update lock-threads dependency to 6.0.2 (flutter/flutter#189053)
2026-07-13 49699333+dependabot[bot]@users.noreply.github.com Bump actions/labeler from 6.1.0 to 6.2.0 in the all-github-actions group (flutter/flutter#189396)
2026-07-13 [email protected] Remove  outdated todo about `analysis bug on Windows` and update condition to also perform `analysis on windows` (flutter/flutter#189283)
2026-07-13 [email protected] Add more 0x0 size tests part 4 (flutter/flutter#185187)
2026-07-13 [email protected] Roll Packages from 20928d5 to ad2eab1 (18 revisions) (flutter/flutter#189387)
2026-07-13 [email protected] [flutter_tools] Fix ADB device listing output parsing regression (flutter/flutter#189369)
2026-07-13 [email protected] Stop running most Mac x64 builders that have Mac ARM equivalents on master (flutter/flutter#189301)
2026-07-13 [email protected] Move a few benchmarks from x64 Intel Macs to ARM (flutter/flutter#189377)
2026-07-13 [email protected] Add note that `hcpp` needs impeller (flutter/flutter#189382)
2026-07-13 [email protected] Roll Fuchsia Linux SDK from vhIlDkWIy21IrlB9E... to oOETA0ISPouDt2xBo... (flutter/flutter#189349)
2026-07-13 [email protected] [flutter_tools] Respect mustMatchAppBuild on Windows native assets (flutter/flutter#186788)
2026-07-13 [email protected] Roll Skia from 8bf65996caba to 3d1fc554f1a2 (2 revisions) (flutter/flutter#189350)
2026-07-13 [email protected] Roll Dart SDK from 0fc1668c4af4 to 2c587df8f05a (9 revisions) (flutter/flutter#189351)
2026-07-13 [email protected] [web] Fall back to full CJK fonts for characters not covered by split slices (flutter/flutter#188890)
2026-07-13 [email protected] Take Mac tool_integration_tests_* out of bringup (flutter/flutter#189368)
2026-07-13 [email protected] [hooks] Roll record_use to 1.0 and unpin (flutter/flutter#189366)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) CICD Run CI/CD f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants