Documentation ¶
Overview ¶
Package scanning provides methods and constants commonly used for scanning.
Index ¶
- Constants
- func GetScan(pattern string) (string, error)
- func RemoveScans(pattern string) error
- func RunAppSettingsTests(ctx context.Context, s *testing.State, cr *chrome.Chrome, ...)
- func RunHardwareTests(ctx context.Context, s *testing.State, cr *chrome.Chrome, ...)
- type ScannerDescriptor
- type ScannerStruct
- type SourceDimensions
- type SupportedSource
- type TestingStruct
Constants ¶
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 RemoveScans ¶
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 ¶
ScannerStruct contains the necessary parameters for setting up the virtual usb printer.
type SourceDimensions ¶
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.