touch

package
v0.0.0-...-683b059 Latest Latest
Warning

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

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

Documentation

Overview

Package touch provides the uiauto actions to control the touchscreen.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTouchscreenAndConverter

func NewTouchscreenAndConverter(ctx context.Context, tconn *chrome.TestConn) (*input.TouchscreenEventWriter, *input.TouchCoordConverter, error)

NewTouchscreenAndConverter is a utility to create a new touchscreen event writer and its touch coord converter with checking the display bounds.

Types

type Context

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

Context provides the interface to the touchscreen.

func New

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

New creates a new instance of Context.

func (*Context) Close

func (tc *Context) Close() error

Close closes the access to the touch screen.

func (*Context) Hold

func (tc *Context) Hold(duration time.Duration) uiauto.Action

Hold returns a function to hold the touch for the specified duration. This can only be used within Swipe method.

func (*Context) LongPress

func (tc *Context) LongPress(finder *nodewith.Finder) uiauto.Action

LongPress returns a function that causes a long press at the node through the touchscreen.

func (*Context) Swipe

func (tc *Context) Swipe(loc coords.Point, gestures ...uiauto.Action) uiauto.Action

Swipe returns a function to initiate the single-touch gesture, and conducts the specified gesture actions. The gesture starts from the specified location. Examples:

// swipe from a location to another in a second.
tc.Swipe(start, tc.SwipeTo(end, time.Second))

// Longpress and swipe.
tc.Swipe(start, tc.Hold(time.Second), tc.SwipeTo(end, time.Second))

// Multiple points.
tc.Swipe(points[0], tc.SwipeTo(points[1], time.Second), tc.SwipeTo(points[2], time.Second))

// Combine with other actions; swipe and then wait for a UI change.
tc.Swipe(start, tc.SwipeTo(end, time.Second), ac.WaitUntilExists(node))

func (*Context) SwipeTo

func (tc *Context) SwipeTo(p coords.Point, duration time.Duration) uiauto.Action

SwipeTo returns a function to swipe to the target location in the duration. This can only be used within Swipe method.

func (*Context) SwipeToNode

func (tc *Context) SwipeToNode(f *nodewith.Finder, duration time.Duration) uiauto.Action

SwipeToNode returns a function to swipe to the target node in the duration. This can only be used within Swipe method.

func (*Context) Tap

func (tc *Context) Tap(finder *nodewith.Finder) uiauto.Action

Tap returns a function that causes a tap the node through the touchscreen.

func (*Context) TapAt

func (tc *Context) TapAt(loc coords.Point) uiauto.Action

TapAt returns a function that causes a tap on the specified location.

func (*Context) WithInterval

func (tc *Context) WithInterval(interval time.Duration) *Context

WithInterval returns a new Context with the specified polling interval.

func (*Context) WithPollOpts

func (tc *Context) WithPollOpts(pollOpts testing.PollOptions) *Context

WithPollOpts returns a new Context with the specified polling options.

func (*Context) WithTimeout

func (tc *Context) WithTimeout(timeout time.Duration) *Context

WithTimeout returns a new Context with the specified timeout.

Jump to

Keyboard shortcuts

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