add testcase for gdimagestring
parent
c456072f43
commit
c6880dc209
|
@ -60,6 +60,7 @@ if (BUILD_TEST)
|
|||
gdimagescale
|
||||
gdimagescatterex
|
||||
gdimagesetpixel
|
||||
gdimagestring
|
||||
gdimagestringft
|
||||
gdimagestringftex
|
||||
gdimagetruecolortopalette
|
||||
|
|
|
@ -56,6 +56,7 @@ include gdimagerotate/Makemodule.am
|
|||
include gdimagescale/Makemodule.am
|
||||
include gdimagescatterex/Makemodule.am
|
||||
include gdimagesetpixel/Makemodule.am
|
||||
include gdimagestring/Makemodule.am
|
||||
include gdimagestringft/Makemodule.am
|
||||
include gdimagestringftex/Makemodule.am
|
||||
include gdimagetruecolortopalette/Makemodule.am
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/gdimagestring
|
|
@ -0,0 +1,7 @@
|
|||
IF(PNG_FOUND)
|
||||
LIST(APPEND TESTS_FILES
|
||||
gdimagestring
|
||||
)
|
||||
ENDIF(PNG_FOUND)
|
||||
|
||||
ADD_GD_TESTS()
|
|
@ -0,0 +1,8 @@
|
|||
if HAVE_LIBPNG
|
||||
libgd_test_programs += \
|
||||
gdimagestring/gdimagestring
|
||||
endif
|
||||
|
||||
EXTRA_DIST += \
|
||||
gdimagestring/CMakeLists.txt \
|
||||
gdimagestring/gdimagestring_exp.png
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Base test for gdImageString()
|
||||
*/
|
||||
#include <gd.h>
|
||||
#include <gdfontl.h>
|
||||
#include "gdtest.h"
|
||||
#include <string.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Declare the image */
|
||||
gdImagePtr im = NULL;
|
||||
char *s = "Hello gd";
|
||||
int foreground = 0;
|
||||
int error = 0;
|
||||
gdFontPtr fontptr = gdFontGetLarge();
|
||||
|
||||
im = gdImageCreate(100, 50);
|
||||
gdImageColorAllocate(im, 202, 202, 0);
|
||||
foreground = gdImageColorAllocate(im, 22, 4, 238);
|
||||
|
||||
gdImageString(im, fontptr,
|
||||
im->sx / 2 - (strlen(s) * fontptr->w / 2),
|
||||
im->sy / 2 - fontptr->h / 2,
|
||||
(unsigned char*)s, foreground);
|
||||
|
||||
if (!gdAssertImageEqualsToFile("gdimagestring/gdimagestring_exp.png", im))
|
||||
error= 1;
|
||||
|
||||
/* Destroy the image in memory. */
|
||||
gdImageDestroy(im);
|
||||
|
||||
return error;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 179 B |
Loading…
Reference in New Issue