diff options
author | tabe <none@none> | 2009-09-20 10:47:28 +0900 |
---|---|---|
committer | tabe <none@none> | 2009-09-20 10:47:28 +0900 |
commit | 9563181569cfd183260c54ac5c48536264363551 (patch) | |
tree | 7356bb27ca215d0476e895844aea6c33455f62a1 /tests | |
parent | 333bcb2ac1e063c6d8b3765a7d3377b2f89a370c (diff) | |
download | libgd-9563181569cfd183260c54ac5c48536264363551.tar.gz |
adapted Kalle's scatter filter. see FS#208
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/gdimagescatterex/CMakeLists.txt | 11 | ||||
-rw-r--r-- | tests/gdimagescatterex/Makefile.am | 3 | ||||
-rw-r--r-- | tests/gdimagescatterex/bug00208_1.c | 37 | ||||
-rw-r--r-- | tests/gdimagescatterex/bug00208_2.c | 39 |
6 files changed, 92 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 00b7d84..491e001 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -43,6 +43,7 @@ if (BUILD_TEST) gdimageline gdimagepixelate gdimagerectangle + gdimagescatterex gdimagesetpixel gdimagestringft gdimagestringftex diff --git a/tests/Makefile.am b/tests/Makefile.am index 858b48a..2684bc2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -22,6 +22,7 @@ SUBDIRS = gdtest \ gdimageline \ gdimagepixelate \ gdimagerectangle \ + gdimagescatterex \ gdimagesetpixel \ gdimagestringft \ gdimagestringftex \ diff --git a/tests/gdimagescatterex/CMakeLists.txt b/tests/gdimagescatterex/CMakeLists.txt new file mode 100644 index 0000000..507001d --- /dev/null +++ b/tests/gdimagescatterex/CMakeLists.txt @@ -0,0 +1,11 @@ +SET(TESTS_FILES + bug00208_1 + bug00208_2 +) + +FOREACH(test_name ${TESTS_FILES}) + add_executable(${test_name} "${test_name}.c") + target_link_libraries (${test_name} ${GDTESTS_TARGET_LINK}) + get_target_property(test_path ${test_name} LOCATION) + ADD_TEST(${test_name} ${test_path}) +ENDFOREACH(test_name) diff --git a/tests/gdimagescatterex/Makefile.am b/tests/gdimagescatterex/Makefile.am new file mode 100644 index 0000000..16e6eaa --- /dev/null +++ b/tests/gdimagescatterex/Makefile.am @@ -0,0 +1,3 @@ +## Process this file with automake to produce Makefile.in -*-Makefile-*- + +EXTRA_DIST = CMakeLists.txt bug00208_1.c bug00208_2.c bug00208.png bug00208_1.png bug00208_2.png diff --git a/tests/gdimagescatterex/bug00208_1.c b/tests/gdimagescatterex/bug00208_1.c new file mode 100644 index 0000000..0a65ede --- /dev/null +++ b/tests/gdimagescatterex/bug00208_1.c @@ -0,0 +1,37 @@ +#include "gd.h" +#include "gdtest.h" + +int main() +{ + gdImagePtr im; + FILE *fp; + gdScatter s; + + fp = fopen(GDTEST_TOP_DIR "/gdimagescatterex/bug00208.png", "rb"); + if (!fp) { + fprintf(stderr, "could not open file"); + return 1; + } + im = gdImageCreateFromPng(fp); + fclose(fp); + if (!im) { + fprintf(stderr, "could not create image"); + return 1; + } + + s.sub = 1; + s.plus = 3; + s.seed = 0; + s.num_colors = 0; + if (!gdImageScatterEx(im, &s)) { + gdImageDestroy(im); + fprintf(stderr, "could not scatter"); + return 1; + } + + if (!gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimagescatterex/bug00208_1.png", im)) { + gdImageDestroy(im); + return 1; + } + return 0; +} diff --git a/tests/gdimagescatterex/bug00208_2.c b/tests/gdimagescatterex/bug00208_2.c new file mode 100644 index 0000000..bb8af3e --- /dev/null +++ b/tests/gdimagescatterex/bug00208_2.c @@ -0,0 +1,39 @@ +#include "gd.h" +#include "gdtest.h" + +int main() +{ + gdImagePtr im; + FILE *fp; + gdScatter s; + int colors[] = {0xFF0000, 0x00FF00}; + + fp = fopen(GDTEST_TOP_DIR "/gdimagescatterex/bug00208.png", "rb"); + if (!fp) { + fprintf(stderr, "could not open file"); + return 1; + } + im = gdImageCreateFromPng(fp); + fclose(fp); + if (!im) { + fprintf(stderr, "could not create image"); + return 1; + } + + s.sub = 1; + s.plus = 3; + s.seed = 0; + s.num_colors = 2; + s.colors = colors; + if (!gdImageScatterEx(im, &s)) { + gdImageDestroy(im); + fprintf(stderr, "could not scatter"); + return 1; + } + + if (!gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimagescatterex/bug00208_2.png", im)) { + gdImageDestroy(im); + return 1; + } + return 0; +} |