add testcase gdImageCopyResized
parent
39d8665d06
commit
6271c38065
|
@ -40,6 +40,7 @@ if (BUILD_TEST)
|
|||
gdimagecopymerge
|
||||
gdimagecopymergegray
|
||||
gdimagecopyresampled
|
||||
gdimagecopyresized
|
||||
gdimagecopyrotated
|
||||
gdimagecreate
|
||||
gdimagecrop
|
||||
|
|
|
@ -36,6 +36,7 @@ include gdimagecopy/Makemodule.am
|
|||
include gdimagecopymerge/Makemodule.am
|
||||
include gdimagecopymergegray/Makemodule.am
|
||||
include gdimagecopyresampled/Makemodule.am
|
||||
include gdimagecopyresized/Makemodule.am
|
||||
include gdimagecopyrotated/Makemodule.am
|
||||
include gdimagecreate/Makemodule.am
|
||||
include gdimagecrop/Makemodule.am
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/gdimagecopyresized
|
|
@ -0,0 +1,7 @@
|
|||
IF(PNG_FOUND)
|
||||
LIST(APPEND TESTS_FILES
|
||||
gdimagecopyresized
|
||||
)
|
||||
ENDIF(PNG_FOUND)
|
||||
|
||||
ADD_GD_TESTS()
|
|
@ -0,0 +1,8 @@
|
|||
if HAVE_LIBPNG
|
||||
libgd_test_programs += \
|
||||
gdimagecopyresized/gdimagecopyresized
|
||||
endif
|
||||
|
||||
EXTRA_DIST += \
|
||||
gdimagecopyresized/CMakeLists.txt \
|
||||
gdimagecopyresized/gdimagecopyresized_exp.png
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* add test case for gdImageCopyResized
|
||||
*/
|
||||
|
||||
#include "gd.h"
|
||||
#include "gdtest.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
gdImagePtr src;
|
||||
gdImagePtr dst;
|
||||
gdImagePtr dst_tc;
|
||||
|
||||
/* We prepare two image type: Palette and True Color */
|
||||
/* src image is white, while dst and dst_tc is black */
|
||||
src = gdImageCreate(64, 64);
|
||||
gdImageColorAllocate(src, 255, 255, 255);
|
||||
dst = gdImageCreate(128, 128);
|
||||
gdImageColorAllocate(dst, 0, 0, 0);
|
||||
dst_tc = gdImageCreateTrueColor(128, 128);
|
||||
|
||||
/* Copy src to two image type separately */
|
||||
/* We copy src to the center of dst and dst_tc */
|
||||
gdImageCopyResized(dst, src, 32, 32, 0, 0, 64, 64, 64, 64);
|
||||
gdImageCopyResized(dst_tc, src, 32, 32, 0, 0, 64, 64, 64, 64);
|
||||
|
||||
gdAssertImageEqualsToFile("gdimagecopyresized/gdimagecopyresized_exp.png", dst);
|
||||
gdAssertImageEqualsToFile("gdimagecopyresized/gdimagecopyresized_exp.png", dst_tc);
|
||||
|
||||
gdImageDestroy(src);
|
||||
gdImageDestroy(dst);
|
||||
gdImageDestroy(dst_tc);
|
||||
|
||||
return gdNumFailures();
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 129 B |
Loading…
Reference in New Issue