Skip to content

Commit

Permalink
Add logging to scrollable semantics test (flutter#30321)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmagman authored Dec 14, 2021
1 parent 50ccb0f commit 2dea5c6
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,27 @@ - (void)testVerticalFlutterScrollableSemanticsObjectNoWindow {
[scrollable setSemanticsNode:&node];
[scrollable accessibilityBridgeDidFinishUpdate];
UIScrollView* scrollView = [scrollable nativeAccessibility];
XCTAssertTrue(
CGRectEqualToRect(scrollView.frame, CGRectMake(x * effectivelyScale, y * effectivelyScale,
w * effectivelyScale, h * effectivelyScale)));
XCTAssertTrue(CGSizeEqualToSize(
scrollView.contentSize,
CGSizeMake(w * effectivelyScale, (h + scrollExtentMax) * effectivelyScale)));
XCTAssertTrue(CGPointEqualToPoint(scrollView.contentOffset,
CGPointMake(0, scrollPosition * effectivelyScale)));

CGRect actualFrame = scrollView.frame;
CGRect expectedFrame = CGRectMake(x * effectivelyScale, y * effectivelyScale,
w * effectivelyScale, h * effectivelyScale);
XCTAssertTrue(CGRectEqualToRect(actualFrame, expectedFrame),
@"Scroll view %@ frame is %@, expected %@", scrollView,
NSStringFromCGRect(actualFrame), NSStringFromCGRect(expectedFrame));

CGSize actualContentSize = scrollView.contentSize;
CGSize expectedContentSize =
CGSizeMake(w * effectivelyScale, (h + scrollExtentMax) * effectivelyScale);
XCTAssertTrue(CGSizeEqualToSize(actualContentSize, expectedContentSize),
@"Scroll view %@ size is %@, expected %@", scrollView,
NSStringFromCGSize(actualContentSize), NSStringFromCGSize(expectedContentSize));

CGPoint actualContentOffset = scrollView.contentOffset;
CGPoint expectedContentOffset = CGPointMake(0, scrollPosition * effectivelyScale);
XCTAssertTrue(CGPointEqualToPoint(actualContentOffset, expectedContentOffset),
@"Scroll view %@ offset is %@, expected %@", scrollView,
NSStringFromCGPoint(actualContentOffset),
NSStringFromCGPoint(expectedContentOffset));
}

- (void)testHorizontalFlutterScrollableSemanticsObject {
Expand Down

0 comments on commit 2dea5c6

Please sign in to comment.