Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 8a1fb47

Browse files
author
Chris Yang
committed
fix test
1 parent 9318d08 commit 8a1fb47

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,23 @@ void AccessibilityObjectDidLoseFocus(int32_t id) override {}
8989
} // namespace
9090
} // namespace flutter
9191

92+
@interface FakePlatformView : UIView
93+
94+
@property(nonatomic, strong, readonly) UIView* subview;
95+
96+
@end
97+
98+
@implementation FakePlatformView
99+
100+
- (id)_accessibilityHitTest:(CGPoint)point withEvent:(UIEvent*)event {
101+
if (_subview) {
102+
_subview = [[UIView alloc] init];
103+
}
104+
return _subview;
105+
}
106+
107+
@end
108+
92109
@interface SemanticsObjectTest : XCTestCase
93110
@end
94111

@@ -210,8 +227,8 @@ - (void)testAccessibilityHitTestSearchPlatformViewSubtree {
210227
SemanticsObject* object0 = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
211228
SemanticsObject* object1 = [[SemanticsObject alloc] initWithBridge:bridge uid:1];
212229
SemanticsObject* object3 = [[SemanticsObject alloc] initWithBridge:bridge uid:3];
213-
UIView* platformView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
214-
UIView* subView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
230+
FakePlatformView* platformView =
231+
[[FakePlatformView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
215232
FlutterPlatformViewSemanticsContainer* platformViewSemanticsContainer =
216233
[[FlutterPlatformViewSemanticsContainer alloc] initWithBridge:bridge
217234
uid:1
@@ -247,12 +264,13 @@ - (void)testAccessibilityHitTestSearchPlatformViewSubtree {
247264
[object3 setSemanticsNode:&node3];
248265

249266
CGPoint point = CGPointMake(10, 10);
250-
id partialMockPlatformView = OCMPartialMock(platformView);
251-
OCMStub([partialMockPlatformView _accessibilityHitTest:point withEvent:nil]).andReturn(subView);
267+
// id partialMockPlatformView = OCMPartialMock(platformView);
268+
// OCMStub([partialMockPlatformView _accessibilityHitTest:point
269+
// withEvent:nil]).andReturn(subView);
252270
id hitTestResult = [object0 _accessibilityHitTest:point withEvent:nil];
253271

254272
// Focus to object2 because it's the first object in hit test order
255-
XCTAssertEqual(hitTestResult, subView);
273+
XCTAssertEqual(hitTestResult, platformView.subview);
256274
}
257275

258276
- (void)testAccessibilityScrollToVisible {

0 commit comments

Comments
 (0)