scanning

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

Documentation

Overview

Package scanning provides methods and constants commonly used for scanning.

Index

Constants

View Source
const (
	// ScannerName is the name of the virtual USB scanner.
	ScannerName = "DavieV Virtual USB Printer (USB)"

	// SourceImage is the image used to configure the virtual USB scanner.
	SourceImage = "scan_source.jpg"

	// Attributes is the path to the attributes used to configure the virtual
	// USB scanner.
	Attributes = "/usr/local/etc/virtual-usb-printer/ipp_attributes.json"
	// Descriptors is the path to the descriptors used to configure the virtual
	// USB scanner.
	Descriptors = "/usr/local/etc/virtual-usb-printer/ippusb_printer.json"
	// EsclCapabilities is the path to the capabilities used to configure the
	// virtual USB scanner.
	EsclCapabilities = "/usr/local/etc/virtual-usb-printer/escl_capabilities.json"

	// DefaultScanPattern is the pattern used to find files in the default
	// scan-to location.
	DefaultScanPattern = filesapp.MyFilesPath + "/scan*_*.*"

	// MMPerInch is the conversion factor from inches to mm.
	MMPerInch = 25.4
)

Variables

This section is empty.

Functions

func GetScan

func GetScan(pattern string) (string, error)

GetScan returns the filepath of the scanned file found using pattern.

func RemoveScans

func RemoveScans(pattern string) error

RemoveScans removes all of the scanned files found using pattern.

func RunAppSettingsTests

func RunAppSettingsTests(ctx context.Context, s *testing.State, cr *chrome.Chrome, testParams []TestingStruct, scannerParams ScannerStruct)

RunAppSettingsTests takes in the Chrome instance and the specific testing parameters and performs the test, including attaching the virtual USB printer, launching the scanapp, clicking through the settings, and verifying proper image output.

func RunHardwareTests

func RunHardwareTests(ctx context.Context, s *testing.State, cr *chrome.Chrome, scanner ScannerDescriptor)

RunHardwareTests tests that the scan app can select each of the options provided by `scanner`. This function is intended to be run on real hardware, not the virtual USB printer.

Types

type ScannerDescriptor

type ScannerDescriptor struct {
	ScannerName      string            `json:"Name"`
	SupportedSources []SupportedSource `json:"Sources"`
}

ScannerDescriptor contains the parameters used to test the scan app on real hardware.

type ScannerStruct

type ScannerStruct struct {
	Descriptors string
	Attributes  string
	EsclCaps    string
}

ScannerStruct contains the necessary parameters for setting up the virtual usb printer.

type SourceDimensions

type SourceDimensions struct {
	HeightMM float64 `json:"Height"`
	WidthMM  float64 `json:"Width"`
}

SourceDimensions contain the height and width of a scan source, in mm.

type SupportedSource

type SupportedSource struct {
	SourceType           scanapp.Source       `json:"SourceType"`
	SupportedColorModes  []scanapp.ColorMode  `json:"ColorModes"`
	SupportedPageSizes   []scanapp.PageSize   `json:"PageSizes"`
	SupportedResolutions []scanapp.Resolution `json:"Resolutions"`
	// SourceDimensions only needs to be present for flatbed sources. They can
	// be determined by running `lorgnette_cli get_json_caps --scanner=$SCANNER`
	// for any particular scanner. Note that the flatbed and ADF sources often
	// have different dimensions - make sure to choose the dimension of the
	// flatbed source.
	SourceDimensions SourceDimensions `json:"SourceDimensions"`
}

SupportedSource describes the options supported by a particular scan source.

type TestingStruct

type TestingStruct struct {
	Name       string
	Settings   scanapp.ScanSettings
	GoldenFile string
}

TestingStruct contains the parameters used when testing the scanapp settings in RunAppSettingsTests.

Jump to

Keyboard shortcuts

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