diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-05-16 14:07:31 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-05-16 14:07:31 -0700 |
commit | 56cd48e0e1d78f539079dcdb20cf043ae8cf4b4b (patch) | |
tree | 0f27e3c9403c8b2fd121109121c75c126812b13f | |
parent | c8424ffa1546c67eb2c08cb1860630a99b2efd22 (diff) |
fix test_sdl_alloctext
-rw-r--r-- | src/library_sdl.js | 3 | ||||
-rw-r--r-- | tests/sdl_alloctext.c | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 7fad5941..75544765 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -549,6 +549,9 @@ var LibrarySDL = { var h = fontData.size; var fontString = h + 'px ' + fontData.name; var tempCtx = SDL.ttfContext; +#if ASSERTIONS + assert(tempCtx, 'TTF_Init must have been called'); +#endif tempCtx.save(); tempCtx.font = fontString; var ret = tempCtx.measureText(text).width | 0; diff --git a/tests/sdl_alloctext.c b/tests/sdl_alloctext.c index 3def2b28..173be348 100644 --- a/tests/sdl_alloctext.c +++ b/tests/sdl_alloctext.c @@ -9,6 +9,7 @@ int main() SDL_Init(SDL_INIT_VIDEO); SDL_Surface *screen = SDL_SetVideoMode(600, 450, 32, SDL_HWSURFACE); + TTF_Init(); TTF_Font *font = TTF_OpenFont("myfont.ttf", 40); int i = 0; |