Skip to content

Conversation

@hannah-hyj
Copy link
Member

@hannah-hyj hannah-hyj commented Sep 25, 2025

Update flutter test to use SemanticsFlags so it will support incoming flags

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@flutter-dashboard

This comment was marked as resolved.

@github-actions github-actions bot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) labels Sep 25, 2025
@hannah-hyj hannah-hyj requested a review from chunhtai September 25, 2025 04:58
Copy link
Contributor

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

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 updates flutter_test to use the new SemanticsFlags API, which is a great modernization step. The changes correctly refactor the code to adopt this new API across several files. I've identified a couple of bugs in the test code generation logic that could produce incorrect output, a typo in the documentation, and some areas where the readability of test failure messages could be improved. My review provides specific suggestions to address these points.

@hannah-hyj hannah-hyj force-pushed the semanticsflag-fluttertest branch from e732c08 to 5749657 Compare September 25, 2025 05:29
@hannah-hyj hannah-hyj force-pushed the semanticsflag-fluttertest branch from d7bfd49 to 8ff1b6d Compare September 25, 2025 20:42
@hannah-hyj hannah-hyj changed the title Update flutter_test to use SemanticsFlags Update flutter test to use SemanticsFlags Sep 25, 2025
import 'package:flutter_test/flutter_test.dart';

export 'dart:ui' show SemanticsAction, SemanticsFlag;
export 'dart:ui' show SemanticsAction, SemanticsFlag, SemanticsFlags;
Copy link
Contributor

Choose a reason for hiding this comment

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

does this needs to export the old semanticsFlag?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes because we should still support old apis that flags is a List

}
if (flags is int && flags != 0 ||
flags is List<SemanticsFlag> && (flags as List<SemanticsFlag>).isNotEmpty) {
if ((flags is int && flags != 0) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have existing API to convert int, List<SemanticsFlag> into SemanticsFlags? if so consider store the class property in SemanticsFlags and do the conversion in constructor

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we have existing API to convert int, List into SemanticsFlags? >> we only have existing API to convert SemanticsFlags to int, but not int to SemanticsFlags.

@hannah-hyj hannah-hyj requested a review from chunhtai September 26, 2025 22:05
Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

@hannah-hyj hannah-hyj added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 26, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Sep 26, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Sep 27, 2025
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 27, 2025
@hannah-hyj hannah-hyj added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 30, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Sep 30, 2025
Merged via the queue into flutter:master with commit bfde3e8 Sep 30, 2025
80 of 81 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 30, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 30, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 1, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Oct 1, 2025
…10145)

Manual roll requested by [email protected]

flutter/flutter@96fe3b3...c9608e2

2025-09-30 [email protected] Implement framework interface for the dialog window archetype (flutter/flutter#176202)
2025-09-30 [email protected] Update flutter test to use SemanticsFlags (flutter/flutter#175987)
2025-09-30 [email protected] Set minimum supported java version to 17  (flutter/flutter#176226)
2025-09-30 [email protected] Reduce timeout for Linux web_tool_tests back to 60 (flutter/flutter#176286)
2025-09-30 [email protected] Roll Packages from 34eec78 to 287739d (9 revisions) (flutter/flutter#176284)
2025-09-30 [email protected] [web] Bump Firefox to 143.0 (flutter/flutter#176110)
2025-09-30 [email protected] Migrate to `WidgetStateBorderSide` (flutter/flutter#176164)
2025-09-30 [email protected] Enhance input decorator padding logic for character counter in text f… (flutter/flutter#175706)
2025-09-30 [email protected] Update the test package for the web engine unit test bits. (flutter/flutter#176241)
2025-09-30 [email protected] Warn if embedder API calls don't return success (flutter/flutter#176184)
2025-09-30 [email protected] Roll Fuchsia Test Scripts from APSBP-sS-3FX69Ihf... to JUeFbA8y0E-_pj-bg... (flutter/flutter#176243)
2025-09-30 [email protected] Roll GN to 81b24e01 (flutter/flutter#176119)
2025-09-29 [email protected] Rename DisplayMonitor to DisplayManager on Win32 (flutter/flutter#175619)
2025-09-29 [email protected] [Android] Use headingLevel for heading accessibility property (flutter/flutter#175416)
2025-09-29 [email protected] BUILD.gn: Support LTO build on Linux (flutter/flutter#176191)
2025-09-29 [email protected] fix `assertEquals` arguments are in wrong order in `FlutterJNITest.java` (flutter/flutter#175728)
2025-09-29 [email protected] Add tests for `Project` getters  (flutter/flutter#175994)
2025-09-29 [email protected] Roll Fuchsia Linux SDK from 8zjcJic_DtvB2Bo2x... to rcOl0yxJb4znJ903Y... (flutter/flutter#176215)
2025-09-29 [email protected] Clean up typos in `PlatformViewsControllerTest.java` (flutter/flutter#175725)
2025-09-29 [email protected] Migrate java 11 usage to java 17 usage for templates (flutter/flutter#176203)
2025-09-29 [email protected] User Invoke-Expression instead of call operator for nested Powershell scripts invocations (on Windows) (flutter/flutter#175941)
2025-09-29 [email protected] Update changelog as on 3.35 branch (flutter/flutter#176216)
2025-09-29 [email protected] fix typo in `Crashes.md` (flutter/flutter#175959)
2025-09-29 [email protected] Add scene plugin lifecycle events (flutter/flutter#175866)
2025-09-29 [email protected] Migrate tests and documentation to set java version to 17 (flutter/flutter#176204)
2025-09-29 [email protected] Update Engine CI to use NDK r28c  (flutter/flutter#175870)

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
okorohelijah pushed a commit to okorohelijah/flutter that referenced this pull request Oct 7, 2025
Update flutter test to use SemanticsFlags so it will support incoming
flags

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
Update flutter test to use SemanticsFlags so it will support incoming
flags

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.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) a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants