diff options
Diffstat (limited to 'tests/gdtransformaffinecopy')
-rw-r--r-- | tests/gdtransformaffinecopy/.gitignore | 1 | ||||
-rw-r--r-- | tests/gdtransformaffinecopy/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/gdtransformaffinecopy/Makemodule.am | 3 | ||||
-rw-r--r-- | tests/gdtransformaffinecopy/github_bug_00585.c | 33 |
4 files changed, 37 insertions, 1 deletions
diff --git a/tests/gdtransformaffinecopy/.gitignore b/tests/gdtransformaffinecopy/.gitignore index a6b56ec..632fc5d 100644 --- a/tests/gdtransformaffinecopy/.gitignore +++ b/tests/gdtransformaffinecopy/.gitignore @@ -1 +1,2 @@ /github_bug_00583 +/github_bug_00585 diff --git a/tests/gdtransformaffinecopy/CMakeLists.txt b/tests/gdtransformaffinecopy/CMakeLists.txt index 69472fb..b2d47c8 100644 --- a/tests/gdtransformaffinecopy/CMakeLists.txt +++ b/tests/gdtransformaffinecopy/CMakeLists.txt @@ -1,5 +1,6 @@ LIST(APPEND TESTS_FILES github_bug_00583 + github_bug_00585 ) ADD_GD_TESTS() diff --git a/tests/gdtransformaffinecopy/Makemodule.am b/tests/gdtransformaffinecopy/Makemodule.am index f86b3c9..f03969d 100644 --- a/tests/gdtransformaffinecopy/Makemodule.am +++ b/tests/gdtransformaffinecopy/Makemodule.am @@ -1,5 +1,6 @@ libgd_test_programs += \ - gdtransformaffinecopy/github_bug_00583 + gdtransformaffinecopy/github_bug_00583 \ + gdtransformaffinecopy/github_bug_00585 EXTRA_DIST += \ gdtransformaffinecopy/CMakeLists.txt diff --git a/tests/gdtransformaffinecopy/github_bug_00585.c b/tests/gdtransformaffinecopy/github_bug_00585.c new file mode 100644 index 0000000..e83910c --- /dev/null +++ b/tests/gdtransformaffinecopy/github_bug_00585.c @@ -0,0 +1,33 @@ +/* + * Test that gdTransformAffineCopy() does not change the interpolation method + * + * See <https://github.com/libgd/libgd/issues/585> + */ + +#include "gd.h" +#include "gdtest.h" + +int main() +{ + gdImagePtr src, dst; + gdRect rect = {0, 0, 8, 8}; + double matrix[] = {1, 1, 1, 1, 1, 1}; + int res; + gdInterpolationMethod old_m, new_m; + + src = gdImageCreateTrueColor(8, 8); + gdTestAssert(src != NULL); + dst = gdImageCreateTrueColor(8, 8); + gdTestAssert(dst != NULL); + + res = gdImageSetInterpolationMethod(src, GD_CATMULLROM); + gdTestAssert(res == GD_TRUE); + old_m = gdImageGetInterpolationMethod(src); + gdTransformAffineCopy(dst, 0, 0, src, &rect, matrix); + new_m = gdImageGetInterpolationMethod(src); + gdTestAssert(new_m == old_m); + + gdImageDestroy(src); + gdImageDestroy(dst); + return gdNumFailures(); +} |