-
Notifications
You must be signed in to change notification settings - Fork 6k
Incorporate View.setSystemGestureExclusionRects code review feedback from #11441 #11804
Incorporate View.setSystemGestureExclusionRects code review feedback from #11441 #11804
Conversation
…tureExclusionRects success case
matthew-carroll
left a comment
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.
Thanks for revisiting this. Just a few more comments for clarity in the tests. Also, I'm wondering if 2 of the tests might be able to collapse down to one.
| platformChannel.setPlatformMessageHandler(platformMessageHandler); | ||
| Result result = mock(Result.class); | ||
|
|
||
| int top = 0; |
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.
Let's avoid placing the values in variables. I think it only makes it more difficult to see what's going into the rect. Generally we hard code input and output in tests to eliminate all possible logic in tests.
| int bottom = 250; | ||
| int left = 0; | ||
|
|
||
| JSONObject JsonRect = new JSONObject(); |
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.
Please start with lowercase letters.
| JsonRect.put("right", right); | ||
| JsonRect.put("bottom", bottom); | ||
| JsonRect.put("left", left); | ||
| JSONArray inputRects = new JSONArray(); |
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.
Since channels go 2 directions, it may not be clear what "input" means here. Perhaps jsonGestureInsetsFromPlatform would clarify?
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.
I updated the variable name to jsonExclusionRectsFromPlatform in both instances you mentioned in this review
| platformChannel.setPlatformMessageHandler(platformMessageHandler); | ||
| Result result = mock(Result.class); | ||
|
|
||
| int top = 0; |
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.
Let's remove these variables, too.
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.
Looks like these variables should still be removed.
| ResultsMock resultsMock = mock(ResultsMock.class); | ||
| JSONObject JsonRect = new JSONObject(); | ||
| JsonRect.put("top", top); | ||
| JsonRect.put("right", right); |
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.
I can't comment on the right line, but let's consider an improved name for inputRects here as well.
| } | ||
|
|
||
| @Test | ||
| public void itProperlyDecodesGestureRectsWhenSettingSystemGestureExclusionRects() throws JSONException { |
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.
I'm curious, what's the difference in testing value between this test and the one before it? Are we testing different things?
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.
I isolated the two because:
- the first one tests for whether or not a result.success response is sent to the framework when properly formatted JSON data comes from the framework.
- the second one tests for whether or not correctly formatted JSON data is properly transformed into
ArrayList<Rect>, which is whatView.setSystemGestureExclusionRectsexpects as its input. This ensures that we are feeding the Android API the correct data
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.
The main idea for my isolation here was to distill two, separate expected outcomes from the same logical flow
| MethodCall callGetSystemGestureExclusionRects = new MethodCall( | ||
| "SystemGestures.getSystemGestureExclusionRects", | ||
| null | ||
| int top = 0; |
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.
Here are a couple more variables we can remove.
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.
Done
matthew-carroll
left a comment
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.
LGTM. Thanks.
[email protected]:flutter/engine.git/compare/cd920398e40e...edee1fe git log cd92039..edee1fe --no-merges --oneline 2019-09-05 [email protected] Add @keep annotation (flutter/engine#11893) 2019-09-05 [email protected] Roll src/third_party/dart d0218d4771..be66176534 (11 commits) 2019-09-05 [email protected] Incorporate View.setSystemGestureExclusionRects code review feedback from #11441 (flutter/engine#11804) 2019-09-05 [email protected] Support build windows release/profile embedding builds (flutter/engine#11475) 2019-09-05 [email protected] Roll src/third_party/skia e784f75beb20..adecf4b6d5fe (6 commits) (flutter/engine#11900) 2019-09-05 [email protected] remove extra redundant channels setup in iOS embedding engine (flutter/engine#11886) 2019-09-05 [email protected] Revert "Add a BroadcastStream to FrameTiming (#11041)" (flutter/engine#11841) 2019-09-05 [email protected] Roll fuchsia/sdk/core/linux-amd64 from OmqaW... to Z7PSg... (flutter/engine#11898) 2019-09-05 [email protected] Roll fuchsia/sdk/core/mac-amd64 from S-f_C... to -AQkJ... (flutter/engine#11897) 2019-09-05 [email protected] Roll src/third_party/skia b0e2347fedfc..e784f75beb20 (1 commits) (flutter/engine#11896) 2019-09-05 [email protected] Roll src/third_party/dart 6eed35b60d..d0218d4771 (5 commits) 2019-09-05 [email protected] Roll src/third_party/skia 97218352addb..b0e2347fedfc (4 commits) (flutter/engine#11894) 2019-09-05 [email protected] Roll src/third_party/dart 67bb2b7819..6eed35b60d (18 commits) 2019-09-05 [email protected] Roll fuchsia/sdk/core/linux-amd64 from LKWtB... to OmqaW... (flutter/engine#11891) 2019-09-05 [email protected] Roll fuchsia/sdk/core/mac-amd64 from m-hNV... to S-f_C... (flutter/engine#11889) 2019-09-05 [email protected] Roll src/third_party/skia 166751ef578a..97218352addb (1 commits) (flutter/engine#11888) 2019-09-05 [email protected] Roll src/third_party/dart 08132661a6..67bb2b7819 (4 commits) 2019-09-04 [email protected] Finish plumbing message responses on method channels (flutter/engine#11877) 2019-09-04 [email protected] Roll src/third_party/dart c3db2e3ee0..08132661a6 (2 commits) 2019-09-04 [email protected] [Windows] Address #36422 by adding a context for async resource uploading (flutter/engine#11828) 2019-09-04 [email protected] Roll src/third_party/skia e7366841663b..166751ef578a (7 commits) (flutter/engine#11881) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
A follow-up to #11441. Changes include:
MethodChannel.MethodCallHandlerdefinition into inline-classitDoesSomethingWhenSomethingHappensformat. (The new ones are a little long in its current state)ResultsMockclass