need to return values of Rect* and so on
[sdlgit/SDL_perl.git] / t / toolfontpm.t
CommitLineData
8fde61e3 1#!/usr/bin/perl -w
2#
3# Copyright (C) 2003 Tels
4# Copyright (C) 2004 David J. Goehrig
5#
7b6a53a1 6# Copyright (C) 2005 David J. Goehrig <dgoehrig\@cpan.org>
7#
8# ------------------------------------------------------------------------------
9#
10# This library is free software; you can redistribute it and/or
11# modify it under the terms of the GNU Lesser General Public
12# License as published by the Free Software Foundation; either
13# version 2.1 of the License, or (at your option) any later version.
14#
15# This library is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18# Lesser General Public License for more details.
19#
20# You should have received a copy of the GNU Lesser General Public
21# License along with this library; if not, write to the Free Software
22# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23#
24# ------------------------------------------------------------------------------
25#
26# Please feel free to send questions, suggestions or improvements to:
27#
28# David J. Goehrig
29# dgoehrig\@cpan.org
30#
31#
8fde61e3 32# basic testing of SDL::Tool::Font
33
34BEGIN {
7b6a53a1 35 unshift @INC, 'blib/lib','blib/arch';
8fde61e3 36}
37
38use strict;
e7e70be2 39use SDL;
8fde61e3 40use SDL::Config;
8fde61e3 41use Test::More;
42
43if ( SDL::Config->has('SDL_image')
44 && SDL::Config->has('SDL_ttf') ) {
2a668066 45 plan ( tests => 2 );
8fde61e3 46} else {
47 plan ( skip_all =>
48 ( SDL::Config->has('SDL_image')
49 ? ''
50 : ' SDL_image support not compiled')
51 . ( SDL::Config->has('SDL_ttf')
52 ? ''
53 : ' SDL_ttf support not compiled'));
54}
55
56use_ok( 'SDL::Tool::Font' );
57
58can_ok ('SDL::Tool::Font', qw/
59 new
60 print
61 /);
e7e70be2 62my $font = new SDL::Tool::Font
63 -normal => 1,
64 -ttfont => 'test/data/aircut3.ttf',
65 -size => 20,
66 -fg => $SDL::Color::black,
67 -bg => $SDL::Color::black;
68
2a668066 69#use utf8;
89d02e07 70
2a668066 71#my $string = "Test";
72#my $aref = SDL::TTFSizeText( $font, $string);
73#ok( defined($$aref[0]), "Testi width for SDL::TTFSizeText." );
74#ok( defined($$aref[1]), "Test height for SDL::TTFSizeText." );
89d02e07 75
2a668066 76#utf8::encode($string);
77#my $bref = SDL::TTFSizeUTF8( $font, $string);
78#ok( defined($$bref[0]), "Test for width SDL::TTFSizeUTF8." );
79#ok( defined($$bref[1]), "Test for height SDL::TTFSizeUTF8." );
8fde61e3 80