aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_sdl.js2
-rwxr-xr-xtests/runner.py2
-rw-r--r--tests/sdl_surface_refcount.c11
3 files changed, 9 insertions, 6 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js
index 34c9551a..ee62139c 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -275,6 +275,8 @@ var LibrarySDL = {
{{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*5', '0', 'buffer', 'void*') }}} // SDL_Surface.pixels
{{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*6', '0', '0', 'i32*') }}} // SDL_Surface.offset
+ {{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*14', '0', '1', 'i32') }}}
+
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.format', '0', '-2042224636', 'i32') }}} // SDL_PIXELFORMAT_RGBA8888
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.palette', '0', '0', 'i32') }}} // TODO
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.BitsPerPixel', '0', 'bpp * 8', 'i8') }}}
diff --git a/tests/runner.py b/tests/runner.py
index 6daa9c36..b2dff6f4 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -13173,7 +13173,7 @@ Press any key to continue.'''
self.btest('sdl_alloctext.c', expected='1', args=['-O2', '-s', 'TOTAL_MEMORY=' + str(1024*1024*8)])
def test_sdl_surface_refcount(self):
- self.btest('sdl_surface_refcount.c', expected='1')
+ self.btest('sdl_surface_refcount.c', expected='0')
def test_glbegin_points(self):
shutil.copyfile(path_from_root('tests', 'screenshot.png'), os.path.join(self.get_dir(), 'screenshot.png'))
diff --git a/tests/sdl_surface_refcount.c b/tests/sdl_surface_refcount.c
index 4e9b4896..c4314ebf 100644
--- a/tests/sdl_surface_refcount.c
+++ b/tests/sdl_surface_refcount.c
@@ -1,14 +1,15 @@
#include <SDL.h>
+#include <stdio.h>
int main(int argc, char *argv[])
{
- SDL_Init(SDL_INIT_VIDEO);
- SDL_Surface *screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
- SDL_Surface *reference = screen;
+ SDL_Surface* surface = SDL_CreateRGBSurface(SDL_SWSURFACE, 10, 10, 32,
+ 0, 0, 0, 0);
+ SDL_Surface *reference = surface;
reference->refcount++;
- SDL_FreeSurface(screen);
+ SDL_FreeSurface(surface);
SDL_FreeSurface(reference);
- int result = 1;
+ int result = surface->refcount;
REPORT_RESULT();
return 0;
}