pointer

package
v0.0.0-...-9474aff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Click

func Click(ctx context.Context, c Controller, location coords.Point) error

Click provides an action of press and release at the location, i.e. a mouse click or a tap of touch screen.

func Drag

func Drag(ctx context.Context, c Controller, start, end coords.Point, duration time.Duration) (err error)

Drag provides a drag action from start to the end.

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) Close

func (mc *MouseContext) Close() error

Close implements Context.Close.

func (*MouseContext) Drag

func (mc *MouseContext) Drag(loc coords.Point, gestures ...uiauto.Action) uiauto.Action

Drag implements Context.Drag.

func (*MouseContext) DragTo

func (mc *MouseContext) DragTo(p coords.Point, duration time.Duration) uiauto.Action

DragTo implements Context.DragTo.

func (*MouseContext) DragToNode

func (mc *MouseContext) DragToNode(f *nodewith.Finder, duration time.Duration) uiauto.Action

DragToNode implements Context.DragToNode.

func (*MouseContext) MenuClick

func (mc *MouseContext) MenuClick(finder *nodewith.Finder) uiauto.Action

MenuClick implements Context.MenuClick.

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.

func (*MouseController) Press

func (mc *MouseController) Press(ctx context.Context, location coords.Point) error

Press implements Controller.Press.

func (*MouseController) Release

func (mc *MouseController) Release(ctx context.Context) error

Release implements Controller.Release.

type TouchContext

type TouchContext struct {
	// contains filtered or unexported fields
}

TouchContext is a Context with the touchscreen.

func NewTouch

func NewTouch(ctx context.Context, tconn *chrome.TestConn) (*TouchContext, error)

NewTouch creates a new TouchContext instance.

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) Close

func (tc *TouchContext) Close() error

Close implements Context.Close.

func (*TouchContext) Drag

func (tc *TouchContext) Drag(loc coords.Point, gestures ...uiauto.Action) uiauto.Action

Drag implements Context.Drag.

func (*TouchContext) DragTo

func (tc *TouchContext) DragTo(loc coords.Point, duration time.Duration) uiauto.Action

DragTo implements Context.DragTo.

func (*TouchContext) DragToNode

func (tc *TouchContext) DragToNode(f *nodewith.Finder, duration time.Duration) uiauto.Action

DragToNode implements COntext.DragToNode.

func (*TouchContext) MenuClick

func (tc *TouchContext) MenuClick(finder *nodewith.Finder) uiauto.Action

MenuClick implements Context.MenuClick.

type TouchController

type TouchController struct {
	// contains filtered or unexported fields
}

TouchController implements Controller, conducted by a touch screen.

func NewTouchController

func NewTouchController(ctx context.Context, tconn *chrome.TestConn) (*TouchController, error)

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) Press

func (tc *TouchController) Press(ctx context.Context, location coords.Point) error

Press implements Controller.Press.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL