~ubuntu-branches/ubuntu/vivid/gscan2pdf/vivid

« back to all changes in this revision

Viewing changes to t/168_import_multiple_images.t

  • Committer: Package Import Robot
  • Author(s): Jeffrey Ratcliffe
  • Date: 2015-01-30 21:49:19 UTC
  • mfrom: (1.1.23) (4.2.24 sid)
  • Revision ID: package-import@ubuntu.com-20150130214919-yhligsglhd84gsdo
Tags: 1.3.0-1
New upstream release
Closes: #774099
(avoid leading and trailing blanks in expanded filename template)
Closes: #774103 (fixes for date offset calculation)
Closes: #710428
(Add "Found ocropus" to log information on application start)
Closes: #774093 (various consistency updates for dialogs)
Closes: #774094 (misc. improvements for OCR'ed texts)
Closes: #774097 (when saving as DjVU, use MetaData)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use warnings;
 
2
use strict;
 
3
use Test::More tests => 1;
 
4
 
 
5
BEGIN {
 
6
    use Gscan2pdf::Document;
 
7
    use Gtk2 -init;    # Could just call init separately
 
8
    use File::Copy;
 
9
}
 
10
 
 
11
#########################
 
12
 
 
13
use Log::Log4perl qw(:easy);
 
14
Log::Log4perl->easy_init($WARN);
 
15
my $logger = Log::Log4perl::get_logger;
 
16
Gscan2pdf::Document->setup($logger);
 
17
 
 
18
# Create test image
 
19
system('convert rose: 1.tif');
 
20
 
 
21
my $slist = Gscan2pdf::Document->new;
 
22
 
 
23
# dir for temporary files
 
24
my $dir = File::Temp->newdir;
 
25
$slist->set_dir($dir);
 
26
 
 
27
for my $i ( 1 .. 10 ) {
 
28
    copy( '1.tif', "$i.tif" ) if ( $i > 1 );
 
29
    $slist->get_file_info(
 
30
        path              => "$i.tif",
 
31
        finished_callback => sub {
 
32
            my ($info) = @_;
 
33
            $slist->import_file(
 
34
                info              => $info,
 
35
                first             => 1,
 
36
                last              => 1,
 
37
                finished_callback => sub {
 
38
                    Gtk2->main_quit if ( $i == 10 );
 
39
                }
 
40
            );
 
41
        }
 
42
    );
 
43
}
 
44
Gtk2->main;
 
45
 
 
46
is( $#{ $slist->{data} }, 9, 'Imported 10 images' );
 
47
 
 
48
#########################
 
49
 
 
50
for my $i ( 1 .. 10 ) {
 
51
    unlink "$i.tif";
 
52
}
 
53
Gscan2pdf::Document->quit();