Documentation ¶
Overview ¶
Package pointer provides utility interfaces to handle pointing devices (i.e. mouse and touch screen).
Package pointer provides the access to the pointing device of the device, either of the mouse or the touch.
Index ¶
- func Click(ctx context.Context, c Controller, location coords.Point) error
- func Drag(ctx context.Context, c Controller, start, end coords.Point, ...) (err error)
- type Context
- type Controller
- type MouseContext
- func (mc *MouseContext) Click(finder *nodewith.Finder) uiauto.Action
- func (mc *MouseContext) ClickAt(loc coords.Point) uiauto.Action
- func (mc *MouseContext) Close() error
- func (mc *MouseContext) Drag(loc coords.Point, gestures ...uiauto.Action) uiauto.Action
- func (mc *MouseContext) DragTo(p coords.Point, duration time.Duration) uiauto.Action
- func (mc *MouseContext) DragToNode(f *nodewith.Finder, duration time.Duration) uiauto.Action
- func (mc *MouseContext) MenuClick(finder *nodewith.Finder) uiauto.Action
- type MouseController
- type TouchContext
- func (tc *TouchContext) Click(finder *nodewith.Finder) uiauto.Action
- func (tc *TouchContext) ClickAt(loc coords.Point) uiauto.Action
- func (tc *TouchContext) Close() error
- func (tc *TouchContext) Drag(loc coords.Point, gestures ...uiauto.Action) uiauto.Action
- func (tc *TouchContext) DragTo(loc coords.Point, duration time.Duration) uiauto.Action
- func (tc *TouchContext) DragToNode(f *nodewith.Finder, duration time.Duration) uiauto.Action
- func (tc *TouchContext) MenuClick(finder *nodewith.Finder) uiauto.Action
- type TouchController
- func (tc *TouchController) Close()
- func (tc *TouchController) EventWriter() *input.SingleTouchEventWriter
- func (tc *TouchController) Move(ctx context.Context, start, end coords.Point, duration time.Duration) error
- func (tc *TouchController) Press(ctx context.Context, location coords.Point) error
- func (tc *TouchController) Release(ctx context.Context) error
- func (tc *TouchController) TouchCoordConverter() *input.TouchCoordConverter
- func (tc *TouchController) Touchscreen() *input.TouchscreenEventWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context interface { // Close cleans up its internal resource. Close() error // Click returns a function to cause a click or a tap on the node. Click(finder *nodewith.Finder) uiauto.Action // ClickAt returns a function to cause a click or a tap on the specified // location. ClickAt(p coords.Point) uiauto.Action // MenuClick returns a function to cause a right-click or a long-press on the // node to cause the secondary behavior (i.e. opening context menu). MenuClick(finder *nodewith.Finder) uiauto.Action // Drag returns a function which initiates a dragging session, and conducts // the specified gestures. It ensures that the dragging session ends properly // at end. // Example: // // Start from p0, move to p1, and then move to p2. // pc.Drag(p0, pc.DragTo(p1, time.Second), pc.DragTo(p2, time.Second)) Drag(initLoc coords.Point, gestures ...uiauto.Action) uiauto.Action // DragTo returns a function to cause a drag to the specified location. DragTo(p coords.Point, duration time.Duration) uiauto.Action // DragToNode returns a function to cause a drag to the specified node. DragToNode(f *nodewith.Finder, duration time.Duration) uiauto.Action }
Context provides the interface to control a pointing device.
type Controller ¶
type Controller interface { // Press conducts an action to press at a location. Press(ctx context.Context, location coords.Point) error // Release cancels the press operation. Release(ctx context.Context) error // Move provides the movement event from start to end. Move(ctx context.Context, start, end coords.Point, duration time.Duration) error // Close closes the access to the underlying system and releases resources. Close() }
Controller provides the common interface to operate locations on screen, either by a mouse or the touch screen.
type MouseContext ¶
type MouseContext struct {
// contains filtered or unexported fields
}
MouseContext is a Context with the mouse.
func NewMouse ¶
func NewMouse(tconn *chrome.TestConn) *MouseContext
NewMouse creates a new instance of MouseContext.
func (*MouseContext) Click ¶
func (mc *MouseContext) Click(finder *nodewith.Finder) uiauto.Action
Click implements Context.Click.
func (*MouseContext) ClickAt ¶
func (mc *MouseContext) ClickAt(loc coords.Point) uiauto.Action
ClickAt implements Context.ClickAt.
func (*MouseContext) DragToNode ¶
DragToNode implements Context.DragToNode.
type MouseController ¶
type MouseController struct {
// contains filtered or unexported fields
}
MouseController implements Controller, conducted by a mouse.
func NewMouseController ¶
func NewMouseController(tconn *chrome.TestConn) *MouseController
NewMouseController creates a new MouseOperator.
func (*MouseController) Close ¶
func (mc *MouseController) Close()
Close implements Controller.Close.
func (*MouseController) Move ¶
func (mc *MouseController) Move(ctx context.Context, start, end coords.Point, duration time.Duration) error
Move implements Controller.Move.
type TouchContext ¶
type TouchContext struct {
// contains filtered or unexported fields
}
TouchContext is a Context with the touchscreen.
func (*TouchContext) Click ¶
func (tc *TouchContext) Click(finder *nodewith.Finder) uiauto.Action
Click implements Context.Click.
func (*TouchContext) ClickAt ¶
func (tc *TouchContext) ClickAt(loc coords.Point) uiauto.Action
ClickAt implements Context.ClickAt.
func (*TouchContext) DragToNode ¶
DragToNode implements COntext.DragToNode.
type TouchController ¶
type TouchController struct {
// contains filtered or unexported fields
}
TouchController implements Controller, conducted by a touch screen.
func NewTouchController ¶
NewTouchController creates a TouchController on a new TouchscreenEventWriter.
func (*TouchController) Close ¶
func (tc *TouchController) Close()
Close implements Controller.Close.
func (*TouchController) EventWriter ¶
func (tc *TouchController) EventWriter() *input.SingleTouchEventWriter
EventWriter returns the current single touch event writer for this controller.
func (*TouchController) Move ¶
func (tc *TouchController) Move(ctx context.Context, start, end coords.Point, duration time.Duration) error
Move implements Controller.Move.
func (*TouchController) Release ¶
func (tc *TouchController) Release(ctx context.Context) error
Release implements Controller.Release.
func (*TouchController) TouchCoordConverter ¶
func (tc *TouchController) TouchCoordConverter() *input.TouchCoordConverter
TouchCoordConverter returns the current TouchCoordConverter for this controller.
func (*TouchController) Touchscreen ¶
func (tc *TouchController) Touchscreen() *input.TouchscreenEventWriter
Touchscreen returns the touchscreen for this controller.