-
Notifications
You must be signed in to change notification settings - Fork 6k
[ios platform view] fix overlay zPosition #29930
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -257,3 +257,40 @@ - (void)testPlatformViewWithContinuousTexture { | |
| } | ||
|
|
||
| @end | ||
|
|
||
| @interface PlatformViewScrollingUnderWidget : XCTestCase | ||
|
|
||
| @end | ||
|
|
||
| @implementation PlatformViewScrollingUnderWidget | ||
|
|
||
| - (void)setUp { | ||
| [super setUp]; | ||
| self.continueAfterFailure = NO; | ||
cyanglaz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| - (void)testPlatformViewScrollingUnderWidget { | ||
| XCUIApplication* app = [[XCUIApplication alloc] init]; | ||
| app.launchArguments = | ||
| @[ @"--platform-view-scrolling-under-widget", @"--with-continuous-texture" ]; | ||
| [app launch]; | ||
|
|
||
| XCUIElement* platformView = app.textViews.firstMatch; | ||
| BOOL exists = [platformView waitForExistenceWithTimeout:kSecondsToWaitForPlatformView]; | ||
| if (!exists) { | ||
|
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. can it also check for the zPosition since that seems to be the bug?
Contributor
Author
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. AFAIK, XCUITest doesn't have access to the actual layers. I also did a light research and couldn't find anything online. :(
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. Right, these integration tests are black box, you don't have access to the app layers, just the accessibility hooks. A verification like that would need to happen in a XCTest unit test. 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. right. If the bug is that the I did something similar with the UIView in https://github.com/flutter/engine/blob/104e21d941fc8aed1073c6caaae71cf944837256/testing/scenario_app/ios/Scenarios/ScenariosUITests/UnobstructedPlatformViewTests.m
Contributor
Author
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. Yes, XCUITest can access the frame (I believe it is the accessiblyElement's frame, not UIView's frame, they are the same value by default but could actually be different depending on the implementation). I believe accessiblyElement doesn't have any knowledge on the zIndex. The current test we have will crash if the zIndex is incorrect because of the DCHECK that I added (only on debug_unopt build, which is the one we use on CI) I agree a better test would involve directly examine the zIndex value. This will require an XCTest. We then need to create a fake where the RTree thinks there's a picture layer on top of platform views. I don't think there's a way to do so in the current API set up? One way to do it might be refactor the PlatformViewsController's implementation, introduce a mockable API, so we can mock and force to create overlays. 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. I thought an incorrect z index will make the tests fail in https://github.com/flutter/engine/blob/104e21d941fc8aed1073c6caaae71cf944837256/testing/scenario_app/ios/Scenarios/ScenariosUITests/UnobstructedPlatformViewTests.m If you don't set zPosition, are there any test failures?
Contributor
Author
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. Which test would fail? I might be missing something but the tests in https://github.com/flutter/engine/blob/104e21d941fc8aed1073c6caaae71cf944837256/testing/scenario_app/ios/Scenarios/ScenariosUITests/UnobstructedPlatformViewTests.m are not checking zPosition or anything related to it right? 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. There’s a comment about z index in that file. I remember the index being determined from the position of the layer in the tree I believe |
||
| XCTFail(@"It took longer than %@ second to find the platform view." | ||
| @"There might be issues with the platform view's construction," | ||
| @"or with how the scenario is built.", | ||
| @(kSecondsToWaitForPlatformView)); | ||
| } | ||
|
|
||
| // Wait and let the scenario app scroll a bit. | ||
| XCTWaiterResult waitResult = [XCTWaiter | ||
| waitForExpectations:@[ [[XCTestExpectation alloc] initWithDescription:@"Wait for 5 seconds"] ] | ||
| timeout:5]; | ||
| // If the waiter is not interrupted, we know the app is in a valid state after timeout, thus the | ||
| // test passes. | ||
| XCTAssert(waitResult != XCTWaiterResultInterrupted); | ||
| } | ||
|
|
||
| @end | ||
Uh oh!
There was an error while loading. Please reload this page.