-
Notifications
You must be signed in to change notification settings - Fork 6k
Full implementation of text-input-test #37986
Conversation
|
Gold has detected about 72 new digest(s) on patchset 6. |
akbiggs
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.
Nice. @filmil FYI this sets up an integration test for text input in Flutter Engine. Because we can't depend on the Flutter Framework directly in the Engine repo, there are some changes in the approach: instead of creating a text input widget and checking that it receives the input, we just check in the Dart component that the platform message for keyevents looks like what we expect it to.
...atform/fuchsia/flutter/tests/integration/text-input/text-input-view/lib/text_input_view.dart
Outdated
Show resolved
Hide resolved
|
|
||
| void _respond(test_text.KeyboardInputListenerReportTextInputRequest request) async { | ||
| print('text-input-view reporting keyboard input to KeyboardInputListener'); | ||
| await _responseListener.reportTextInput(request); |
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.
So just confirming, the test will fail if it doesn't receive the correct platform message, I guess because this will time out?
Just want to make sure it won't pass if the platform message doesn't get sent.
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.
Yep, it'll hang + the test won't receive an expected output so it'll fail (see L101 in text-input-test.cc for the matching logic for received vs expected)
| var decodedJson = json.decode(decoded); | ||
| print('received ${name} platform message: ${decodedJson}'); | ||
|
|
||
| if (name == "flutter/keyevent" && decodedJson["type"] == "keydown") { |
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.
Should we also have a test for the flutter/textinput channel? My impression was that we send messages along both flutter/keyevent and flutter/textinput.
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 don't see messages being sent through flutter/textinput, just flutter/keyevent.. I wonder if only TextField sends through the flutter/textinput channel and flutter/keyevent is for keys pressed anywhere
Here's some sample logs from the test:
[00331.442776][flutter_jit_runner] INFO: text-input-view.cm(flutter): received flutter/keyevent platform message: {type: keydown, keymap: fuchsia, hidUsage: 458770, codePoint: 111, modifiers: 0}
[00331.442786][flutter_jit_runner] INFO: text-input-view.cm(flutter): text-input-view reporting keyboard input to KeyboardInputListener
[00331.543676][flutter_jit_runner] INFO: text-input-view.cm(flutter): received flutter/keyevent platform message: {type: keyup, keymap: fuchsia, hidUsage: 458770, codePoint: 111, modifiers: 0}
|
Yay!
…On Mon, Dec 5, 2022 at 1:30 PM Alexander Biggs ***@***.***> wrote:
***@***.**** approved this pull request.
Nice. @filmil <https://github.com/filmil> FYI this sets up an integration
test for text input in Flutter Engine. Because we can't depend on the
Flutter Framework directly in the Engine repo, there are some changes in
the approach: instead of creating a text input widget and checking that it
receives the input, we just check in the Dart component that the platform
message for keyevents looks like what we expect it to.
------------------------------
In
shell/platform/fuchsia/flutter/tests/integration/text-input/text-input-view/lib/text_input_view.dart
<#37986 (comment)>:
> + final recorder = PictureRecorder();
+ final canvas = Canvas(recorder, physicalBounds);
+ canvas.scale(pixelRatio, pixelRatio);
+ // Draw something
+ final paint = Paint()..color = this._backgroundColor;
+ canvas.drawRect(windowBounds, paint);
+ // Build the scene
+ final picture = recorder.endRecording();
+ final sceneBuilder = SceneBuilder()
+ ..pushClipRect(physicalBounds)
+ ..addPicture(Offset.zero, picture)
+ ..pop();
+ window.render(sceneBuilder.build());
+ }
+
+ void platformMessage(String name, ByteData data) async {
Is there another name we can pick for this method? I'm not sure what it
does from the name.
------------------------------
In
shell/platform/fuchsia/flutter/tests/integration/text-input/text-input-view/lib/text_input_view.dart
<#37986 (comment)>:
> + print('received ${name} platform message: ${decodedJson}');
+
+ if (name == "flutter/keyevent" && decodedJson["type"] == "keydown") {
+ if (hidToKey[decodedJson["hidUsage"]] != null) {
+ await _respond(test_text.KeyboardInputListenerReportTextInputRequest(
+ text: hidToKey[decodedJson["hidUsage"]],
+ ));
+ }
+ }
+
+ window.scheduleFrame();
+ }
+
+ void _respond(test_text.KeyboardInputListenerReportTextInputRequest request) async {
+ print('text-input-view reporting keyboard input to KeyboardInputListener');
+ await _responseListener.reportTextInput(request);
So just confirming, the test will fail if it doesn't receive the correct
platform message, I guess because this will time out?
Just want to make sure it won't pass if the platform message doesn't get
sent.
------------------------------
In
shell/platform/fuchsia/flutter/tests/integration/text-input/text-input-view/lib/text_input_view.dart
<#37986 (comment)>:
> + final picture = recorder.endRecording();
+ final sceneBuilder = SceneBuilder()
+ ..pushClipRect(physicalBounds)
+ ..addPicture(Offset.zero, picture)
+ ..pop();
+ window.render(sceneBuilder.build());
+ }
+
+ void platformMessage(String name, ByteData data) async {
+ final buffer = data.buffer;
+ var list = buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
+ var decoded = utf8.decode(list);
+ var decodedJson = json.decode(decoded);
+ print('received ${name} platform message: ${decodedJson}');
+
+ if (name == "flutter/keyevent" && decodedJson["type"] == "keydown") {
Should we also have a test for the flutter/textinput channel? My
impression was that we send messages along both flutter/keyevent and
flutter/textinput.
—
Reply to this email directly, view it on GitHub
<#37986 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB4GMDWKISXTMIOS5Z7PWDWLZNIVANCNFSM6AAAAAASP52JYA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
* bd8bcf9 Roll Fuchsia Mac SDK from crEcyXdyZ686cAqMV... to pMV6A0ykZQ8aA3NG2... (flutter/engine#38120) * dec8b52 Preliminary implementation of UIA for A11y on Windows (flutter/engine#37754) * 5545ccf Roll Fuchsia Linux SDK from NlJGkMbtZqQ6_BCpu... to xn8ztWtp-zww-jObz... (flutter/engine#38122) * 80a15a4 Create FlutterActivity/FlutterFragment using light weight engine with FlutterEngineGroup (flutter/engine#36963) * 5caef85 Full implementation of text-input-test (flutter/engine#37986) * 8f6036e Reland fix wrong VSYNC event (flutter/engine#37865) * 4101c36 [iOS] Change locale format for spell check (flutter/engine#38080) * 2f5b67e [embedder] Ensure destruction called on present (flutter/engine#38078) * 0bddc60 [Impeller Scene] Depth attachment; baked lighting example (flutter/engine#38118) * 6aa4ccd Remove dlCanvasRecorder from flutter::PictureRecorder (flutter/engine#38127) * dbb5284 [Windows] Add more cursor plugin tests (flutter/engine#38112) * 6e91204 Roll Fuchsia Mac SDK from pMV6A0ykZQ8aA3NG2... to 9SnrQ0vbR8IC7UIoP... (flutter/engine#38135) * 3140ad9 [Impeller] order metal samplers according to declared order and not usage order (flutter/engine#38115) * 84abf21 Remove autoninja. (flutter/engine#38136) * 8a113d3 [embedder] Expose metal surface from test context (flutter/engine#38133) * 1ef25b6 Roll Fuchsia Mac SDK from 9SnrQ0vbR8IC7UIoP... to aMW0DjntzFJj4RoR3... (flutter/engine#38139) * 748b3bc Revert "Remove dlCanvasRecorder from flutter::PictureRecorder (#38127)" (flutter/engine#38137) * b6daf3d [embedder] Consistent naming for GL/Metal tests (flutter/engine#38141) * 339d04b [web] Trivial fix for non-static interop JS interop class. (flutter/engine#38126) * 1fcbb9c [tools] Eliminate version on Obj-C docs (flutter/engine#38145) * 71928b6 [Impeller] Use DrawPath instead of Rect geometry when the paint style is stroke (flutter/engine#38146) * 23ce8fd Roll Skia from dd3285a80b23 to f84dc9303045 (4 revisions) (flutter/engine#38123) * 366f866 Roll Skia from f84dc9303045 to 2691cd7b4110 (40 revisions) (flutter/engine#38151) * 447e701 Roll Skia from 2691cd7b4110 to 711396b81248 (1 revision) (flutter/engine#38152) * cd5d91b Pylint testing/run_tests.py (flutter/engine#38016) * aafac08 Roll Skia from 711396b81248 to b253b10374e7 (7 revisions) (flutter/engine#38157) * 799dc78 Roll Fuchsia Linux SDK from xn8ztWtp-zww-jObz... to rRJIjuO-dPNCpCTd9... (flutter/engine#38134) * 3aa3d2a Massage the JS interop around `didCreateEngineInitializer` (flutter/engine#38147) * 030950f Roll Skia from b253b10374e7 to ec407902999b (3 revisions) (flutter/engine#38158)
…16802) * bd8bcf9 Roll Fuchsia Mac SDK from crEcyXdyZ686cAqMV... to pMV6A0ykZQ8aA3NG2... (flutter/engine#38120) * dec8b52 Preliminary implementation of UIA for A11y on Windows (flutter/engine#37754) * 5545ccf Roll Fuchsia Linux SDK from NlJGkMbtZqQ6_BCpu... to xn8ztWtp-zww-jObz... (flutter/engine#38122) * 80a15a4 Create FlutterActivity/FlutterFragment using light weight engine with FlutterEngineGroup (flutter/engine#36963) * 5caef85 Full implementation of text-input-test (flutter/engine#37986) * 8f6036e Reland fix wrong VSYNC event (flutter/engine#37865) * 4101c36 [iOS] Change locale format for spell check (flutter/engine#38080) * 2f5b67e [embedder] Ensure destruction called on present (flutter/engine#38078) * 0bddc60 [Impeller Scene] Depth attachment; baked lighting example (flutter/engine#38118) * 6aa4ccd Remove dlCanvasRecorder from flutter::PictureRecorder (flutter/engine#38127) * dbb5284 [Windows] Add more cursor plugin tests (flutter/engine#38112) * 6e91204 Roll Fuchsia Mac SDK from pMV6A0ykZQ8aA3NG2... to 9SnrQ0vbR8IC7UIoP... (flutter/engine#38135) * 3140ad9 [Impeller] order metal samplers according to declared order and not usage order (flutter/engine#38115) * 84abf21 Remove autoninja. (flutter/engine#38136) * 8a113d3 [embedder] Expose metal surface from test context (flutter/engine#38133) * 1ef25b6 Roll Fuchsia Mac SDK from 9SnrQ0vbR8IC7UIoP... to aMW0DjntzFJj4RoR3... (flutter/engine#38139) * 748b3bc Revert "Remove dlCanvasRecorder from flutter::PictureRecorder (flutter#38127)" (flutter/engine#38137) * b6daf3d [embedder] Consistent naming for GL/Metal tests (flutter/engine#38141) * 339d04b [web] Trivial fix for non-static interop JS interop class. (flutter/engine#38126) * 1fcbb9c [tools] Eliminate version on Obj-C docs (flutter/engine#38145) * 71928b6 [Impeller] Use DrawPath instead of Rect geometry when the paint style is stroke (flutter/engine#38146) * 23ce8fd Roll Skia from dd3285a80b23 to f84dc9303045 (4 revisions) (flutter/engine#38123) * 366f866 Roll Skia from f84dc9303045 to 2691cd7b4110 (40 revisions) (flutter/engine#38151) * 447e701 Roll Skia from 2691cd7b4110 to 711396b81248 (1 revision) (flutter/engine#38152) * cd5d91b Pylint testing/run_tests.py (flutter/engine#38016) * aafac08 Roll Skia from 711396b81248 to b253b10374e7 (7 revisions) (flutter/engine#38157) * 799dc78 Roll Fuchsia Linux SDK from xn8ztWtp-zww-jObz... to rRJIjuO-dPNCpCTd9... (flutter/engine#38134) * 3aa3d2a Massage the JS interop around `didCreateEngineInitializer` (flutter/engine#38147) * 030950f Roll Skia from b253b10374e7 to ec407902999b (3 revisions) (flutter/engine#38158)
This PR connects the text-input-view with text-input-test.cc
text-input-realmand substitute it with an RealmBuilder environmenttext-input-viewdoesn't implement aTextFieldthat displays text, it currently only validates that we are receiving throughonPlatformMessageand sending back the correct keystrokes