Skip to content

Conversation

@hellohuanlin
Copy link
Contributor

@hellohuanlin hellohuanlin commented Feb 16, 2023

Note: This will need to wait for engine roll for flutter/engine#39527 to pass.

Add integration test for platform view becomes not tappable issue. This happens when we have 2 platform views stacking on each other. For example, one of the platform views is put in an alert dialog prompt, which covers a background platform view underneath, as demonstrated in this PR.

List which issues are fixed by this PR. You must list at least one issue.

#118366

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added the c: contributor-productivity Team-specific productivity, code health, technical debt. label Feb 16, 2023
@hellohuanlin hellohuanlin force-pushed the platform_view_z_order_xcuitest branch from 5978b7d to 0a7df2c Compare February 16, 2023 00:32
@hellohuanlin hellohuanlin marked this pull request as ready for review February 16, 2023 00:42
@hellohuanlin hellohuanlin added the platform-ios iOS applications specifically label Feb 16, 2023
Comment on lines 87 to 88
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corresponding to which delay?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me update to be more clear.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we discovered that it is not a bug rather a correct behavior of the framework. So we should probably explain that behavior here.

Comment on lines +20 to +21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it needs to be hittable for tap on the element to work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah otherwise it will just crash.

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this test be done with scenario app using void onPointerDataPacket(PointerDataPacket packet) ?

The idea is to schedule a new frame after receiving a touch gesture, then change the composition order of the platform views.

See: https://github.com/flutter/engine/blob/main/testing/scenario_app/lib/src/platform_view.dart#L992
You will also need to inject some indication in a11y parameters of the platform view so that the order change can be recognized by XCTest.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a semantics node when "showBackground is true", then in the XCTest, you can search for that node instead of delaying.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue I had is that for some reason it fails to query the second platform view which is controlled by showBackground (Refer to https://github.com/flutter/flutter/pull/120844/files#diff-3e48a5714c1ea61112bebbd881876bea61cf86f065890eda9b019360d62cee97R85-R88)

Are you saying I should add a "semantics node" for the second platform view to work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Offline discussion, it is not possible as dialog seems to remove other semantics nodes from the tree. I couldn't think of another way better than using the delay in the test.

@hellohuanlin
Copy link
Contributor Author

@cyanglaz my understanding is that scenario test is not a full integration test - it does not use flutter framework. So passing that scenario test does not give us enough confidence that this issue is fixed.

@cyanglaz
Copy link
Contributor

@cyanglaz my understanding is that scenario test is not a full integration test - it does not use flutter framework. So passing that scenario test does not give us enough confidence that this issue is fixed.

Ah, are we also testing framework behavior? I couldn't find anything related to the framework to be tested for the fix.
I still think this integration test is valuable and we should land this. I was just thinking if we can do a similar test in the scenario app so future bugs can be caught earlier.

@hellohuanlin
Copy link
Contributor Author

I couldn't find anything related to the framework to be tested for the fix.

@cyanglaz We need the framework to verify that the platform view (UiKitView widget) is indeed tappable.

@hellohuanlin
Copy link
Contributor Author

hellohuanlin commented Feb 16, 2023

@cyanglaz I did look into the scenario test yesterday. My understanding is (i'm new to this so I could be terribly wrong):

For framework integration test (this PR), the framework directs engine to re-order subviews:

Framework (UiKitView widget)
  |    
Engine (UIView)

On the other hand, for scenario test, a "FakeUI" layer mimics the framework behavior by sending fake draw commands for engine to re-order subviews:

Fake UI
  |
Engine (UIView)

So my conclusion was:

(1) In an ideal world, these 2 tests verify the same engine behavior; however, in practice I'd argue that scenario tests will not give us as much confidence about engine behavior, since we could made mistakes mimicking the FakeUI behavior. (e.g. engine may pass the test, but under a wrong FakeUI command)

(2) Another drawback with scenario test is that framework is not part of the integration. it doesn't give any confidence that the UiKitView is indeed tappable, which is the very purpose of this bugfix.

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % comments regarding why a delay is necessary in the test .

@hellohuanlin hellohuanlin force-pushed the platform_view_z_order_xcuitest branch 3 times, most recently from eb85f79 to 4a92cec Compare February 22, 2023 22:15
@hellohuanlin
Copy link
Contributor Author

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocationsProvider has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

For some reason I kept getting Android failure. Let me rebase again.

@hellohuanlin hellohuanlin force-pushed the platform_view_z_order_xcuitest branch from 4a92cec to ec474f9 Compare February 23, 2023 18:01
@jmagman
Copy link
Member

jmagman commented Feb 23, 2023

plugin_lint_mac timed out on an arm machine, I think you hit #119750

@hellohuanlin hellohuanlin added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 23, 2023
@auto-submit auto-submit bot merged commit 1155d27 into flutter:master Feb 23, 2023
@nehalvpatel
Copy link
Contributor

nehalvpatel commented Feb 24, 2023

It looks like this change is consistently failing the Mac_ios spell_check_test test with the same error in postsubmit and closing the tree.

Can someone in this thread please take a look? I've added details and links to the logs here: #121381

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 24, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 24, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App c: contributor-productivity Team-specific productivity, code health, technical debt. platform-ios iOS applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants