Skip to content
Newer
Older
100644 122 lines (102 sloc) 2.71 KB
a677489 @kthakore Moved old SDL::Video test to smpeg test
kthakore authored Oct 23, 2009
1 #!perl
2 # basic testing of SDL::SMPEG
3
4 BEGIN {
4979eb1 @jtpalmer perltidy
jtpalmer authored Jul 30, 2010
5 unshift @INC, 'blib/lib', 'blib/arch';
a677489 @kthakore Moved old SDL::Video test to smpeg test
kthakore authored Oct 23, 2009
6 }
7
8 use strict;
a618f29 @kthakore Video is showing but tests are not working as expected
kthakore authored Jan 5, 2011
9 use SDL;
a677489 @kthakore Moved old SDL::Video test to smpeg test
kthakore authored Oct 23, 2009
10 use SDL::Config;
11
12 use Test::More;
13
6b9a70b @kthakore Accidently added ppport to bundle file for Mac build
kthakore authored Jan 8, 2011
14 my $videodriver = $ENV{SDL_VIDEODRIVER};
15 $ENV{SDL_VIDEODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
16
17
78ce693 SDL_mixer is not necessary
Tobias Leich authored Mar 25, 2010
18 if ( SDL::Config->has('smpeg') ) {
0609c2b @kthakore We can only run smpeg as release_testing
kthakore authored Jan 11, 2011
19 if( $ENV{SDL_RELEASE_TESTING} )
20 {
21 plan( tests => 17 );
22 }
23 else
24 {
25 plan( skip_all => "Skiping test for now. EXPERIMENTAL" );
26 }
4979eb1 @jtpalmer perltidy
jtpalmer authored Jul 31, 2010
27 } else {
28 plan( skip_all => ( SDL::Config->has('smpeg') ? '' : ' smpeg support not compiled' ) );
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored Jul 20, 2010
29 }
30
31 use_ok('SDL::SMPEG');
a618f29 @kthakore Video is showing but tests are not working as expected
kthakore authored Jan 5, 2011
32 use SDL::Video;
a677489 @kthakore Moved old SDL::Video test to smpeg test
kthakore authored Oct 23, 2009
33
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored Jul 20, 2010
34 can_ok(
4979eb1 @jtpalmer perltidy
jtpalmer authored Jul 31, 2010
35 'SDL::SMPEG', qw/
36 new
37 error
38 audio
39 video
40 volume
41 display
42 scale
43 play
44 pause
45 stop
46 rewind
47 seek
48 skip
49 loop
50 region
51 frame
52 info
53 status
54 /
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored Jul 20, 2010
55 );
a677489 @kthakore Moved old SDL::Video test to smpeg test
kthakore authored Oct 23, 2009
56
5c9faa9 @adamkennedy Expanding the test suite for SDL::SMPEG to include the main setup ope…
adamkennedy authored Jan 5, 2011
57 # Create a video as it is done in the SYNOPSIS for SDL::SMPEG
58 SCOPE: {
59 my $smpeg = SDL::SMPEG->new(
60 -name => 'test/data/test-mpeg.mpg',
61 );
62 isa_ok( $smpeg, 'SDL::SMPEG' );
63 }
64
65 # Get some information about a video
66 SCOPE: {
67 # TODO: On the following line we don't use the same code as
68 # above, intentionally so we can evade the failing test and
69 # continue testing. Once the above test case passes, merge
70 # this with the test case above.
2e56c95 @kthakore Fixed silly typo
kthakore authored Jan 6, 2011
71 my ($smpeg) = SDL::SMPEG->new(
5c9faa9 @adamkennedy Expanding the test suite for SDL::SMPEG to include the main setup ope…
adamkennedy authored Jan 5, 2011
72 -name => 'test/data/test-mpeg.mpg',
73 );
74 isa_ok( $smpeg, 'SDL::SMPEG' );
75
76 # Get the video metadata
77 my $mpeg = $smpeg->info;
207837e @kthakore Using a better name for SDL::MPEG
kthakore authored Jan 6, 2011
78 isa_ok( $mpeg, 'SDL::SMPEG::Info' );
5c9faa9 @adamkennedy Expanding the test suite for SDL::SMPEG to include the main setup ope…
adamkennedy authored Jan 5, 2011
79
80 # Check it matches what we expect
81 is( $mpeg->has_audio, 1, '->has_audio ok' );
82 is( $mpeg->has_video, 1, '->has_video ok' );
83 is( $mpeg->width, 160, '->width ok' );
84 is( $mpeg->height, 120, '->height ok' );
85 is( $mpeg->size, 706564, '->size ok' );
86 is( $mpeg->offset, 2717, '->offset ok' );
87 is( $mpeg->frame, 0, '->frame ok' );
88 is( $mpeg->time, 0, '->time ok' );
89 like( $mpeg->length, qr/^21.3/, '->length ok' );
90
91 # TODO: I'm not entirely sure this is meant to be zero
92 is( $mpeg->fps, 0, '->fps ok' );
93
a618f29 @kthakore Video is showing but tests are not working as expected
kthakore authored Jan 5, 2011
94 # Create a display to attach the movie to
95 my $surface = SDL::Video::set_video_mode(
5c9faa9 @adamkennedy Expanding the test suite for SDL::SMPEG to include the main setup ope…
adamkennedy authored Jan 5, 2011
96 $mpeg->height,
97 $mpeg->width,
a618f29 @kthakore Video is showing but tests are not working as expected
kthakore authored Jan 5, 2011
98 32, # Colour bits
99 SDL::Video::SDL_SWSURFACE, # flags
5c9faa9 @adamkennedy Expanding the test suite for SDL::SMPEG to include the main setup ope…
adamkennedy authored Jan 5, 2011
100 );
101 isa_ok( $surface, 'SDL::Surface' );
102
103 # Attach the movie to a surface
6b9a70b @kthakore Accidently added ppport to bundle file for Mac build
kthakore authored Jan 9, 2011
104 is( $smpeg->display($surface), undef, '->display(surface) ok' );
5c9faa9 @adamkennedy Expanding the test suite for SDL::SMPEG to include the main setup ope…
adamkennedy authored Jan 5, 2011
105
106 # Now that we are bound we should be able to do things
107 # to the movie and have them actually work.
108 # Confirm we can change where we are in the video.
0609c2b @kthakore We can only run smpeg as release_testing
kthakore authored Jan 11, 2011
109 # is( $smpeg->frame(5), undef, '->frame(5) ok' );
110 $smpeg->play();
820749b @kthakore All tests pass but segfaults on exit
kthakore authored Jan 9, 2011
111 # TODO: Figure out how this info object really works
112 #is( $mpeg->current_frame, 5, '->frame updated in info object' );
5c9faa9 @adamkennedy Expanding the test suite for SDL::SMPEG to include the main setup ope…
adamkennedy authored Jan 5, 2011
113 }
9cd8a16 @kthakore Added SMPEG priliminary support
kthakore authored Jan 4, 2011
114
6b9a70b @kthakore Accidently added ppport to bundle file for Mac build
kthakore authored Jan 9, 2011
115
116 if ($videodriver) {
117 $ENV{SDL_VIDEODRIVER} = $videodriver;
118 } else {
119 delete $ENV{SDL_VIDEODRIVER};
120 }
121
Something went wrong with that request. Please try again.