You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-perl/Font-AFM/files/Font-AFM-1.20-custom-test-f...

47 lines
1.3 KiB

From 6291356c29004b58b7d0f18ce39738ebc2412ff9 Mon Sep 17 00:00:00 2001
From: Kent Fredric <kentnl@gentoo.org>
Date: Thu, 17 Sep 2020 13:28:34 +1200
Subject: Allow overriding test font name
This allows us to use helvetica-compatible fonts without needing an
actual font called "Helvetica"
---
t/afm.t | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/t/afm.t b/t/afm.t
index 40addff..60ddcb8 100644
--- a/t/afm.t
+++ b/t/afm.t
@@ -1,7 +1,13 @@
require Font::AFM;
+my $test_font = $ENV{TEST_FONT};
+my $test_width = $ENV{TEST_FONT_WIDTH};
+
+$test_font = "Helvetica" unless defined $test_font and length $test_font;
+$test_width = 4279 unless defined $test_width and length $test_width;
+
eval {
- $font = Font::AFM->new("Helvetica");
+ $font = Font::AFM->new($test_font);
};
if ($@) {
if ($@ =~ /Can't find the AFM file for/) {
@@ -18,9 +24,9 @@ print "1..1\n";
$sw = $font->stringwidth("Gisle Aas");
-if ($sw == 4279) {
- print "ok 1 Stringwith for Helvetica seems to work\n";
+if ($sw == $test_width) {
+ print "ok 1 Stringwith for \"$test_font\"(font) seems to work\n";
} else {
- print "not ok 1 The stringwidth of 'Gisle Aas' should be 4279 (it was $sw)\n";
+ print "not ok 1 The stringwidth of 'Gisle Aas' should be $test_width (it was $sw)\n";
}
--
2.28.0