Skip to content

Commit 895c5cc

Browse files
committed
Actually creating a new Texture. WIP #2
1 parent fc8e50f commit 895c5cc

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/Core/objects/Texture.xs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ void
3131
texture_DESTROY(bag)
3232
SV *bag
3333
CODE:
34-
objDESTROY(bag, safefree);
34+
objDESTROY(bag, SDL_DestroyTexture);

t/106_sdl2_texture.t

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
1+
use Test::More tests => 2;
2+
use SDL2pp;
23
use SDL2::Window;
34
use SDL2::Renderer;
45
use SDL2::Rect;
56
use SDL2::Texture;
7+
use SDL2::ConfigData;
68

79
BEGIN {
8-
use SDL2::ConfigData;
910

1011
plan skip_all => 'SDL2::Texture not available' unless SDL2::ConfigData->config('mod2lib')->{'SDL2::Texture'};
1112

1213
}
1314

14-
ok( exists &SDL2::Texture::new, 'new exists');
1515

1616
exit 0 if SDL2pp::init(SDL_INIT_VIDEO) < 0 ; #SDL_INIT_VIDEO
1717

1818
my $win = SDL2::Window->new("FIRST WINDOW", 50, 50, 200, 200, SDL_WINDOW_SHOWN );
1919

2020
my $renderer = SDL2::Renderer->new($win, -1, SDL_RENDERER_SOFTWARE); #Hardware accelerated with software fallback
2121

22-
2322
can_ok('SDL2::Texture', qw/new/);
2423

25-
my $texture = SDL2::Texture->new($renderer, 1, 1, 100, 100);
24+
my $texture = SDL2::Texture->new($renderer, 0, 0, 100, 100);
25+
fail( SDL2pp::get_error() ) unless $texture;
26+
27+
isa_ok($texture, 'SDL2::Texture');
2628

27-
done_testing();

0 commit comments

Comments
 (0)