PageRenderTime 22ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/xt/06_surfaceML.t

http://github.com/PerlGameDev/SDL
Perl | 78 lines | 34 code | 13 blank | 31 comment | 2 complexity | 4c2f50be981fd4426e6892d394e3f1d9 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0
  1. #!/usr/bin/perl -w
  2. #
  3. # Copyright (C) 2009 Kartik Thakore
  4. #
  5. # ------------------------------------------------------------------------------
  6. #
  7. # This library is free software; you can redistribute it and/or
  8. # modify it under the terms of the GNU Lesser General Public
  9. # License as published by the Free Software Foundation; either
  10. # version 2.1 of the License, or (at your option) any later version.
  11. #
  12. # This library is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. # Lesser General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Lesser General Public
  18. # License along with this library; if not, write to the Free Software
  19. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. #
  21. # ------------------------------------------------------------------------------
  22. #
  23. # Please feel free to send questions, suggestions or improvements to:
  24. #
  25. # Kartik Thakore
  26. # kthakore\@cpan.org
  27. #
  28. #
  29. # Memory leaks testing
  30. BEGIN {
  31. unshift @INC, 'blib/lib', 'blib/arch';
  32. }
  33. use strict;
  34. use Test::More;
  35. # Don't run tests for installs
  36. unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ) {
  37. plan( skip_all => "Author tests not required for installation" );
  38. }
  39. # This is stolen for Gabor's examples in padre's SDL plugin
  40. sub surface_leak() {
  41. use SDL;
  42. use SDLx::App;
  43. use SDL::Rect;
  44. use SDL::Color;
  45. my $window = SDLx::App->new(
  46. width => 640,
  47. height => 480,
  48. depth => 16,
  49. title => 'SDL Demo',
  50. init => SDL_INIT_VIDEO
  51. );
  52. my $rect = SDL::Rect->new( 0, 0, 10, 20 );
  53. my $blue = SDL::Color->new(
  54. -r => 0x00,
  55. -g => 0x00,
  56. -b => 0xff,
  57. );
  58. $window->fill( $rect, $blue );
  59. $window->update($rect);
  60. }
  61. eval 'use Test::Valgrind';
  62. plan skip_all => 'Test::Valgrind is required to test your distribution with valgrind'
  63. if $@;
  64. surface_leak();
  65. sleep(2);