Bug in the logic of a test
[sdlgit/SDL_perl.git] / t / core_video.t
CommitLineData
df4106bf 1#!/usr/bin/perl -w
df4106bf 2use strict;
3use SDL;
4510df28 4use SDL::Surface;
df4106bf 5use SDL::Config;
7fa192d4 6use Devel::Peek;
4510df28 7use Data::Dumper;
df4106bf 8use Test::More;
eaf32d63 9use SDL::Rect;
df4106bf 10
19f3ee7b 11plan ( tests => 10 );
df4106bf 12
13use_ok( 'SDL::Video' );
14
15can_ok ('SDL::Video', qw/
16 get_video_surface
17 get_video_info
8a2411d0 18 video_driver_name
7dda1934 19 list_modes
bbe5d2f5 20 set_video_mode
218b5471 21 video_mode_ok
eaf32d63 22 update_rect
23 update_rects
19f3ee7b 24 flip
95f5be30 25 /);
26
27#testing get_video_surface
28SDL::Init(SDL_INIT_VIDEO);
29
30my $display = SDL::SetVideoMode(640,480,32, SDL_SWSURFACE );
31
218b5471 32#diag('Testing SDL::Video');
95f5be30 33
e4259ddb 34isa_ok(SDL::Video::get_video_surface(), 'SDL::Surface', '[get_video_surface] Checking if we get a surface ref back');
35
36isa_ok(SDL::Video::get_video_info(), 'SDL::VideoInfo', '[get_video_info] Checking if we get videoinfo ref back');
20f544ea 37
7fa192d4 38my $driver_name = SDL::Video::video_driver_name();
39
e4259ddb 40pass '[video_driver_name] This is your driver name: '.$driver_name;
7fa192d4 41
218b5471 42
43
44is( ref( SDL::Video::list_modes( $display->format , SDL_SWSURFACE )), 'ARRAY', '[list_modes] Returned an ARRAY! ');
45
46cmp_ok(SDL::Video::video_mode_ok( 100, 100, 16, SDL_SWSURFACE), '>=', 0, "[video_mode_ok] Checking if an integer was return");
7fa192d4 47
bbe5d2f5 48isa_ok(SDL::Video::set_video_mode( 100, 100 ,16, SDL_SWSURFACE), 'SDL::Surface', '[set_video_more] Checking if we get a surface ref back');
49
50
51
52#TODO: Write to surface and check inf pixel in that area got updated.
53
eaf32d63 54SDL::Video::update_rect($display, 0, 0, 0, 0);
55
bbe5d2f5 56#TODO: Write to surface and check inf pixel in that area got updated.
eaf32d63 57SDL::Video::update_rects($display, SDL::Rect->new(0, 10, 20, 20));
58
b9125226 59my $value = SDL::Video::flip($display);
60is( ($value == 0) || ($value == -1), 1, '[flip] returns 0 or -1' );
19f3ee7b 61
bc1947c7 62pass "Are we still alive?";
63
95f5be30 64=skip
d817c64c 65 get_video_surface
66 get_video_info
67 video_driver_name
68 list_modes
df4106bf 69 set_video_mode
d817c64c 70 video_mode_ok
df4106bf 71 update_rect
72 update_rects
73 flip
74 set_colors
75 set_palette
76 set_gamma
77 get_gamma_ramp
78 set_gmmma_ramp
79 map_RGB
80 map_RGBA
81 get_RGB
82 get_RGBA
83 create_RGB_surface_from
84 lock_surface
85 unlock_surface
86 convert_surface
87 display_format
88 display_format_alpha
89 load_BMP
90 save_BMP
91 set_color_key
92 set_alpha
93 set_clip_rect
94 get_clip_rect
95 blit_surface
96 fill_rect
97 GL_load_library
98 GL_get_proc_address
99 GL_get_attribute
100 GL_set_attribute
101 GL_swap_buffers
102 GL_attr
df4106bf 103 lock_YUV_overlay
104 unlock_YUV_overlay
105 display_YUV_overlay
df4106bf 106 /);
107