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

« back to all changes in this revision

Viewing changes to t/1602_import_DjVu_with_error.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 File::Basename;    # Split filename into dir, file, ext
 
4
use Test::More tests => 1;
 
5
 
 
6
BEGIN {
 
7
    use Gscan2pdf::Document;
 
8
    use Gtk2 -init;    # Could just call init separately
 
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: test.jpg;c44 test.jpg test.djvu');
 
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
$slist->get_file_info(
 
28
    path              => 'test.djvu',
 
29
    finished_callback => sub {
 
30
        my ($info) = @_;
 
31
 
 
32
        $slist->import_file(
 
33
            info            => $info,
 
34
            first           => 1,
 
35
            last            => 1,
 
36
            queued_callback => sub {
 
37
 
 
38
                # inject error during import_file
 
39
                chmod 0500, $dir;    # no write access
 
40
            },
 
41
            error_callback => sub {
 
42
                ok( 1, 'import_file caught error injected in queue' );
 
43
                chmod 0700, $dir;    # allow write access
 
44
                Gtk2->main_quit;
 
45
            }
 
46
        );
 
47
    }
 
48
);
 
49
Gtk2->main;
 
50
 
 
51
#########################
 
52
 
 
53
unlink 'test.djvu', 'test.jpg', <$dir/*>;
 
54
rmdir $dir;
 
55
Gscan2pdf::Document->quit();