File: 173_open_multiple_session.t

package info (click to toggle)
gscan2pdf 2.13.5-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,700 kB
  • sloc: perl: 22,713; xml: 81; makefile: 6
file content (43 lines) | stat: -rw-r--r-- 1,151 bytes parent folder | download | duplicates (4)
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
use warnings;
use strict;
use File::Basename;    # Split filename into dir, file, ext
use IPC::System::Simple qw(capture);
use Test::More tests => 2;

BEGIN {
    use Gscan2pdf::Document;
    use Gtk3 -init;    # Could just call init separately
}

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

Gscan2pdf::Translation::set_domain('gscan2pdf');
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($WARN);

Gscan2pdf::Document->setup(Log::Log4perl::get_logger);
my $slist = Gscan2pdf::Document->new;

# use fixed name in temporary directory to be able to pick it up as a crashed
# session in the next test
$slist->set_dir( File::Spec->catfile( File::Spec->tmpdir, 'gscan2pdf-tmp' ) );
$slist->open_session_file( info => 'test2.gs2p' );

# allow up to pick it up as a crashed session in next test
$slist->save_session;

like(
    capture( 'file', $slist->{data}[0][2]{filename} ),
    qr/PNG image data, 70 x 46, 8-bit\/color RGB, non-interlaced/,
    'PNG extracted with expected size'
);
is(
    $slist->{data}[0][2]->export_text,
    'The quick brown fox',
    'Basic OCR output extracted'
);

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

unlink 'test2.gs2p';
Gscan2pdf::Document->quit;