1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
use warnings;
use strict;
use Test::More tests => 3;
use Sane 0.05; # For enums
BEGIN { use_ok('Gscan2pdf::Scanner::Options') }
#########################
my $filename = 'scanners/Brother_MFC_5100c';
my $output = do { local ( @ARGV, $/ ) = $filename; <> };
my $options = Gscan2pdf::Scanner::Options->new_from_data($output);
my @that = (
{
'index' => 0,
},
{
title => 'Mode',
'index' => 1,
type => SANE_TYPE_GROUP,
'cap' => 0,
'max_values' => 0,
'name' => '',
'unit' => SANE_UNIT_NONE,
'desc' => '',
type => SANE_TYPE_GROUP,
'constraint_type' => SANE_CONSTRAINT_NONE
},
{
name => 'mode',
title => 'Mode',
index => 2,
'desc' => 'Select the scan mode',
'val' => '24bit Color',
'constraint' => [
'Black & White',
'Gray[Error Diffusion]',
'True Gray',
'24bit Color',
],
constraint_type => SANE_CONSTRAINT_STRING_LIST,
'unit' => SANE_UNIT_NONE,
type => SANE_TYPE_STRING,
'cap' => SANE_CAP_SOFT_DETECT + SANE_CAP_SOFT_SELECT,
'max_values' => 1,
},
{
name => 'resolution',
title => 'Resolution',
index => 3,
'desc' => 'Sets the resolution of the scanned image.',
'val' => '200',
'constraint' => [
'100', '150', '200', '300', '400', '600',
'1200', '2400', '4800', '9600'
],
'unit' => SANE_UNIT_DPI,
constraint_type => SANE_CONSTRAINT_WORD_LIST,
type => SANE_TYPE_INT,
'cap' => SANE_CAP_SOFT_DETECT + SANE_CAP_SOFT_SELECT,
'max_values' => 1,
},
{
name => 'source',
title => 'Source',
index => 4,
'desc' => 'Selects the scan source (such as a document-feeder).',
'val' => 'Automatic Document Feeder',
'constraint' => [ 'FlatBed', 'Automatic Document Feeder' ],
'unit' => SANE_UNIT_NONE,
constraint_type => SANE_CONSTRAINT_STRING_LIST,
type => SANE_TYPE_STRING,
'cap' => SANE_CAP_SOFT_DETECT + SANE_CAP_SOFT_SELECT,
'max_values' => 1,
},
{
name => 'brightness',
title => 'Brightness',
index => 5,
'desc' => 'Controls the brightness of the acquired image.',
constraint => {
'min' => -50,
'max' => 50,
'quant' => 1,
},
'unit' => SANE_UNIT_PERCENT,
constraint_type => SANE_CONSTRAINT_RANGE,
type => SANE_TYPE_INT,
'cap' => SANE_CAP_SOFT_DETECT +
SANE_CAP_SOFT_SELECT +
SANE_CAP_INACTIVE,
'max_values' => 1,
},
{
name => 'contrast',
title => 'Contrast',
index => 6,
'desc' => 'Controls the contrast of the acquired image.',
constraint => {
'min' => -50,
'max' => 50,
'quant' => 1,
},
'unit' => SANE_UNIT_PERCENT,
constraint_type => SANE_CONSTRAINT_RANGE,
type => SANE_TYPE_INT,
'cap' => SANE_CAP_SOFT_DETECT +
SANE_CAP_SOFT_SELECT +
SANE_CAP_INACTIVE,
'max_values' => 1,
},
{
index => 7,
title => 'Geometry',
'cap' => 0,
'max_values' => 0,
'name' => '',
'unit' => SANE_UNIT_NONE,
'desc' => '',
type => SANE_TYPE_GROUP,
'constraint_type' => SANE_CONSTRAINT_NONE
},
{
name => 'l',
title => 'Top-left x',
index => 8,
'desc' => 'Top-left x position of scan area.',
'val' => 0,
constraint => {
'min' => 0,
'max' => 208,
'quant' => 0.0999908,
},
constraint_type => SANE_CONSTRAINT_RANGE,
'unit' => SANE_UNIT_MM,
type => SANE_TYPE_FIXED,
'cap' => SANE_CAP_SOFT_DETECT + SANE_CAP_SOFT_SELECT,
'max_values' => 1,
},
{
name => 't',
title => 'Top-left y',
index => 9,
'desc' => 'Top-left y position of scan area.',
'val' => 0,
constraint => {
'min' => 0,
'max' => 355.6,
'quant' => 0.0999908,
},
constraint_type => SANE_CONSTRAINT_RANGE,
'unit' => SANE_UNIT_MM,
type => SANE_TYPE_FIXED,
'cap' => SANE_CAP_SOFT_DETECT + SANE_CAP_SOFT_SELECT,
'max_values' => 1,
},
{
name => 'x',
title => 'Width',
index => 10,
'desc' => 'Width of scan-area.',
'val' => 207.981,
constraint => {
'min' => 0,
'max' => 208,
'quant' => 0.0999908,
},
constraint_type => SANE_CONSTRAINT_RANGE,
'unit' => SANE_UNIT_MM,
type => SANE_TYPE_FIXED,
'cap' => SANE_CAP_SOFT_DETECT + SANE_CAP_SOFT_SELECT,
'max_values' => 1,
},
{
name => 'y',
title => 'Height',
index => 11,
'desc' => 'Height of scan-area.',
'val' => 296.973,
constraint => {
'min' => 0,
'max' => 355.6,
'quant' => 0.0999908,
},
constraint_type => SANE_CONSTRAINT_RANGE,
'unit' => SANE_UNIT_MM,
type => SANE_TYPE_FIXED,
'cap' => SANE_CAP_SOFT_DETECT + SANE_CAP_SOFT_SELECT,
'max_values' => 1,
}
);
is_deeply( $options->{array}, \@that, 'Brother_MFC_5100c' );
is( Gscan2pdf::Scanner::Options->device, 'brother:bus1;dev2', 'device name' );
|