add testcase for gdimagestringup
parent
fac913b874
commit
c3a77b5a3b
|
@ -65,6 +65,7 @@ if (BUILD_TEST)
|
|||
gdimagestring16
|
||||
gdimagestringft
|
||||
gdimagestringftex
|
||||
gdimagestringup
|
||||
gdimagestringup16
|
||||
gdimagetruecolortopalette
|
||||
gdinterpolatedscale
|
||||
|
|
|
@ -61,6 +61,7 @@ include gdimagestring/Makemodule.am
|
|||
include gdimagestring16/Makemodule.am
|
||||
include gdimagestringft/Makemodule.am
|
||||
include gdimagestringftex/Makemodule.am
|
||||
include gdimagestringup/Makemodule.am
|
||||
include gdimagestringup16/Makemodule.am
|
||||
include gdimagetruecolortopalette/Makemodule.am
|
||||
include gdinterpolatedscale/Makemodule.am
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/gdimagestringup
|
|
@ -0,0 +1,7 @@
|
|||
IF(PNG_FOUND)
|
||||
LIST(APPEND TESTS_FILES
|
||||
gdimagestringup
|
||||
)
|
||||
ENDIF(PNG_FOUND)
|
||||
|
||||
ADD_GD_TESTS()
|
|
@ -0,0 +1,8 @@
|
|||
if HAVE_LIBPNG
|
||||
libgd_test_programs += \
|
||||
gdimagestringup/gdimagestringup
|
||||
endif
|
||||
|
||||
EXTRA_DIST += \
|
||||
gdimagestringup/CMakeLists.txt \
|
||||
gdimagestringup/gdimagestringup_exp.png
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Base test for gdImageStringUp()
|
||||
*/
|
||||
#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 errorcode = 0;
|
||||
int foreground;
|
||||
gdFontPtr fontptr = gdFontGetLarge();
|
||||
|
||||
im = gdImageCreate(50, 100);
|
||||
gdImageColorAllocate(im, 202, 202, 0);
|
||||
foreground = gdImageColorAllocate(im, 22, 4, 238);
|
||||
|
||||
gdImageStringUp(im, fontptr,
|
||||
im->sx / 2 - fontptr->h / 2,
|
||||
im->sy / 2 + (strlen(s) * fontptr->w / 2),
|
||||
(unsigned char*)s, foreground);
|
||||
|
||||
if (!gdAssertImageEqualsToFile("gdimagestringup/gdimagestringup_exp.png", im))
|
||||
errorcode = 1;
|
||||
|
||||
/* Destroy the image im memory */
|
||||
gdImageDestroy(im);
|
||||
|
||||
return errorcode;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 180 B |
Loading…
Reference in New Issue