Skip to content
Newer
Older
100644 103 lines (87 sloc) 2.31 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
78ce693 SDL_mixer is not necessary
Tobias Leich authored Mar 25, 2010
14 if ( SDL::Config->has('smpeg') ) {
5c9faa9 @adamkennedy Expanding the test suite for SDL::SMPEG to include the main setup ope…
adamkennedy authored Jan 5, 2011
15 plan( tests => 19 );
4979eb1 @jtpalmer perltidy
jtpalmer authored Jul 31, 2010
16 } else {
17 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
18 }
19
20 use_ok('SDL::SMPEG');
a618f29 @kthakore Video is showing but tests are not working as expected
kthakore authored Jan 5, 2011
21 use SDL::Video;
a677489 @kthakore Moved old SDL::Video test to smpeg test
kthakore authored Oct 23, 2009
22
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored Jul 20, 2010
23 can_ok(
4979eb1 @jtpalmer perltidy
jtpalmer authored Jul 31, 2010
24 'SDL::SMPEG', qw/
25 new
26 error
27 audio
28 video
29 volume
30 display
31 scale
32 play
33 pause
34 stop
35 rewind
36 seek
37 skip
38 loop
39 region
40 frame
41 info
42 status
43 /
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored Jul 20, 2010
44 );
a677489 @kthakore Moved old SDL::Video test to smpeg test
kthakore authored Oct 23, 2009
45
5c9faa9 @adamkennedy Expanding the test suite for SDL::SMPEG to include the main setup ope…
adamkennedy authored Jan 5, 2011
46 # Create a video as it is done in the SYNOPSIS for SDL::SMPEG
47 SCOPE: {
48 my $smpeg = SDL::SMPEG->new(
49 -name => 'test/data/test-mpeg.mpg',
50 );
51 isa_ok( $smpeg, 'SDL::SMPEG' );
52 }
53
54 # Get some information about a video
55 SCOPE: {
56 # TODO: On the following line we don't use the same code as
57 # above, intentionally so we can evade the failing test and
58 # continue testing. Once the above test case passes, merge
59 # this with the test case above.
2e56c95 @kthakore Fixed silly typo
kthakore authored Jan 6, 2011
60 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
61 -name => 'test/data/test-mpeg.mpg',
62 );
63 isa_ok( $smpeg, 'SDL::SMPEG' );
64
65 # Get the video metadata
66 my $mpeg = $smpeg->info;
207837e @kthakore Using a better name for SDL::MPEG
kthakore authored Jan 6, 2011
67 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
68
69 # Check it matches what we expect
70 is( $mpeg->has_audio, 1, '->has_audio ok' );
71 is( $mpeg->has_video, 1, '->has_video ok' );
72 is( $mpeg->width, 160, '->width ok' );
73 is( $mpeg->height, 120, '->height ok' );
74 is( $mpeg->size, 706564, '->size ok' );
75 is( $mpeg->offset, 2717, '->offset ok' );
76 is( $mpeg->frame, 0, '->frame ok' );
77 is( $mpeg->time, 0, '->time ok' );
78 like( $mpeg->length, qr/^21.3/, '->length ok' );
79
80 # TODO: I'm not entirely sure this is meant to be zero
81 is( $mpeg->fps, 0, '->fps ok' );
82
a618f29 @kthakore Video is showing but tests are not working as expected
kthakore authored Jan 5, 2011
83 # Create a display to attach the movie to
84 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
85 $mpeg->height,
86 $mpeg->width,
a618f29 @kthakore Video is showing but tests are not working as expected
kthakore authored Jan 5, 2011
87 32, # Colour bits
88 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
89 );
90 isa_ok( $surface, 'SDL::Surface' );
91
92 # Attach the movie to a surface
93 ok( $smpeg->display($surface), '->display(surface) ok' );
94
95 # Now that we are bound we should be able to do things
96 # to the movie and have them actually work.
97 # Confirm we can change where we are in the video.
98 ok( $smpeg->frame(5), '->frame(5) ok' );
99 is( $mpeg->frame, 5, '->frame updated in info object' );
100 }
9cd8a16 @kthakore Added SMPEG priliminary support
kthakore authored Jan 4, 2011
101
fc90dcd @m4gnet time to sleep(2);
m4gnet authored Dec 2, 2009
102 sleep(2);
Something went wrong with that request. Please try again.