/t_backcompat/toolfontpm.t

http://github.com/PerlGameDev/SDL · Perl · 90 lines · 39 code · 10 blank · 41 comment · 3 complexity · 3352a3a1327562d1de9940c58ef2d1b0 MD5 · raw file

  1. #!/usr/bin/perl -w
  2. #
  3. # Copyright (C) 2003 Tels
  4. # Copyright (C) 2004 David J. Goehrig
  5. #
  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. #
  32. # basic testing of SDL::Tool::Font
  33. BEGIN {
  34. unshift @INC, 'blib/lib', 'blib/arch';
  35. }
  36. use strict;
  37. use SDL;
  38. use SDL::Config;
  39. use Test::More;
  40. plan( skip_all => "Failing test due to moving stuff around" );
  41. if ( SDL::Config->has('SDL_image')
  42. && SDL::Config->has('SDL_ttf') )
  43. {
  44. plan( tests => 2 );
  45. } else {
  46. plan(
  47. skip_all => (
  48. SDL::Config->has('SDL_image') ? ''
  49. : ' SDL_image support not compiled'
  50. )
  51. . (
  52. SDL::Config->has('SDL_ttf') ? ''
  53. : ' SDL_ttf support not compiled'
  54. )
  55. );
  56. }
  57. use_ok('SDL::Tool::Font');
  58. can_ok(
  59. 'SDL::Tool::Font', qw/
  60. new
  61. print
  62. /
  63. );
  64. my $font = SDL::Tool::Font->new(
  65. -normal => 1,
  66. -ttfont => 'test/data/aircut3.ttf',
  67. -size => 20,
  68. -fg => $SDL::Color::black,
  69. -bg => $SDL::Color::black
  70. );
  71. #use utf8;
  72. #my $string = "Test";
  73. #my $aref = SDL::TTFSizeText( $font, $string);
  74. #ok( defined($$aref[0]), "Testi width for SDL::TTFSizeText." );
  75. #ok( defined($$aref[1]), "Test height for SDL::TTFSizeText." );
  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." );
  80. sleep(2);