Bug 13670 - Patron holds table not loading when holds tab anchor is used
[koha.git] / t / Labels.t
blobf762a733fb03d1c32453be363c168c26cb64ce91
1 #!/usr/bin/perl
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
8 # version.
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
18 # for context, see http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=2691
20 use strict;
21 use warnings;
23 use Test::More tests => 11;
25 BEGIN {
26 use_ok('C4::Labels::Label');
29 my $format_string = "title, callnumber";
30 my $parsed_fields = C4::Labels::Label::_get_text_fields($format_string);
31 my $expected_fields = [
32 { code => 'title', desc => 'title' },
33 { code => 'itemcallnumber', desc => 'itemcallnumber' },
35 is_deeply($parsed_fields, $expected_fields, '"callnumber" in label layout alias for "itemcallnumber" per bug 5653');
37 is(C4::Labels::Label::_check_params(),"0",'test checking parameters');
39 my ($llx,$lly,$width,$height) = ( 0, 0, 10, 10 );
40 ok(!defined C4::Labels::Label::_guide_box(),
41 "Test guide box with undefined parameters returns undef");
42 ok(!defined C4::Labels::Label::_guide_box(undef,$lly,$width,$height),
43 "Test guide box with undefined 'x' coordinate returns undef");
44 ok(!defined C4::Labels::Label::_guide_box($llx,undef,$width,$height),
45 "Test guide box with undefined 'y' coordinate returns undef");
46 ok(!defined C4::Labels::Label::_guide_box($llx,$lly,undef,$height),
47 "Test guide box with undefined 'width' returns undef");
48 ok(!defined C4::Labels::Label::_guide_box($llx,$lly,$width,undef),
49 "Test guide box with undefined 'height' returns undef");
50 is(
51 C4::Labels::Label::_guide_box($llx, $lly, $width, $height),
53 0.5 w
54 1.0 0.0 0.0 RG
55 1.0 1.0 1.0 rg
56 0 0 10 10 re
60 'Return guide box if all four parameters are defined'
63 ok(C4::Labels::Label::_get_text_fields(), 'test getting textx fields');
65 is(C4::Labels::Label::_split_lccn(),"0", 'test when _split_lccn is null');