Added a function to clean up test text drawing

Sam Lantinga 2017-09-08 04:14:05 -07:00
parent ca15c7d67f
commit b0b3da7702
15 changed files with 64 additions and 22 deletions

View File

@ -50,7 +50,7 @@ extern "C" {
*
* \returns Returns 0 on success, -1 on failure.
*/
int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c );
int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c);
/**
* \brief Draw a string in the currently set font.
@ -62,9 +62,14 @@ int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c );
*
* \returns Returns 0 on success, -1 on failure.
*/
int SDLTest_DrawString( SDL_Renderer * renderer, int x, int y, const char *s );
int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
/**
* \brief Cleanup textures used by font drawing functions.
*/
void SDLTest_CleanupTextDrawing(SDL_Renderer *renderer);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}

View File

@ -148,3 +148,5 @@ int SDLTest_AssertSummaryToTestResult()
}
}
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -113,3 +113,5 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface,
return ret;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -164,3 +164,5 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext)
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -3236,3 +3236,15 @@ int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s)
return (result);
}
void SDLTest_CleanupTextDrawing(SDL_Renderer *renderer)
{
int i;
for (i = 0; i < SDL_ARRAYSIZE(SDLTest_CharTextureCache); ++i) {
if (SDLTest_CharTextureCache[i]) {
SDL_TextureDestroy(SDLTest_CharTextureCache[i]);
SDLTest_CharTextureCache[i] = NULL;
}
}
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -524,3 +524,5 @@ SDLTest_RandomAsciiStringOfSize(int size)
return string;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -676,3 +676,5 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
SDLTest_Log("Exit code: %d", runResult);
return runResult;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1555,3 +1555,5 @@ SDL_Surface *SDLTest_ImageBlitAlpha()
);
return surface;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -2841,3 +2841,5 @@ SDL_Surface *SDLTest_ImageBlitBlendAll()
);
return surface;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -244,3 +244,4 @@ SDL_Surface *SDLTest_ImageFace()
return surface;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -510,3 +510,5 @@ SDL_Surface *SDLTest_ImagePrimitives()
);
return surface;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -692,3 +692,5 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend()
);
return surface;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -114,3 +114,5 @@ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
/* Log with timestamp and newline */
SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage);
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -334,3 +334,5 @@ static void SDLTest_Md5Transform(MD5UINT4 * buf, MD5UINT4 * in)
buf[2] += c;
buf[3] += d;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -92,3 +92,5 @@ unsigned int SDLTest_Random(SDLTest_RandomContext * rndContext)
rndContext->c++;
return (rndContext->x);
}
/* vi: set ts=4 sw=4 expandtab: */