blob: 5296a2d9d8d1351fd151e811cfcbc67327e0a92a [file] [log] [blame]
// Copyright 2022 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.ui.test.input;
using fuchsia.math;
using zx;
/// A tool to inject touch events into Input Pipeline.
///
/// Please extend as necessary.
protocol TouchScreen {
/// Simulates a tap at the requested location.
SimulateTap(table {
/// Location of the tap event, in the coordinate units specified during
/// registration.
1: tap_location fuchsia.math.Vec;
}) -> ();
/// Simulates a swipe that starts at `start_location` and ends at `end_location`,
/// with a total number of move events equal to `move_event_count`.
///
/// The generated pointer event stream will be:
///
/// DOWN + CHANGE_1 + ... + CHANGE_n + UP, where n == `move_event_count`
///
/// Events are injected with no explicit delay in between; in other words, the
/// observed delay between successive events will be approximately equal to the
/// time required to inject a single event.
SimulateSwipe(table {
/// Starting location of the swipe, in the coordinate units specified during
/// registration.
1: start_location fuchsia.math.Vec;
/// End location of the swipe, in the coordinate units specified during
/// registration.
2: end_location fuchsia.math.Vec;
/// Number of move events in the swipe.
3: move_event_count uint32;
}) -> ();
};
/// A tool for applications to report touch input to interested parties (e.g. a test
/// fixture).
@discoverable
protocol TouchInputListener {
/// Report that component under test has received expected input.
ReportTouchInput(table {
/// The horizontal coordinate, in the reporter's coordinate system.
1: local_x float64;
/// The vertical coordinate, in the reporter's coordinate system.
2: local_y float64;
/// The monotonic time (ns) the pointer data was received by the reporter.
/// Note that this value should be used with caution. Some reporters may not be
/// capable of ns-level precision, but still report in ns-level units.
3: time_received zx.time;
/// The number of physical pixels, per logical pixel, as reported by the reporter.
4: device_pixel_ratio float64;
/// Name of the component to help distinguish responses from multiple components.
///
/// NOTE: This name is *independent* of component framework, so the reporter and
/// listener are free to agree on an arbitrary value.
5: component_name string:1024;
});
};