This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Access on/off labels accessibility setting for switches on iOS #30764
Merged
fluttergithubbot
merged 1 commit into
flutter:main
from
RtgrV:accessibility-onofflabels-ios
Mar 7, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| #import <XCTest/XCTest.h> | ||
|
|
||
| #include "flutter/fml/platform/darwin/message_loop_darwin.h" | ||
| #import "flutter/lib/ui/window/platform_configuration.h" | ||
| #import "flutter/lib/ui/window/viewport_metrics.h" | ||
| #import "flutter/shell/platform/darwin/common/framework/Headers/FlutterBinaryMessenger.h" | ||
| #import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h" | ||
|
|
@@ -25,10 +26,6 @@ - (void)sendKeyEvent:(const FlutterKeyEvent&)event | |
| userData:(nullable void*)userData; | ||
| @end | ||
|
|
||
| namespace flutter { | ||
| class PointerDataPacket {}; | ||
| } | ||
|
|
||
| /// Sometimes we have to use a custom mock to avoid retain cycles in OCMock. | ||
| /// Used for testing low memory notification. | ||
| @interface FlutterEnginePartialMock : FlutterEngine | ||
|
|
@@ -617,6 +614,46 @@ - (void)testItReportsHighContrastWhenTraitCollectionRequestsIt { | |
| [mockTraitCollection stopMocking]; | ||
| } | ||
|
|
||
| - (void)testItReportsAccessibilityOnOffSwitchLabelsFlagNotSet { | ||
| if (@available(iOS 13, *)) { | ||
| // noop | ||
| } else { | ||
| return; | ||
| } | ||
|
|
||
| // Setup test. | ||
| FlutterViewController* viewController = | ||
| [[FlutterViewController alloc] initWithEngine:self.mockEngine nibName:nil bundle:nil]; | ||
| id partialMockViewController = OCMPartialMock(viewController); | ||
| OCMStub([partialMockViewController accessibilityIsOnOffSwitchLabelsEnabled]).andReturn(NO); | ||
|
|
||
| // Exercise behavior under test. | ||
| int32_t flags = [partialMockViewController accessibilityFlags]; | ||
|
|
||
| // Verify behavior. | ||
| XCTAssert((flags & (int32_t)flutter::AccessibilityFeatureFlag::kOnOffSwitchLabels) == 0); | ||
| } | ||
|
|
||
| - (void)testItReportsAccessibilityOnOffSwitchLabelsFlagSet { | ||
| if (@available(iOS 13, *)) { | ||
| // noop | ||
| } else { | ||
| return; | ||
| } | ||
|
|
||
| // Setup test. | ||
| FlutterViewController* viewController = | ||
| [[FlutterViewController alloc] initWithEngine:self.mockEngine nibName:nil bundle:nil]; | ||
| id partialMockViewController = OCMPartialMock(viewController); | ||
| OCMStub([partialMockViewController accessibilityIsOnOffSwitchLabelsEnabled]).andReturn(YES); | ||
|
|
||
| // Exercise behavior under test. | ||
| int32_t flags = [partialMockViewController accessibilityFlags]; | ||
|
|
||
| // Verify behavior. | ||
| XCTAssert((flags & (int32_t)flutter::AccessibilityFeatureFlag::kOnOffSwitchLabels) != 0); | ||
| } | ||
|
|
||
| - (void)testPerformOrientationUpdateForcesOrientationChange { | ||
| [self orientationTestWithOrientationUpdate:UIInterfaceOrientationMaskPortrait | ||
| currentOrientation:UIInterfaceOrientationLandscapeLeft | ||
|
|
@@ -1052,7 +1089,7 @@ - (void)testMouseSupport API_AVAILABLE(ios(13.4)) { | |
| [vc scrollEvent:mockPanGestureRecognizer]; | ||
|
|
||
| [[[self.mockEngine verify] ignoringNonObjectArgs] | ||
| dispatchPointerDataPacket:std::make_unique<flutter::PointerDataPacket>()]; | ||
| dispatchPointerDataPacket:std::make_unique<flutter::PointerDataPacket>(0)]; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or this? |
||
| } | ||
|
|
||
| @end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Did you mean to change this?
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.
Yes, if I didn't it wouldn't compile.
I had to import
to get access to the AccessibilityFeatureFlag enum.
platform_configuration imports the implementation of the PointerDataPacket class. Making the one in the tests obsolete.