add testcase for gdImageCopyMergeGray

master
wilson chen 2019-11-28 13:04:08 +08:00 committed by Mike Frysinger
parent c6880dc209
commit 39facb195f
7 changed files with 56 additions and 0 deletions

View File

@ -36,6 +36,7 @@ if (BUILD_TEST)
gdimageconvolution
gdimagecopy
gdimagecopymerge
gdimagecopymergegray
gdimagecopyresampled
gdimagecopyrotated
gdimagecreate

View File

@ -32,6 +32,7 @@ include gdimagecontrast/Makemodule.am
include gdimageconvolution/Makemodule.am
include gdimagecopy/Makemodule.am
include gdimagecopymerge/Makemodule.am
include gdimagecopymergegray/Makemodule.am
include gdimagecopyresampled/Makemodule.am
include gdimagecopyrotated/Makemodule.am
include gdimagecreate/Makemodule.am

1
tests/gdimagecopymergegray/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/gdimagecopymergegray

View File

@ -0,0 +1,7 @@
IF(PNG_FOUND)
LIST(APPEND TESTS_FILES
gdimagecopymergegray
)
ENDIF(PNG_FOUND)
ADD_GD_TESTS()

View File

@ -0,0 +1,8 @@
if HAVE_LIBPNG
libgd_test_programs += \
gdimagecopymergegray/gdimagecopymergegray
endif
EXTRA_DIST += \
gdimagecopymergegray/CMakeLists.txt \
gdimagecopymergegray/gdimagecopymergegray_exp.png

View File

@ -0,0 +1,38 @@
/**
* Basic test for gdImageCopyMergeGray()
*/
#include "gd.h"
#include "gdtest.h"
int main()
{
gdImagePtr dst = NULL;
gdImagePtr src = NULL;
int error = 0;
dst = gdImageCreate(100, 100);
src = gdImageCreate(50, 50);
if (gdTestAssert(!dst)) {
error = 1;
goto done;
}
if (gdTestAssert(!src)) {
error = 1;
goto done;
}
gdImageColorAllocate(src, 255, 255, 255);
gdImageColorAllocate(dst, 0, 0, 0);
gdImageCopyMergeGray(dst, src, 25, 25, 0, 0, 50, 50, 50);
if (!gdAssertImageEqualsToFile("gdimagecopymergegray/gdimagecopymergegray_exp.png", dst)) {
error = 1;
}
done:
gdImageDestroy(dst);
gdImageDestroy(src);
return error;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B