diff options
author | willson-chen <willson.chenwx@gmail.com> | 2019-11-14 16:04:16 +0800 |
---|---|---|
committer | Mike Frysinger <vapier@gmail.com> | 2019-11-28 13:27:29 -0500 |
commit | b5a5d9820957fc3a8a02a51c2a7215212cf618be (patch) | |
tree | 226bafbe136ebb93af220d5b8b879e96a1b413a8 /tests | |
parent | c3a77b5a3bf574af4f53ba4d106d5c5751048ef2 (diff) | |
download | libgd-b5a5d9820957fc3a8a02a51c2a7215212cf618be.tar.gz |
add testcase for gdImageColorMatch
add testcase for gdImageColorMatch
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/gdimagecolormatch/.gitignore | 1 | ||||
-rw-r--r-- | tests/gdimagecolormatch/CMakeLists.txt | 5 | ||||
-rw-r--r-- | tests/gdimagecolormatch/Makemodule.am | 5 | ||||
-rw-r--r-- | tests/gdimagecolormatch/gdimagecolormatch.c | 32 |
6 files changed, 45 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 80bf9be..757cddc 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -29,6 +29,7 @@ if (BUILD_TEST) gdimagecolorclosest gdimagecolordeallocate gdimagecolorexact + gdimagecolormatch gdimagecolorreplace gdimagecolorresolve gdimagecolortransparent diff --git a/tests/Makefile.am b/tests/Makefile.am index 09c9c2d..d0e4273 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -25,6 +25,7 @@ include gdimagecolor/Makemodule.am include gdimagecolorclosest/Makemodule.am include gdimagecolordeallocate/Makemodule.am include gdimagecolorexact/Makemodule.am +include gdimagecolormatch/Makemodule.am include gdimagecolorreplace/Makemodule.am include gdimagecolorresolve/Makemodule.am include gdimagecolortransparent/Makemodule.am diff --git a/tests/gdimagecolormatch/.gitignore b/tests/gdimagecolormatch/.gitignore new file mode 100644 index 0000000..b1540a2 --- /dev/null +++ b/tests/gdimagecolormatch/.gitignore @@ -0,0 +1 @@ +/gdimagecolormatch diff --git a/tests/gdimagecolormatch/CMakeLists.txt b/tests/gdimagecolormatch/CMakeLists.txt new file mode 100644 index 0000000..6a191dc --- /dev/null +++ b/tests/gdimagecolormatch/CMakeLists.txt @@ -0,0 +1,5 @@ +LIST(APPEND TESTS_FILES + gdimagecolormatch +) + +ADD_GD_TESTS() diff --git a/tests/gdimagecolormatch/Makemodule.am b/tests/gdimagecolormatch/Makemodule.am new file mode 100644 index 0000000..db6c3d4 --- /dev/null +++ b/tests/gdimagecolormatch/Makemodule.am @@ -0,0 +1,5 @@ +libgd_test_programs += \ + gdimagecolormatch/gdimagecolormatch + +EXTRA_DIST += \ + gdimagecolormatch/CMakeLists.txt diff --git a/tests/gdimagecolormatch/gdimagecolormatch.c b/tests/gdimagecolormatch/gdimagecolormatch.c new file mode 100644 index 0000000..f59c769 --- /dev/null +++ b/tests/gdimagecolormatch/gdimagecolormatch.c @@ -0,0 +1,32 @@ +/** + * Basic test for gdImageColorMatch() + **/ +#include "gd.h" +#include "gdtest.h" + +int main(){ + gdImagePtr im1, im2; + + im1 = gdImageCreateTrueColor(80, 80); + im2 = gdImageCreate(80, 80); + + gdImageColorAllocate(im1, 255, 36, 74); + + gdImageColorAllocate(im2, 255, 36, 74); + gdImageColorAllocate(im2, 40, 0, 240); + gdImageColorAllocate(im2, 255, 100, 255); + gdImageColorAllocate(im2, 80, 60, 44); + + int ifMatch = gdImageColorMatch(im1, im2); + + gdImageDestroy(im1); + gdImageDestroy(im2); + + if (gdTestAssert(ifMatch != 0)) + { + gdTestErrorMsg("gdImageColorMatch failed.\n"); + return 1; + } + + return 0; +} |