Skip to content

[cupertino_ui] Enable switch_test.dart#12076

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
QuncCccccc:enable_cupertino_switch_test
Jul 1, 2026
Merged

[cupertino_ui] Enable switch_test.dart#12076
auto-submit[bot] merged 1 commit into
flutter:mainfrom
QuncCccccc:enable_cupertino_switch_test

Conversation

@QuncCccccc

Copy link
Copy Markdown
Contributor

Part of flutter/flutter#182636 and flutter/flutter#188395

This PR:

  • Removes the cross-import of widgets/semantics_tester.dart from switch_test.dart.
  • Replaces SemanticsTester usages.
  • Removes the @Skip annotation and moves the file to the test/ folder.

Pre-Review Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter].
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • I followed [the version and CHANGELOG instructions], using [semantic versioning] and the [repository CHANGELOG style], or I have commented below to indicate which documented exception this PR falls under[^1].
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which [test exemption] this PR falls under[^1].
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 30, 2026
@github-actions github-actions Bot added triage-framework Should be looked at in framework triage p: cupertino_ui labels Jun 30, 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 re-enables the switch_test.dart test file by removing the @Skip annotation and removes the SemanticsTester import and its usages. The review feedback points out that removing SemanticsTester without enabling semantics will cause object.debugSemantics to be null, leading to null-check crashes. It is recommended to use tester.ensureSemantics() and register its disposal via addTearDown to resolve this issue.

);
final semanticsTester = SemanticsTester(tester);

await tester.pumpWidget(

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.

high

Removing SemanticsTester without enabling semantics will cause object.debugSemantics to be null, leading to a null-check crash when object.debugSemantics! is called. To fix this, use tester.ensureSemantics() and register its disposal via addTearDown.

    final SemanticsHandle semantics = tester.ensureSemantics();
    addTearDown(semantics.dispose);
    await tester.pumpWidget(

);
final semanticsTester = SemanticsTester(tester);

await tester.pumpWidget(

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.

high

Removing SemanticsTester without enabling semantics will cause object.debugSemantics to be null, leading to a null-check crash when object.debugSemantics! is called. To fix this, use tester.ensureSemantics() and register its disposal via addTearDown.

    final SemanticsHandle semantics = tester.ensureSemantics();
    addTearDown(semantics.dispose);
    await tester.pumpWidget(

@QuncCccccc QuncCccccc force-pushed the enable_cupertino_switch_test branch from 39cd313 to 8ca6b91 Compare June 30, 2026 19:41
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 30, 2026
@QuncCccccc QuncCccccc added the CICD Run CI/CD label Jun 30, 2026
@QuncCccccc QuncCccccc requested review from chunhtai and justinmc June 30, 2026 20:02
@QuncCccccc

Copy link
Copy Markdown
Contributor Author

Seems based on Gemini's comment, we have to keep ensureSemantics. Wanted to confirm with @chunhtai

@QuncCccccc QuncCccccc changed the title [cupertino_ui] Enable switch_test [cupertino_ui] Enable switch_test.dart Jun 30, 2026

@Renzo-Olivares Renzo-Olivares 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, w/ small comments about ensureSemantics.

Comment thread packages/cupertino_ui/test/switch_test.dart Outdated
Comment thread packages/cupertino_ui/test/switch_test.dart Outdated
@QuncCccccc QuncCccccc force-pushed the enable_cupertino_switch_test branch from 8ca6b91 to f4c8d80 Compare July 1, 2026 16:48
@github-actions github-actions Bot removed the CICD Run CI/CD label Jul 1, 2026
@QuncCccccc QuncCccccc added the CICD Run CI/CD label Jul 1, 2026

@justinmc justinmc 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 👍

@QuncCccccc QuncCccccc added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 1, 2026
@auto-submit auto-submit Bot merged commit 0fc62ee into flutter:main Jul 1, 2026
88 checks passed
pull Bot pushed a commit to Klomgor/flutter that referenced this pull request Jul 2, 2026
…er#188916)

flutter/packages@e742106...420e135

2026-07-02 dkwingsmt@users.noreply.github.com [material_ui] Migrate api
sample code to @example dartdoc directive (flutter/packages#12078)
2026-07-02 dkwingsmt@users.noreply.github.com [material_ui] Move over
more API samples (flutter/packages#12092)
2026-07-01 katelovett@google.com [cupertino_ui] Migrate api sample code
to @example dartdoc directive (flutter/packages#12063)
2026-07-01 katelovett@google.com [cupertino_ui] Move over more API
samples (flutter/packages#12086)
2026-07-01 48776784+mackings@users.noreply.github.com
[two_dimensional_scrollables] Fix TreeView horizontal hit testing
(flutter/packages#11859)
2026-07-01 1063596+reidbaker@users.noreply.github.com
[camera_android_camerax][tool] Integrate dart_code_linter for cyclomatic
complexity checks (flutter/packages#11999)
2026-07-01 dinurymomshad.dev@gmail.com [cross_file] Add runnable example
with main() (flutter/packages#11527)
2026-07-01 36861262+QuncCccccc@users.noreply.github.com [cupertino_ui]
Enable `switch_test.dart` (flutter/packages#12076)
2026-07-01 jmccandless@google.com [cupertino_ui] Re-enable
dialog_test.dart (flutter/packages#12057)
2026-07-01 jmccandless@google.com [cupertino_ui] Re-enable
action_sheet_test.dart (flutter/packages#12055)
2026-07-01 rmolivares@renzo-olivares.dev [cupertino_ui] Migrate
`bottom_tab_bar_test.dart` to `SemanticsHandle` (flutter/packages#12012)
2026-07-01 1063596+reidbaker@users.noreply.github.com [repo] Add comment
style guideline to AGENTS.md (flutter/packages#12077)
2026-07-01 43054281+camsim99@users.noreply.github.com Adds pre-push
readiness skill (flutter/packages#11935)

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-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
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

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: cupertino_ui triage-framework Should be looked at in framework triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants