-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[pointer_interceptor_ios] Migrate XCTest to Swift Testing #10762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 migrates the tests for pointer_interceptor_ios from XCTest to Swift Testing. The changes are well-contained and correctly implement the new testing framework's features. Specifically, RunnerTests.swift is updated to use a single parameterized test with @Test(arguments:), which replaces two separate test methods, making the test suite more concise. The necessary project file updates, such as increasing the Swift version to 6.0, are also included. The CHANGELOG.md is updated accordingly. The migration is clean and follows modern Swift testing practices.
...ges/pointer_interceptor/pointer_interceptor_ios/example/ios/Runner.xcodeproj/project.pbxproj
Outdated
Show resolved
Hide resolved
packages/pointer_interceptor/pointer_interceptor_ios/example/ios/RunnerTests/RunnerTests.swift
Outdated
Show resolved
Hide resolved
packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/AppDelegate.swift
Outdated
Show resolved
Hide resolved
|
|
||
| class RunnerTests: XCTestCase { | ||
| func testNonDebugMode() { | ||
| @MainActor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note if you don't use @MainActor there will be a main thread checker error because the test won't run on the main thread:
PointerInterceptorView.swift:12 UIView.initWithFrame: must be used from main thread only
Though the test still passed. I'm not sure how to make it an error instead of a warning, without converting the whole thing to a test plan (which seems overkill)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make this an error by enabling the strict concurrency mode in build settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I'll play around with how to do that #10788
hellohuanlin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one question about the swift version bump
| PRODUCT_BUNDLE_IDENTIFIER = flutter.dev.pointerInterceptorIosExample.RunnerTests; | ||
| PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| SWIFT_VERSION = 5.0; | ||
| SWIFT_VERSION = 6.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this version bump have any implication on developers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is only the plugin example app project, it's not code or an Xcode project a plugin consumer would run.
|
|
||
| class RunnerTests: XCTestCase { | ||
| func testNonDebugMode() { | ||
| @MainActor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make this an error by enabling the strict concurrency mode in build settings.
| struct RunnerTests { | ||
| @Test(arguments: [ | ||
| (false, UIColor.clear), | ||
| (true, UIColor(red: 1, green: 0, blue: 0, alpha: 0.5)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convenient!
flutter/packages@98b0325...ce3afa4 2026-01-15 [email protected] Manual roll Flutter from 793b0b8 to b45a73b (8 revisions) (flutter/packages#10799) 2026-01-15 [email protected] [path_provider] Re-release FFI foundation version (flutter/packages#10722) 2026-01-15 [email protected] [google_sign_in] Convert iOS tests to Swift (flutter/packages#10787) 2026-01-14 [email protected] [video_player] Update for UIScene compatibility (flutter/packages#10676) 2026-01-14 [email protected] [pointer_interceptor_ios] Migrate XCTest to Swift Testing (flutter/packages#10762) 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 [email protected] 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
…r#181035) flutter/packages@98b0325...ce3afa4 2026-01-15 [email protected] Manual roll Flutter from 793b0b8 to b45a73b (8 revisions) (flutter/packages#10799) 2026-01-15 [email protected] [path_provider] Re-release FFI foundation version (flutter/packages#10722) 2026-01-15 [email protected] [google_sign_in] Convert iOS tests to Swift (flutter/packages#10787) 2026-01-14 [email protected] [video_player] Update for UIScene compatibility (flutter/packages#10676) 2026-01-14 [email protected] [pointer_interceptor_ios] Migrate XCTest to Swift Testing (flutter/packages#10762) 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 [email protected] 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
Part of flutter/flutter#180787
Migrate
testDebugModeto one parameterized tests, which show up differently in the test UI:https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8693093135153504353/+/u/Run_package_tests/native_test/stdout
Adding CHANGELOG override per #10761 (comment)
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).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-assistbot 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.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3