This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Add test view for touch-input-test #36879
Merged
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
0e849b6
Port over C++ files for the one-flutter test in fuchsia.git
lin-erik 6be9d5a
Licensing
lin-erik 52118ae
Merge branch 'main' into one-flutter
lin-erik c03863d
Remove unused used parameter
lin-erik a4308bb
Begin UI port
lin-erik 3732720
WIP one-flutter UI
lin-erik 29cd67b
Lint
lin-erik ee8d516
Lint GN files
lin-erik 36e1b63
Remove whitespaces
lin-erik a31ed77
Merge branch 'main' into one-flutter
lin-erik 0bf3bd3
Tests now pass
lin-erik b41ce82
Minor refactor
lin-erik ef7b63f
Add comments
lin-erik 9177c50
Lint
lin-erik fc1b686
Merge branch 'main' into one-flutter
lin-erik 643648a
Update run_integration_test.sh
lin-erik 867b0ef
Add README
lin-erik 52fe0d3
Update log wording
lin-erik 2143319
Remove go link
lin-erik 6deb10b
Update README
lin-erik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add README
- Loading branch information
commit 867b0eff51821db1feed382d10746a1d694f708c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
shell/platform/fuchsia/flutter/tests/integration/touch-input/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # touch-input | ||
|
|
||
| `touch-input-test` exercises touch through a child view (in this case, the `touch-input-view` Dart component) and asserting | ||
| the precise location of the touch event. We do this by attaching the child view, injecting touch, and validating that the view | ||
| reports the touch event back with the correct coordinates. | ||
|
|
||
| ```shell | ||
| Injecting the tap event | ||
| [touch-input-test.cm] INFO: [portable_ui_test.cc(193)] Injecting tap at (-500, -500) | ||
|
|
||
| View receives the event | ||
| [flutter_jit_runner] INFO: touch-input-view.cm(flutter): touch-input-view received tap: PointerData(embedderId: 0, timeStamp: 0:01:03.623259, | ||
| change: PointerChange.add, kind: PointerDeviceKind.touch, signalKind: PointerSignalKind.none, device: -4294967295, pointerIdentifier: 0, | ||
| physicalX: 319.99998331069946, physicalY: 199.99999284744263, physicalDeltaX: 0.0, physicalDeltaY: 0.0, buttons: 0, synthesized: false, | ||
| pressure: 0.0, pressureMin: 0.0, pressureMax: 0.0, distance: 0.0, distanceMax: 0.0, size: 0.0, radiusMajor: 0.0, radiusMinor: 0.0, | ||
| radiusMin: 0.0, radiusMax: 0.0, orientation: 0.0, tilt: 0.0, platformData: 0, scrollDeltaX: 0.0, scrollDeltaY: 0.0, panX: 0.0, panY: 0.0, | ||
| panDeltaX: 0.0, panDeltaY: 0.0, scale: 0.0, rotation: 0.0) | ||
|
|
||
| Successfully received response from view | ||
| [touch-input-test.cm] INFO: [touch-input-test.cc(162)] Received ReportTouchInput event | ||
| [touch-input-test.cm] INFO: [touch-input-test.cc(255)] Expecting event for component touch-input-view at (320, 200) | ||
| [touch-input-test.cm] INFO: [touch-input-test.cc(257)] Received event for component touch-input-view at (320, 200), accounting for pixel scale of 1 | ||
| ``` | ||
|
|
||
| Some interesting details (thanks to abrusher@): | ||
|
|
||
| There exists two coordinate spaces within our testing realm. The first is `touch-input-view`'s "logical" coordinate space. This | ||
| is determined based on `touch-input-view`'s size and is the space in which it sees incoming events. The second is the "injector" | ||
| coordinate space, which spans [-1000, 1000] on both axes. | ||
|
|
||
| The size/position of a view doesn't always match the bounds of a display exactly. As a result, Scenic has a separate coordinate space | ||
| to specify the location at which to inject a touch event. This is always fixed to the display bounds. Scenic knows how to map this | ||
| coordinate space onto the client view's space. | ||
|
|
||
| For example, if we inject at (-500, -500) `touch-input-view` will see a touch event at the middle of the upper-left quadrant of the screen. | ||
|
|
||
| ## Running the Test | ||
| Start a Fuchsia package server | ||
| ```shell | ||
| cd "$FUCHSIA_DIR" | ||
| fx serve | ||
| ``` | ||
|
|
||
| Start the Fuchsia emulator in a graphical environment (go/crd) | ||
| ```shell | ||
| ffx emu start | ||
| ``` | ||
|
|
||
| Run the integration test | ||
| ```shell | ||
| $ENGINE_DIR/flutter/tools/fuchsia/devshell/run_integration_test.sh touch-input --no-lto --skip-fuchsia-emu | ||
| ``` | ||
|
|
||
| ## Playing around with `touch-input-view` | ||
|
|
||
| This requires `tiles-session` (//src/session/examples/tiles-session), a simple graphical session with basic window management functionality. | ||
|
|
||
| Build Fuchsia with `tiles-session` in the GN build args | ||
| ```shell | ||
| fx set workstation_eng.qemu-x64 --with //src/session/examples/tiles-session --with-base=//src/session/bin/session_manager && fx build | ||
| ``` | ||
|
|
||
| Build flutter/engine | ||
| ```shell | ||
| $ENGINE_DIR/flutter/tools/gn --fuchsia --no-lto && ninja -C $ENGINE_DIR/out/fuchsia_debug_x64 flutter/shell/platform/fuchsia/flutter/tests/ | ||
| integration/touch_input:tests | ||
| ``` | ||
|
|
||
| Publish `touch-input-view` | ||
| ```shell | ||
| $FUCHSIA_DIR/.jiri_root/bin/fx pm publish -a -repo $FUCHSIA_DIR/$(cat $FUCHSIA_DIR/.fx-build-dir)/amber-files -f $ENGINE_DIR/out/ | ||
| fuchsia_debug_x64/gen/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/touch-input-view/touch-input-view/touch-input-view.far | ||
| ``` | ||
|
|
||
| Launch Fuchsia emulator in a graphical environment (go/crd) | ||
| ```shell | ||
| ffx emu start | ||
| ``` | ||
|
|
||
| Launch `tiles-session` | ||
| ```shell | ||
| ffx session launch fuchsia-pkg://fuchsia.com/tiles-session#meta/tiles-session.cm | ||
| ``` | ||
|
|
||
| Add `touch-input-view` | ||
| ```shell | ||
| ffx session add fuchsia-pkg://fuchsia.com/touch-input-view#meta/touch-input-view.cm | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.