From 34e136a485c58c6911de59899f94a0543e483b0a Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 7 May 2014 01:00:34 +0000 Subject: [PATCH] Bug 8375: (follow-up) final adjustment to t/Creators.t This patch adjusts the test so that it can pass successfully without a valid context (in which case C4::Creators::PDF defaults to the built-in fonts) or with one (in which case it uses the TrueType fonts). Signed-off-by: Galen Charlton --- t/Creators.t | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/t/Creators.t b/t/Creators.t index 899ff33070..646aef5996 100755 --- a/t/Creators.t +++ b/t/Creators.t @@ -34,11 +34,21 @@ $pdf_creator->FontSize(); # Reset font size before testing text width etc below ok($pdf_creator->Page(), "testing Page() works"); -is($pdf_creator->StrWidth("test", "H", 12), '23.044921875', "testing StrWidth() returns correct point width"); +my $expected_width; +my $expected_offset; +if (C4::Context->config('ttf')) { + $expected_width = '23.044921875'; + $expected_offset = '33.044921875'; +} else { + $expected_width = '19.344'; + $expected_offset = '29.344'; +} + +is($pdf_creator->StrWidth("test", "H", 12), $expected_width, "testing StrWidth() returns correct point width"); @result = $pdf_creator->Text(10, 10, "test"); is($result[0], '10', "testing Text() writes from a given x-value"); -is($result[1], '33.044921875', "testing Text() writes to the correct x-value"); +is($result[1], $expected_offset, "testing Text() writes to the correct x-value"); open(my $fh, '>', 'test.pdf'); select $fh; -- 2.20.1