Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

no video-gfx unless SDL_RELEASE_TESTING

  • Loading branch information...
commit 6626b9f46e8385373c5709c11a932fd6ed0766d9 1 parent 7479d00
Tobias Leich authored
View
4 CHANGELOG
@@ -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
9 src/SDL.xs
@@ -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
110 t/00-load.t
@@ -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
12 t/apppm.t
@@ -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
8 t/core_error.t
@@ -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
5 t/core_events.t
@@ -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
7 t/core_overlay.t
@@ -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
4 t/core_palette.t
@@ -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
7 t/core_surface.t
@@ -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
5 t/core_video.t
@@ -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);
View
4 t/core_video_convert_surface.t
@@ -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
7 t/gfx_fpsmanager.t
@@ -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
7 t/gfx_framerate.t
@@ -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
5 t/gfx_imagefilter.t
@@ -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;
View
5 t/gfx_primitives.t
@@ -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' );
@@ -241,6 +244,8 @@ SDL::Video::update_rect($display, 0, 0, 640, 480);
SDL::delay(3000);
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
pass 'Are we still alive? Checking for segfaults';
done_testing;
View
5 t/gfx_primitives2.t
@@ -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' );
@@ -111,6 +114,8 @@ SDL::Video::update_rect($display, 0, 0, 640, 480);
SDL::delay(3000);
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
pass 'Are we still alive? Checking for segfaults';
done_testing;
View
5 t/gfx_rotozoom.t
@@ -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' );
@@ -102,6 +105,8 @@ sub draw
SDL::delay(1000);
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
pass 'Are we still alive? Checking for segfaults';
done_testing;
View
6 t/image.t
@@ -9,6 +9,10 @@ use SDL::RWOps;
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' );
@@ -98,4 +102,6 @@ SKIP:
SDL::Image::quit(); pass '[quit] we can quit fine';
}
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
done_testing;
View
7 t/image_xpm_array.t
@@ -11,6 +11,10 @@ use SDL::Surface;
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' );
@@ -99,4 +103,7 @@ SDL::Video::flip( $screen);
pass 'ok';
SDL::delay(1000);
}
+
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
done_testing;
View
14 t/intergation1.t
@@ -62,7 +62,12 @@ 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 'No Video', 1 unless SDL::TestTool->init(SDL_INIT_VIDEO);
@@ -89,7 +94,8 @@ SKIP:
SDL::delay(10);
}
- SDL::delay(100);
- pass 'Ran';
- }
+ SDL::delay(100);
+ pass 'Ran';
+}
+$ENV{SDL_VIDEODRIVER} = $videodriver;
View
5 t/pango.t
@@ -25,6 +25,9 @@ use SDL::Pango ':all';
use SDL::Pango::Context;
use SDL::Version;
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
is( SDL::Pango::was_init(), 0, "[was_init] returns false" );
is( SDL::Pango::init(), 0, "[init] succeeded" );
isnt( SDL::Pango::was_init(), 0, "[was_init] returns true" );
@@ -67,6 +70,8 @@ SKIP:
SDL::delay(2000);
}
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
pass 'Are we still alive? Checking for segfaults';
done_testing;
View
5 t/ttf.t
@@ -26,6 +26,9 @@ use SDL::RWOps;
use SDL::Version;
use Encode;
+my $videodriver = $ENV{SDL_VIDEODRIVER};
+$ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
my $lv = SDL::TTF::linked_version();
my $cv = SDL::TTF::compile_time_version();
@@ -217,6 +220,8 @@ is( SDL::TTF::was_init(), 1, "[was_init] returns true" );
is( SDL::TTF::quit(), undef, "[quit] ran" );
is( SDL::TTF::was_init(), 0, "[was_init] returns false" );
+$ENV{SDL_VIDEODRIVER} = $videodriver;
+
done_testing;
sleep(1);
Please sign in to comment.
Something went wrong with that request. Please try again.