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
|
# 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::Frontend::Sane');
use Gtk2;
}
#########################
# 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.
Glib::set_application_name('gscan2pdf');
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($WARN);
my $logger = Log::Log4perl::get_logger;
Gscan2pdf::Frontend::Sane->setup($logger);
Gscan2pdf::Frontend::Sane->open_device(
device_name => 'test',
finished_callback => sub {
Gscan2pdf::Frontend::Sane->scan_pages(
dir => '.',
format => 'out%d.pnm',
start => 1,
step => 1,
npages => 1,
finished_callback => sub {
is( -s 'out1.pnm', 30807, 'PNM created with expected size' );
Gtk2->main_quit;
}
);
}
);
Gtk2->main;
#########################
unlink 'out1.pnm';
Gscan2pdf::Frontend::Sane->quit();
|