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