scanapp

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: 12 Imported by: 0

Documentation

Overview

Package scanapp supports controlling the Scan App on Chrome OS.

Index

Constants

This section is empty.

Variables

View Source
var WindowFinder *nodewith.Finder = nodewith.Name(apps.Scan.Name).ClassName("BrowserFrame").Role(role.Window)

WindowFinder is the finder for the ScanApp window.

Functions

This section is empty.

Types

type ColorMode

type ColorMode string

ColorMode defines a color mode option.

const (
	ColorModeBlackAndWhite ColorMode = "Black and white"
	ColorModeColor         ColorMode = "Color"
	ColorModeGrayscale     ColorMode = "Grayscale"
)

The available color mode options.

type DropdownName string

DropdownName defines the name of a dropdown.

const (
	DropdownNameScanner    DropdownName = "Scanner"
	DropdownNameSource     DropdownName = "Source"
	DropdownNameScanTo     DropdownName = "Scan to"
	DropdownNameFileType   DropdownName = "File type"
	DropdownNameColorMode  DropdownName = "Color"
	DropdownNamePageSize   DropdownName = "Page size"
	DropdownNameResolution DropdownName = "Resolution"
)

The names for each of the Scan app's dropdowns.

type FileType

type FileType string

FileType defines a file type option.

const (
	FileTypeJPG FileType = "JPG"
	FileTypePNG FileType = "PNG"
	FileTypePDF FileType = "PDF"
)

The available file type options.

type PageSize

type PageSize string

PageSize defines a page size option.

const (
	PageSizeA3            PageSize = "A3"
	PageSizeA4            PageSize = "A4"
	PageSizeB4            PageSize = "B4"
	PageSizeLegal         PageSize = "Legal"
	PageSizeLetter        PageSize = "Letter"
	PageSizeTabloid       PageSize = "Tabloid"
	PageSizeFitToScanArea PageSize = "Fit to scan area"
)

The available page size options.

type Resolution

type Resolution string

Resolution defines a resolution option.

const (
	Resolution75DPI   Resolution = "75 dpi"
	Resolution150DPI  Resolution = "150 dpi"
	Resolution200DPI  Resolution = "200 dpi"
	Resolution300DPI  Resolution = "300 dpi"
	Resolution600DPI  Resolution = "600 dpi"
	Resolution1200DPI Resolution = "1200 dpi"
)

The available resolution options.

func (Resolution) ToInt

func (r Resolution) ToInt() (int, error)

ToInt returns the integer representation of `r`.

type ScanApp

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

ScanApp represents an instance of the Scan App.

func Launch

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

Launch launches the Scan App and returns it. An error is returned if the app fails to launch.

func LaunchWithPollOpts

func LaunchWithPollOpts(ctx context.Context, opts testing.PollOptions, tconn *chrome.TestConn) (*ScanApp, error)

LaunchWithPollOpts is like Launch, above, but allows the user to specify the PollOptions for the uiauto connection.

func (*ScanApp) ClickDone

func (s *ScanApp) ClickDone() uiauto.Action

ClickDone returns a function that clicks the done button to return to the first page of the app.

func (*ScanApp) ClickMoreSettings

func (s *ScanApp) ClickMoreSettings() uiauto.Action

ClickMoreSettings returns a function that clicks the More settings button to expand or collapse the content.

func (*ScanApp) ClickMultiPageScanCheckbox

func (s *ScanApp) ClickMultiPageScanCheckbox() uiauto.Action

ClickMultiPageScanCheckbox returns a function that clicks the multi-page scan checkbox.

func (s *ScanApp) ClickMyFilesLink() uiauto.Action

ClickMyFilesLink returns a function that opens My files in the Files app by clicking the My files folder link.

func (*ScanApp) ClickSave

func (s *ScanApp) ClickSave() uiauto.Action

ClickSave returns a function that clicks the Save button to end a multi-page scan session.

func (*ScanApp) Close

func (s *ScanApp) Close(ctx context.Context) error

Close closes the Scan App. This is automatically done when Chrome resets and is not necessary to call.

func (*ScanApp) Exists

func (s *ScanApp) Exists(finder *nodewith.Finder) uiauto.Action

