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; +}