File: Dg2PDF.t

package info (click to toggle)
sgf2dg 4.252-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 2,792 kB
  • sloc: perl: 7,475; ansic: 964; makefile: 147; sh: 59
file content (66 lines) | stat: -rw-r--r-- 1,919 bytes parent folder | download | duplicates (3)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/perl -w

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Games-Go-Dg2PDF.t'

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

use strict;
use IO::File;
use Test::More;
eval { require PDF::Create };
if ($@) {
    plan(skip_all => "PDF::Create not installed: $@");
}

plan (tests => 6);

use_ok('Games::Go::Sgf2Dg::Dg2PDF');
use_ok('Games::Go::Sgf2Dg::Diagram');


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

# 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.

my $diagram;
eval { $diagram = Games::Go::Sgf2Dg::Diagram->new(
                    hoshi             => ['ba', 'cd'],
                    black             => ['ab'],
                    white             => ['dd', 'cd'],
                    callback          => \&conflictCallback,
                    enable_overstones => 1,
                    overstone_eq_mark => 1); };
die "Can't create diagram: $@" if $@;

my $dg2pdf;

##
## create dg2pdf object:
##
eval { $dg2pdf = Games::Go::Sgf2Dg::Dg2PDF->new(
        doubleDigits => 0,
        coords       => 1,
        file         => '>test.pdf'); };
is( $@, '',                                     'new Dg2PDF object'  );
isa_ok( $dg2pdf, 'Games::Go::Sgf2Dg::Dg2PDF',           '   dg2pdf is the right class'  );

$dg2pdf->configure(boardSizeX => 5, boardSizeY => 5);
$dg2pdf->convertDiagram($diagram);
eval {$dg2pdf->comment(' comment')};
is( $@, '',                                     'added comment' );
$dg2pdf->comment(' and more comment');
is( $@, '',                                     'raw print' );

# since we rely on PDF::Create (which could change), we don't want
# to make our tests too specific.  But if the other converters pass,
# this one should be OK (unless PDF::Create has problems, of
# course).

##
## end of tests
##

__END__