aboutsummaryrefslogtreecommitdiff
path: root/tests/sdl_swsurface.c
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-12 11:47:43 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-02-12 11:47:43 -0800
commitf8cb7deeffa7c2bc79f938821759634e8dce0168 (patch)
tree636fa72d046ca4ed22be48fba8b21e61ead34735 /tests/sdl_swsurface.c
parent61f0d198560a3ebcc074b29f7a01aa6ce63f0afa (diff)
parent35383300f4a420c3dbb878a83d944bb5506f7c7e (diff)
Merge pull request #2118 from inolen/sdl_lazy_init_fix
initialize pixel buffer inside of makeSurface for SDL_SWSURFACE
Diffstat (limited to 'tests/sdl_swsurface.c')
-rw-r--r--tests/sdl_swsurface.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/sdl_swsurface.c b/tests/sdl_swsurface.c
new file mode 100644
index 00000000..93141857
--- /dev/null
+++ b/tests/sdl_swsurface.c
@@ -0,0 +1,22 @@
+#include <assert.h>
+#include <stdio.h>
+#include <SDL/SDL.h>
+
+int main(int argc, char** argv) {
+ SDL_Init(SDL_INIT_VIDEO);
+ SDL_Surface *screen = SDL_SetVideoMode(256, 256, 32, SDL_SWSURFACE);
+
+ // pixels should always be initialized for software surfaces,
+ // without having to call SDL_LockSurface / SDL_UnlockSurface
+ assert(screen->pixels != NULL);
+
+ SDL_Quit();
+
+#if EMSCRIPTEN
+ int result = 1;
+ REPORT_RESULT();
+#endif
+
+ return 0;
+}
+