Permalink
Browse files

no video-gfx unless SDL_RELEASE_TESTING

  • Loading branch information...
1 parent 7479d00 commit 6626b9f46e8385373c5709c11a932fd6ed0766d9 Tobias Leich committed Mar 22, 2010
View
@@ -3,6 +3,10 @@ Revision history for Perl extension SDL_perl.
* 2.3_9
- Moved SDL::Net away [FROGGS]
- Pango XS/tests/docs [FROGGS]
+ - constants for Pango/TTF are in their modules [FROGGS]
+ - tests are silent unless verbose mode [FROGGS]
+ - tests don't display video-gfx unless SDL_RELEASE_TESTING [FROGGS]
+ - SDL_VIDEODRIVER is not forced for windows if 'dummy'-driver is set [FROGGS]
* 2.3_8
- TTF XS/tests/docs [#85] [FROGGS]
View
@@ -73,15 +73,16 @@ extern PerlInterpreter *parent_perl;
#endif
void
-windows_force_driver ()
+windows_force_driver()
{
-
-#if SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION == 2 && SDL_PATCHLEVEL >= 14
+ if(0 != strcmp("dummy", getenv("SDL_VIDEODRIVER")))
+ {
+#if SDL_MAJOR_VERSION >= 1 && SDL_MINOR_VERSION >= 2 && SDL_PATCHLEVEL >= 14
putenv("SDL_VIDEODRIVER=directx");
#else
putenv("SDL_VIDEODRIVER=windib");
#endif
-
+ }
}
View
@@ -2,61 +2,57 @@ use strict;
use warnings;
use Test::Most 'bail';
-
-
BEGIN {
- my @modules =
-qw /
-SDL
-SDL::Video
-SDL::Color
-SDL::Surface
-SDL::Config
-SDL::Overlay
-SDL::Rect
-SDL::Time
-SDL::Events
-SDL::Event
-SDL::Mouse
-SDL::Joystick
-SDL::Cursor
-SDL::Audio
-SDL::AudioSpec
-SDL::CDROM
-SDL::CDTrack
-SDL::CD
-SDL::MultiThread
-SDL::PixelFormat
-SDL::VideoInfo
-
-SDL::GFX::BlitFunc
-SDL::GFX::Framerate
-SDL::GFX::FPSManager
-SDL::GFX::ImageFilter
-SDL::GFX::Primitives
-SDL::GFX::Rotozoom
-
-SDL::Image
-
-SDL::Mixer
-SDL::Mixer::Samples
-SDL::Mixer::Channels
-SDL::Mixer::Groups
-SDL::Mixer::Music
-SDL::Mixer::Effects
-SDL::Mixer::MixChunk
-SDL::Mixer::MixMusic
-
-SDL::Pango
-SDL::Pango::Context
-
-SDL::TTF
-SDL::TTF::Font
-
-SDL::Version
-/;
- plan tests => scalar @modules;
-
- use_ok $_ foreach @modules;
-
- }
+ my @modules = qw /
+ SDL
+ SDL::Video
+ SDL::Color
+ SDL::Surface
+ SDL::Config
+ SDL::Overlay
+ SDL::Rect
+ SDL::Time
+ SDL::Events
+ SDL::Event
+ SDL::Mouse
+ SDL::Joystick
+ SDL::Cursor
+ SDL::Audio
+ SDL::AudioSpec
+ SDL::CDROM
+ SDL::CDTrack
+ SDL::CD
+ SDL::MultiThread
+ SDL::PixelFormat
+ SDL::VideoInfo
+
+ SDL::GFX::BlitFunc
+ SDL::GFX::Framerate
+ SDL::GFX::FPSManager
+ SDL::GFX::ImageFilter
+ SDL::GFX::Primitives
+ SDL::GFX::Rotozoom
+
+ SDL::Image
+
+ SDL::Mixer
+ SDL::Mixer::Samples
+ SDL::Mixer::Channels
+ SDL::Mixer::Groups
+ SDL::Mixer::Music
+ SDL::Mixer::Effects
+ SDL::Mixer::MixChunk
+ SDL::Mixer::MixMusic
+
+ SDL::Pango
+ SDL::Pango::Context
+
+ SDL::TTF
+ SDL::TTF::Font
+
+ SDL::Version
+ /;
+ plan tests => scalar @modules;
+
+ use_ok $_ foreach @modules;
+}
View
@@ -55,13 +55,16 @@ can_ok ('SDL::App', qw/
grab_input
loop
sync
- attribute /);
+ attribute
+/);
+
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
SKIP:
{
skip 'Video not avaiable', 6 unless SDL::TestTool->init(SDL_INIT_VIDEO);
-
my $app = SDL::App->new(-title => "Test", -width => 640, -height => 480, -init => SDL_INIT_VIDEO);
$app->sync;
@@ -71,7 +74,6 @@ SKIP:
like($@, qr/not resizable/, "check for error message");
SDL::quit;
-
my $app2 = SDL::App->new(-title => "Test", -width => 640, -height => 480, -init => SDL_INIT_VIDEO, -resizeable => 1);
$app2->sync;
@@ -82,8 +84,8 @@ SKIP:
ok(eval { $app2->resize(640, 480); 1 }, "succeed at resize with $driver");
ok(!eval { $app2->resize(-1, -1); 1 }, "fail to resize to bad size with $driver");
like($@, qr/cannot set video/, "check error message");
- }
-
+}
+$ENV{SDL_VIDEODRIVER} = $videodriver;
sleep(2);
View
@@ -7,11 +7,13 @@ use Test::More tests => 5;
use lib 't/lib';
use SDL::TestTool;
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
SKIP:
{
skip "Video fail", 1 unless SDL::TestTool->init(SDL_INIT_VIDEO);
-is( SDL::init(SDL_INIT_VIDEO), 0, '[init] returns 0 on success' );
-
+ is( SDL::init(SDL_INIT_VIDEO), 0, '[init] returns 0 on success' );
}
SDL::set_error('Hello');
is( SDL::get_error, 'Hello', '[get_error] returns Hello' );
@@ -25,3 +27,5 @@ is( SDL::get_error, 'Hello SDL! Three is 3.', '[get_error] returns Hello SDL! Th
SDL::clear_error();
is( SDL::get_error, '', '[get_error] returns no error' );
sleep(2);
+
+$ENV{SDL_VIDEODRIVER} = $videodriver;
View
@@ -9,6 +9,9 @@ use Test::More;
use lib 't/lib';
use SDL::TestTool;
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_VIDEO) ) {
plan( skip_all => 'Failed to init video' );
}
@@ -240,6 +243,8 @@ SKIP:
SDL::quit();
}
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
pass 'Are we still alive? Checking for segfaults';
done_testing;
View
@@ -5,10 +5,12 @@ use Test::More;
use SDL;
use SDL::Video;
-
use lib 't/lib';
use SDL::TestTool;
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_VIDEO) ) {
plan( skip_all => 'Failed to init video' );
}
@@ -26,5 +28,6 @@ my $overlay = SDL::Overlay->new( 100, 100, SDL_YV12_OVERLAY, $display);
isa_ok( $overlay, 'SDL::Overlay');
-sleep(2)
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+sleep(2);
View
@@ -11,6 +11,9 @@ use SDL::Video;
use lib 't/lib';
use SDL::TestTool;
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_VIDEO) ) {
plan( skip_all => 'Failed to init video' );
}
@@ -47,3 +50,4 @@ isa_ok( $disp->format->palette->colors(), 'ARRAY', 'Palette->colors[x] is a colo
isa_ok( $disp->format->palette->color_index(23), 'SDL::Color', 'Palette->color_index() is a SDL::Color');
}
+$ENV{SDL_VIDEODRIVER} = $videodriver;
View
@@ -19,10 +19,12 @@ use SDL::Video;
use SDL::PixelFormat;
use Test::More;
-
use lib 't/lib';
use SDL::TestTool;
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_VIDEO) ) {
plan( skip_all => 'Failed to init video' );
}
@@ -121,8 +123,9 @@ my $other_surface = SDL::Surface->new_from( $surface->get_pixels_ptr, 640, 320,
isa_ok( $other_surface, 'SDL::Surface' );
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
pass 'Final SegFault test';
SDL::delay(100);
sleep(2);
-
View
@@ -12,6 +12,9 @@ use SDL::Video;
use lib 't/lib';
use SDL::TestTool;
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_VIDEO) ) {
plan( skip_all => 'Failed to init video' );
}
@@ -284,6 +287,8 @@ SKIP:
}
}
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
pass 'Are we still alive? Checking for segfaults';
sleep(2);
@@ -14,6 +14,9 @@ use Devel::Peek;
use lib 't/lib';
use SDL::TestTool;
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_VIDEO) ) {
plan( skip_all => 'Failed to init video' );
}
@@ -37,5 +40,6 @@ isa_ok( $surface3, 'SDL::Surface', '[convert_surface] makes copy of surface conv
warn 'SW->SW conversion failed: '.SDL::get_error if !$surface3;
+$ENV{SDL_VIDEODRIVER} = $videodriver;
done_testing;
View
@@ -12,6 +12,9 @@ use Test::More;
use lib 't/lib';
use SDL::TestTool;
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if( !SDL::TestTool->init(SDL_INIT_VIDEO) )
{
plan( skip_all => 'Failed to init video' );
@@ -49,8 +52,8 @@ is( $fps->rate, 4, 'fps has rate' );
SDL::delay(100);
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
pass 'Are we still alive? Checking for segfaults';
done_testing;
-
-
View
@@ -12,6 +12,9 @@ use Test::More;
use lib 't/lib';
use SDL::TestTool;
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if( !SDL::TestTool->init(SDL_INIT_VIDEO) )
{
plan( skip_all => 'Failed to init video' );
@@ -46,8 +49,8 @@ is( SDL::GFX::Framerate::delay($fps), undef, "[delay] return undef" );
SDL::delay(100);
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
pass 'Are we still alive? Checking for segfaults';
done_testing;
-
-
View
@@ -14,6 +14,9 @@ use Test::More;
use lib 't/lib';
use SDL::TestTool;
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if( !SDL::TestTool->init(SDL_INIT_VIDEO) )
{
plan( skip_all => 'Failed to init video' );
@@ -149,6 +152,8 @@ TODO:
}
if( $done[0] eq 'none'){ print '0% done 0/'.$#left."\n" } else { print "$why\n" }
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
pass 'Are we still alive? Checking for segfaults';
done_testing;
Oops, something went wrong.

0 comments on commit 6626b9f

Please sign in to comment.