Exists calls ui.Exists scoping the finder to the Scan App.

func (*ScanApp) LeftClick

func (s *ScanApp) LeftClick(finder *nodewith.Finder) uiauto.Action

LeftClick calls ui.LeftClick scoping the finder to the Scan App.

func (*ScanApp) LeftClickUntil

func (s *ScanApp) LeftClickUntil(finder *nodewith.Finder, condition func(context.Context) error) uiauto.Action

LeftClickUntil calls ui.LeftClickUntil scoping the finder to the Scan App.

func (*ScanApp) MakeVisible

func (s *ScanApp) MakeVisible(finder *nodewith.Finder) uiauto.Action

MakeVisible calls ui.MakeVisible scoping the finder to the Scan App.

func (*ScanApp) MultiPageScan

func (s *ScanApp) MultiPageScan(PageNumber int) uiauto.Action

MultiPageScan returns a function that performs a multi-page scan by clicking the scan button.

func (*ScanApp) RemovePage

func (s *ScanApp) RemovePage() uiauto.Action

RemovePage returns a function that moves the mouse over the scan preview section and removes the current page in view.

func (*ScanApp) RescanPage

func (s *ScanApp) RescanPage() uiauto.Action

RescanPage returns a function that moves the mouse over the scan preview section and rescans the current page in view.

func (*ScanApp) Scan

func (s *ScanApp) Scan() uiauto.Action

Scan returns a function that performs a scan by clicking the scan button.

func (*ScanApp) SelectColorMode

func (s *ScanApp) SelectColorMode(colorMode ColorMode) uiauto.Action

SelectColorMode returns a function that interacts with the Scan app to select `colorMode` from the list of supported color modes.

func (*ScanApp) SelectFileType

func (s *ScanApp) SelectFileType(fileType FileType) uiauto.Action

SelectFileType returns a function that interacts with the Scan app to select `fileType` from the list of supported file types.

func (*ScanApp) SelectPageSize

func (s *ScanApp) SelectPageSize(pageSize PageSize) uiauto.Action

SelectPageSize returns a function that interacts with the Scan app to select `pageSize` from the list of supported page sizes.

func (*ScanApp) SelectResolution

func (s *ScanApp) SelectResolution(resolution Resolution) uiauto.Action

SelectResolution returns a function that interacts with the Scan app to select `resolution` from the list of supported resolutions.

func (*ScanApp) SelectScanner

func (s *ScanApp) SelectScanner(scanner string) uiauto.Action

SelectScanner returns a function that interacts with the Scan app to select `scanner` from the list of detected scanners.

func (*ScanApp) SelectSource

func (s *ScanApp) SelectSource(source Source) uiauto.Action

SelectSource returns a function that interacts with the Scan app to select `source` from the list of supported sources.

func (*ScanApp) SetScanSettings

func (s *ScanApp) SetScanSettings(settings ScanSettings) uiauto.Action

SetScanSettings returns a function that interacts with the Scan app to set the scan settings.

func (*ScanApp) WaitUntilExists

func (s *ScanApp) WaitUntilExists(finder *nodewith.Finder) uiauto.Action

WaitUntilExists calls ui.WaitUntilExists scoping the finder to the Scan App.

func (*ScanApp) WaitUntilGone

func (s *ScanApp) WaitUntilGone(finder *nodewith.Finder) uiauto.Action

WaitUntilGone calls ui.WaitUntilGone scoping the finder to the Scan App.

func (*ScanApp) WithTimeout

func (s *ScanApp) WithTimeout(timeout time.Duration) *ScanApp

WithTimeout returns a new ScanApp with the specified timeout. This does not launch the Scan App again.

type ScanSettings

type ScanSettings struct {
	Scanner    string
	Source     Source
	FileType   FileType
	ColorMode  ColorMode
	PageSize   PageSize
	Resolution Resolution
}

ScanSettings defines the settings to use to perform a scan.

type Source

type Source string

Source defines a source option.

const (
	SourceFlatbed     Source = "Flatbed"
	SourceADFOneSided Source = "Document Feeder (One-sided)"
	SourceADFTwoSided Source = "Document Feeder (Two-sided)"
)

The available source options.

Jump to

Keyboard shortcuts

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