diff options
author | willson-chen <willson.chenwx@gmail.com> | 2019-11-15 17:56:54 +0800 |
---|---|---|
committer | Mike Frysinger <vapier@gmail.com> | 2019-11-28 13:28:41 -0500 |
commit | b9004db6a2e6073b5089cf31b7562bb909fb0718 (patch) | |
tree | fa5c8e4af650c2ab2aa525c517bad652e63db4d0 /tests | |
parent | b5a5d9820957fc3a8a02a51c2a7215212cf618be (diff) | |
download | libgd-b9004db6a2e6073b5089cf31b7562bb909fb0718.tar.gz |
add testcase for gdImageColorClosestHWB
add testcase for gdImageColorClosestHWB
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/gdimagecolorclosesthwb/.gitignore | 1 | ||||
-rw-r--r-- | tests/gdimagecolorclosesthwb/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/gdimagecolorclosesthwb/Makemodule.am | 7 | ||||
-rw-r--r-- | tests/gdimagecolorclosesthwb/gdImageColorClosestHWB.c | 26 |
6 files changed, 43 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 757cddc..05904cd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -27,6 +27,7 @@ if (BUILD_TEST) gdimageclone gdimagecolor gdimagecolorclosest + gdimagecolorclosesthwb gdimagecolordeallocate gdimagecolorexact gdimagecolormatch diff --git a/tests/Makefile.am b/tests/Makefile.am index d0e4273..f672032 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -23,6 +23,7 @@ include gdimagebrightness/Makemodule.am include gdimageclone/Makemodule.am include gdimagecolor/Makemodule.am include gdimagecolorclosest/Makemodule.am +include gdimagecolorclosesthwb/Makemodule.am include gdimagecolordeallocate/Makemodule.am include gdimagecolorexact/Makemodule.am include gdimagecolormatch/Makemodule.am diff --git a/tests/gdimagecolorclosesthwb/.gitignore b/tests/gdimagecolorclosesthwb/.gitignore new file mode 100644 index 0000000..f46016c --- /dev/null +++ b/tests/gdimagecolorclosesthwb/.gitignore @@ -0,0 +1 @@ +/gdImageColorClosestHWB diff --git a/tests/gdimagecolorclosesthwb/CMakeLists.txt b/tests/gdimagecolorclosesthwb/CMakeLists.txt new file mode 100644 index 0000000..7a8afdc --- /dev/null +++ b/tests/gdimagecolorclosesthwb/CMakeLists.txt @@ -0,0 +1,7 @@ +IF(PNG_FOUND) +LIST(APPEND TESTS_FILES + gdImageColorClosestHWB +) +ENDIF(PNG_FOUND) + +ADD_GD_TESTS() diff --git a/tests/gdimagecolorclosesthwb/Makemodule.am b/tests/gdimagecolorclosesthwb/Makemodule.am new file mode 100644 index 0000000..14eddbd --- /dev/null +++ b/tests/gdimagecolorclosesthwb/Makemodule.am @@ -0,0 +1,7 @@ +if HAVE_LIBPNG +libgd_test_programs += \ + gdimagecolorclosesthwb/gdImageColorClosestHWB +endif + +EXTRA_DIST += \ + gdimagecolorclosesthwb/CMakeLists.txt diff --git a/tests/gdimagecolorclosesthwb/gdImageColorClosestHWB.c b/tests/gdimagecolorclosesthwb/gdImageColorClosestHWB.c new file mode 100644 index 0000000..ab20187 --- /dev/null +++ b/tests/gdimagecolorclosesthwb/gdImageColorClosestHWB.c @@ -0,0 +1,26 @@ +/** + * Basic test for gdImageColorClosestHWB() + **/ +#include "gd.h" +#include "gdtest.h" + +int main() +{ + gdImagePtr im; + FILE *fp; + + fp = gdTestFileOpen2("gdimageflip", "remi.png"); + im = gdImageCreateFromPng(fp); + fclose(fp); + + int result = gdImageColorClosestHWB(im, 255, 0, 255); + + if (gdTestAssert(result <= 0)) + { + gdImageDestroy(im); + return 1; + } + + gdImageDestroy(im); + return 0; +} |