forked from Koha-Community/Koha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLabels.t
65 lines (57 loc) · 2.27 KB
/
Labels.t
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
#!/usr/bin/perl
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
#
# for context, see http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=2691
use strict;
use warnings;
use Test::More tests => 11;
BEGIN {
use_ok('C4::Labels::Label');
}
my $format_string = "title, callnumber";
my $parsed_fields = C4::Labels::Label::_get_text_fields($format_string);
my $expected_fields = [
{ code => 'title', desc => 'title' },
{ code => 'itemcallnumber', desc => 'itemcallnumber' },
];
is_deeply($parsed_fields, $expected_fields, '"callnumber" in label layout alias for "itemcallnumber" per bug 5653');
is(C4::Labels::Label::_check_params(),"0",'test checking parameters');
my ($llx,$lly,$width,$height) = ( 0, 0, 10, 10 );
ok(!defined C4::Labels::Label::_guide_box(),
"Test guide box with undefined parameters returns undef");
ok(!defined C4::Labels::Label::_guide_box(undef,$lly,$width,$height),
"Test guide box with undefined 'x' coordinate returns undef");
ok(!defined C4::Labels::Label::_guide_box($llx,undef,$width,$height),
"Test guide box with undefined 'y' coordinate returns undef");
ok(!defined C4::Labels::Label::_guide_box($llx,$lly,undef,$height),
"Test guide box with undefined 'width' returns undef");
ok(!defined C4::Labels::Label::_guide_box($llx,$lly,$width,undef),
"Test guide box with undefined 'height' returns undef");
is(
C4::Labels::Label::_guide_box($llx, $lly, $width, $height),
'q
0.5 w
1.0 0.0 0.0 RG
1.0 1.0 1.0 rg
0 0 10 10 re
B
Q
',
'Return guide box if all four parameters are defined'
);
ok(C4::Labels::Label::_get_text_fields(), 'test getting textx fields');
is(C4::Labels::Label::_split_lccn(),"0", 'test when _split_lccn is null');