~jeffreyratcliffe/gscan2pdf/gscan2pdf

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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Gscan2pdf.t'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

use warnings;
use strict;
use Test::More tests => 2;
BEGIN { use_ok('Gscan2pdf::Scanner::Options') }

#########################

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

my $filename = 'scanners/snapscan';
my $output   = do { local ( @ARGV, $/ ) = $filename; <> };
my $options  = Gscan2pdf::Scanner::Options->new_from_data($output);
my @that     = (
 {
  name      => 'resolution',
  index     => 0,
  'tip'     => 'Sets the resolution of the scanned image.',
  'default' => '300',
  'values'  => [ 'auto', '50', '75', '100', '150', '200', '300', '450', '600' ],
  'unit'    => 'dpi',
 },
 {
  name      => 'preview',
  index     => 1,
  'tip'     => 'Request a preview-quality scan.',
  'default' => 'no',
  'values'  => [ 'auto', 'yes', 'no' ]
 },
 {
  name      => 'mode',
  index     => 2,
  'tip'     => 'Selects the scan mode (e.g., lineart, monochrome, or color).',
  'default' => 'Color',
  'values'  => [ 'auto', 'Color', 'Halftone', 'Gray', 'Lineart' ]
 },
 {
  name  => 'preview-mode',
  index => 3,
  'tip' =>
'Select the mode for previews. Greyscale previews usually give the best combination of speed and detail.',
  'default' => 'Auto',
  'values'  => [ 'auto', 'Auto', 'Color', 'Halftone', 'Gray', 'Lineart' ]
 },
 {
  name      => 'high-quality',
  index     => 4,
  'tip'     => 'Highest quality but lower speed',
  'default' => 'no',
  'values'  => [ 'auto', 'yes', 'no' ]
 },
 {
  name      => 'source',
  index     => 5,
  'tip'     => 'Selects the scan source (such as a document-feeder).',
  'default' => 'inactive',
  'values'  => [ 'auto', 'Flatbed' ]
 },
 {
  name       => 'l',
  index      => 6,
  'tip'      => 'Top-left x position of scan area.',
  'default'  => 0,
  constraint => {
   'min' => 0,
   'max' => 216,
  },
  'unit' => 'mm',
 },
 {
  name       => 't',
  index      => 7,
  'tip'      => 'Top-left y position of scan area.',
  'default'  => 0,
  constraint => {
   'min' => 0,
   'max' => 297,
  },
  'unit' => 'mm',
 },
 {
  name       => 'x',
  index      => 8,
  'tip'      => 'Width of scan-area.',
  'default'  => 216,
  constraint => {
   'min' => 0,
   'max' => 216,
  },
  'unit' => 'mm',
 },
 {
  name       => 'y',
  index      => 9,
  'tip'      => 'Height of scan-area.',
  'default'  => 297,
  constraint => {
   'min' => 0,
   'max' => 297,
  },
  'unit' => 'mm',
 },
 {
  name  => 'predef-window',
  index => 10,
  'tip' =>
'Provides standard scanning areas for photographs, printed pages and the like.',
  'default' => 'None',
  'values'  => [ 'None', '6x4 (inch)', '8x10 (inch)', '8.5x11 (inch)' ]
 },
 {
  name  => 'depth',
  index => 11,
  'tip' =>
'Number of bits per sample, typical values are 1 for "line-art" and 8 for multibit scans.',
  'default' => 'inactive',
  'values'  => ['8'],
  'unit'    => 'bit',
 },
 {
  name      => 'quality-cal',
  index     => 12,
  'tip'     => 'Do a quality white-calibration',
  'default' => 'yes',
  'values'  => [ 'yes', 'no' ]
 },
 {
  name  => 'halftoning',
  index => 13,
  'tip' => 'Selects whether the acquired image should be halftoned (dithered).',
  'default' => 'inactive',
  'values'  => [ 'yes', 'no' ]
 },
 {
  name  => 'halftone-pattern',
  index => 14,
  'tip' =>
    'Defines the halftoning (dithering) pattern for scanning halftoned images.',
  'default' => 'inactive',
  'values'  => [ 'DispersedDot8x8', 'DispersedDot16x16' ]
 },
 {
  name  => 'custom-gamma',
  index => 15,
  'tip' =>
    'Determines whether a builtin or a custom gamma-table should be used.',
  'default' => 'no',
  'values'  => [ 'yes', 'no' ]
 },
 {
  name      => 'analog-gamma-bind',
  index     => 16,
  'tip'     => 'In RGB-mode use same values for each color',
  'default' => 'no',
  'values'  => [ 'yes', 'no' ]
 },
 {
  name       => 'analog-gamma',
  index      => 17,
  'tip'      => 'Analog gamma-correction',
  'default'  => 'inactive',
  constraint => {
   'min' => 0,
   'max' => 4,
  },
 },
 {
  name       => 'analog-gamma-r',
  index      => 18,
  'tip'      => 'Analog gamma-correction for red',
  'default'  => '1.79999',
  constraint => {
   'min' => 0,
   'max' => 4,
  },
 },
 {
  name       => 'analog-gamma-g',
  index      => 19,
  'tip'      => 'Analog gamma-correction for green',
  'default'  => '1.79999',
  constraint => {
   'min' => 0,
   'max' => 4,
  },
 },
 {
  name       => 'analog-gamma-b',
  index      => 20,
  'tip'      => 'Analog gamma-correction for blue',
  'default'  => '1.79999',
  constraint => {
   'min' => 0,
   'max' => 4,
  },
 },
 {
  name  => 'gamma-table',
  index => 21,
  'tip' =>
'Gamma-correction table.  In color mode this option equally affects the red, green, and blue channels simultaneously (i.e., it is an intensity gamma table).',
  'default'  => 'inactive',
  constraint => {
   'min'  => 0,
   'max'  => 65535,
   'step' => 1,
  },
 },
 {
  name       => 'red-gamma-table',
  index      => 22,
  'tip'      => 'Gamma-correction table for the red band.',
  'default'  => 'inactive',
  constraint => {
   'min'  => 0,
   'max'  => 65535,
   'step' => 1,
  },
 },
 {
  name       => 'green-gamma-table',
  index      => 23,
  'tip'      => 'Gamma-correction table for the green band.',
  'default'  => 'inactive',
  constraint => {
   'min'  => 0,
   'max'  => 65535,
   'step' => 1,
  },
 },
 {
  name       => 'blue-gamma-table',
  index      => 24,
  'tip'      => 'Gamma-correction table for the blue band.',
  'default'  => 'inactive',
  constraint => {
   'min'  => 0,
   'max'  => 65535,
   'step' => 1,
  },
 },
 {
  name      => 'negative',
  index     => 25,
  'tip'     => 'Swap black and white',
  'default' => 'inactive',
  'values'  => [ 'auto', 'yes', 'no' ]
 },
 {
  name       => 'threshold',
  index      => 26,
  'tip'      => 'Select minimum-brightness to get a white point',
  'default'  => 'inactive',
  constraint => {
   'min'  => 0,
   'max'  => 100,
   'step' => 1,
  },
  'unit' => '%',
 },
 {
  name       => 'brightness',
  index      => 27,
  'tip'      => 'Controls the brightness of the acquired image.',
  'default'  => '0',
  constraint => {
   'min'  => -400,
   'max'  => 400,
   'step' => 1,
  },
  'unit' => '%',
 },
 {
  name       => 'contrast',
  index      => 28,
  'tip'      => 'Controls the contrast of the acquired image.',
  'default'  => '0',
  constraint => {
   'min'  => -100,
   'max'  => 400,
   'step' => 1,
  },
  'unit' => '%',
 },
 {
  name  => 'rgb-lpr',
  index => 29,
  'tip' =>
'Number of scan lines to request in a SCSI read. Changing this parameter allows you to tune the speed at which data is read from the scanner during scans. If this is set too low, the scanner will have to stop periodically in the middle of a scan; if it\'s set too high, X-based frontends may stop responding to X events and your system could bog down.',
  'default'  => '4',
  constraint => {
   'min'  => 1,
   'max'  => 50,
   'step' => 1,
  },
 },
 {
  name  => 'gs-lpr',
  index => 30,
  'tip' =>
'Number of scan lines to request in a SCSI read. Changing this parameter allows you to tune the speed at which data is read from the scanner during scans. If this is set too low, the scanner will have to stop periodically in the middle of a scan; if it\'s set too high, X-based frontends may stop responding to X events and your system could bog down.',
  'default'  => 'inactive',
  constraint => {
   'min'  => 1,
   'max'  => 50,
   'step' => 1,
  },
 },
);
is_deeply( $options->{array}, \@that, 'snapscan' );