File: 81_scanimage-perl.t

package info (click to toggle)
libimage-sane-perl 5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 324 kB
  • sloc: perl: 2,714; ansic: 5; makefile: 3
file content (42 lines) | stat: -rw-r--r-- 1,158 bytes parent folder | download | duplicates (2)
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
use warnings;
use strict;
use English;
use Test::More;
use Test::Requires qw( v5.10 );

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

if ( system("which scanimage > /dev/null 2> /dev/null") == 0 ) {
    plan tests => 6;
}
else {
    plan skip_all => 'scanimage not installed';
    exit;
}

my $scanimage_perl =
    'PERL5LIB="blib:blib/arch:lib:$PERL5LIB" '
  . "$EXECUTABLE_NAME examples/scanimage-perl";
my $identify = "; identify -format '%m %G %g %z-bit %r' out*.pnm; rm out*.pnm";

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

my @tests = (
    '--device=test > out.pnm' . $identify,
    '--device=test --test 2>&1',

    # Segfaults. Doesn't seem to be caused by Sane.xs
    # '--device=test --mode Color --test 2>&1',
    '--device=test --depth 1 --test 2>&1',
    '--device=test --batch-count=2 2>&1' . $identify,
    '--verbose --device=test --batch-count=2 2>&1' . $identify,
    '--verbose --device=test --source="Automatic Document Feeder" --batch 2>&1'
      . $identify,
);

for my $test (@tests) {
    my $output = `$scanimage_perl $test`;
    $output =~ s/scanimage-perl/scanimage/g;
    my $example = `scanimage --format=pnm $test`;
    is_deeply( $example, $output, $test );
}