diff options
author | willson-chen <willson.chenwx@gmail.com> | 2019-12-13 04:26:40 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2019-12-13 10:54:25 +0100 |
commit | 4b0f3724022ad5bdf16d86409126436ff5a31afb (patch) | |
tree | 9b0d4bca49618b62d7bfa429b4328d8f26e6ea39 /tests | |
parent | b9004db6a2e6073b5089cf31b7562bb909fb0718 (diff) | |
download | libgd-4b0f3724022ad5bdf16d86409126436ff5a31afb.tar.gz |
Fixed #369: fix new_a init error in gdImageConvolution()
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gdimageconvolution/.gitignore | 1 | ||||
-rw-r--r-- | tests/gdimageconvolution/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/gdimageconvolution/Makemodule.am | 3 | ||||
-rw-r--r-- | tests/gdimageconvolution/bug00369.c | 28 |
4 files changed, 34 insertions, 0 deletions
diff --git a/tests/gdimageconvolution/.gitignore b/tests/gdimageconvolution/.gitignore index 1ffd796..6665df0 100644 --- a/tests/gdimageconvolution/.gitignore +++ b/tests/gdimageconvolution/.gitignore @@ -1 +1,2 @@ /basic +/bug00369 diff --git a/tests/gdimageconvolution/CMakeLists.txt b/tests/gdimageconvolution/CMakeLists.txt index 802c382..dc1fc51 100644 --- a/tests/gdimageconvolution/CMakeLists.txt +++ b/tests/gdimageconvolution/CMakeLists.txt @@ -1,3 +1,5 @@ +LIST(APPEND TESTS_FILES bug00369) + IF(PNG_FOUND) LIST(APPEND TESTS_FILES basic diff --git a/tests/gdimageconvolution/Makemodule.am b/tests/gdimageconvolution/Makemodule.am index 8f65b0f..df5249d 100644 --- a/tests/gdimageconvolution/Makemodule.am +++ b/tests/gdimageconvolution/Makemodule.am @@ -1,3 +1,6 @@ +libgd_test_programs += \ + gdimageconvolution/bug00369 + if HAVE_LIBPNG libgd_test_programs += \ gdimageconvolution/basic diff --git a/tests/gdimageconvolution/bug00369.c b/tests/gdimageconvolution/bug00369.c new file mode 100644 index 0000000..631cb7a --- /dev/null +++ b/tests/gdimageconvolution/bug00369.c @@ -0,0 +1,28 @@ +/** + * Test Issue #369 for gdImageConvolution() + */ + +#include "gd.h" +#include "gdtest.h" + +int main() +{ + gdImagePtr im; + float matrix[3][3] = { + {1, 0, 1}, + {0, 5, 0}, + {1, 0, 0} + }; + + im = gdImageCreateTrueColor(40, 40); + gdImageAlphaBlending(im, gdEffectReplace); + gdImageFilledRectangle(im, 0, 0, 39, 39, 0x7FFFFFFF); + gdImageFilledEllipse(im, 19, 19, 20, 20, 0x00FF00); + + gdImageConvolution(im, matrix, 9, 1); + gdTestAssert(0x7F010101 == gdImageGetPixel(im, 0, 0)); + + gdImageDestroy(im); + + return gdNumFailures(); +} |