diff options
17 files changed, 87 insertions, 3 deletions
@@ -200,3 +200,4 @@ Makefile.in /tests/gdimagerotate/php_bug_64898 /tests/php_bug_64898.c_55_diff.png /tests/php_bug_64898.c_55_out.png +/tests/gdimagerotate/bug00067 diff --git a/tests/Makefile.am b/tests/Makefile.am index df1ee62..4e594f2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -96,7 +96,8 @@ EXTRA_PROGRAMS = \ gdimagescatterex/bug00208_1 \ gdimagescatterex/bug00208_2 \ gdimagefilltoborder/bug00037 \ - gdimagerotate/php_bug_64898 + gdimagerotate/php_bug_64898 \ + gdimagerotate/bug00067 if HAVE_LIBXPM check_PROGRAMS += \ @@ -180,7 +181,8 @@ check_PROGRAMS += \ gdimagescatterex/bug00208_1 \ gdimagescatterex/bug00208_2 \ gdimagefilltoborder/bug00037 \ - gdimagerotate/php_bug_64898 + gdimagerotate/php_bug_64898 \ + gdimagerotate/bug00067 endif if HAVE_LIBTIFF @@ -305,7 +307,21 @@ EXTRA_DIST = \ gdimagefilltoborder/CMakeLists.txt \ freetype/CMakeLists.txt \ gdimagerotate/php_bug_64898.png \ - gdimagerotate/php_bug_64898_exp.png + gdimagerotate/php_bug_64898_exp.png \ + gdimagerotate/remirh128.jpg \ + gdimagerotate/php_bug_64898_000_exp.png \ + gdimagerotate/php_bug_64898_015_exp.png \ + gdimagerotate/php_bug_64898_030_exp.png \ + gdimagerotate/php_bug_64898_045_exp.png \ + gdimagerotate/php_bug_64898_060_exp.png \ + gdimagerotate/php_bug_64898_075_exp.png \ + gdimagerotate/php_bug_64898_090_exp.png \ + gdimagerotate/php_bug_64898_105_exp.png \ + gdimagerotate/php_bug_64898_120_exp.png \ + gdimagerotate/php_bug_64898_135_exp.png \ + gdimagerotate/php_bug_64898_150_exp.png \ + gdimagerotate/php_bug_64898_165_exp.png \ + gdimagerotate/php_bug_64898_180_exp.png CLEANFILES = \ a.png \ diff --git a/tests/gdimagerotate/bug00067.c b/tests/gdimagerotate/bug00067.c new file mode 100644 index 0000000..5d24172 --- /dev/null +++ b/tests/gdimagerotate/bug00067.c @@ -0,0 +1,67 @@ +#include <stdio.h> +#include <stdlib.h> +#include "gd.h" + +#include "gdtest.h" + +int main() +{ + gdImagePtr im, exp; + char path[2048]; + const char *file_im = "gdimagerotate/remirh128.jpg"; + const char *file_exp = "gdimagerotate/bug00067"; + FILE *fp; + int color; + + sprintf(path, "%s/%s", GDTEST_TOP_DIR, file_im); + + fp = fopen(path, "rb"); + + if (!fp) { + gdTestErrorMsg("opening Jpeg %s for reading failed.\n", path); + return 1; + } + + im = gdImageCreateFromJpeg(fp); + + fclose(fp); + + if (!im) { + gdTestErrorMsg("loading %s failed.\n", path); + return 1; + } + + color = gdImageColorAllocate(im, 0, 0, 0); + + if (color < 0) { + gdTestErrorMsg("allocation color from image failed.\n"); + gdImageDestroy(im); + return 1; + } + + int error = 0; + + for (int angle = 0; angle <= 180; angle += 15) { + + exp = gdImageRotateInterpolated(im, angle, color); + + if (!exp) { + gdTestErrorMsg("rotating image failed.\n"); + gdImageDestroy(im); + return 1; + } + + sprintf(path, "%s/%s_%03d_exp.png", GDTEST_TOP_DIR, file_exp, angle); + + if (!gdAssertImageEqualsToFile(path, exp)) { + gdTestErrorMsg("comparing rotated image to %s failed.\n", path); + error += 1; + } + + gdImageDestroy(exp); + } + + gdImageDestroy(im); + + return error; +} diff --git a/tests/gdimagerotate/bug00067_000_exp.png b/tests/gdimagerotate/bug00067_000_exp.png Binary files differnew file mode 100644 index 0000000..cb87846 --- /dev/null +++ b/tests/gdimagerotate/bug00067_000_exp.png diff --git a/tests/gdimagerotate/bug00067_015_exp.png b/tests/gdimagerotate/bug00067_015_exp.png Binary files differnew file mode 100644 index 0000000..c0b9b6e --- /dev/null +++ b/tests/gdimagerotate/bug00067_015_exp.png diff --git a/tests/gdimagerotate/bug00067_030_exp.png b/tests/gdimagerotate/bug00067_030_exp.png Binary files differnew file mode 100644 index 0000000..cdab559 --- /dev/null +++ b/tests/gdimagerotate/bug00067_030_exp.png diff --git a/tests/gdimagerotate/bug00067_045_exp.png b/tests/gdimagerotate/bug00067_045_exp.png Binary files differnew file mode 100644 index 0000000..3747b5f --- /dev/null +++ b/tests/gdimagerotate/bug00067_045_exp.png diff --git a/tests/gdimagerotate/bug00067_060_exp.png b/tests/gdimagerotate/bug00067_060_exp.png Binary files differnew file mode 100644 index 0000000..178c202 --- /dev/null +++ b/tests/gdimagerotate/bug00067_060_exp.png diff --git a/tests/gdimagerotate/bug00067_075_exp.png b/tests/gdimagerotate/bug00067_075_exp.png Binary files differnew file mode 100644 index 0000000..91b4eba --- /dev/null +++ b/tests/gdimagerotate/bug00067_075_exp.png diff --git a/tests/gdimagerotate/bug00067_090_exp.png b/tests/gdimagerotate/bug00067_090_exp.png Binary files differnew file mode 100644 index 0000000..a971447 --- /dev/null +++ b/tests/gdimagerotate/bug00067_090_exp.png diff --git a/tests/gdimagerotate/bug00067_105_exp.png b/tests/gdimagerotate/bug00067_105_exp.png Binary files differnew file mode 100644 index 0000000..a6deb1d --- /dev/null +++ b/tests/gdimagerotate/bug00067_105_exp.png diff --git a/tests/gdimagerotate/bug00067_120_exp.png b/tests/gdimagerotate/bug00067_120_exp.png Binary files differnew file mode 100644 index 0000000..a4d07f1 --- /dev/null +++ b/tests/gdimagerotate/bug00067_120_exp.png diff --git a/tests/gdimagerotate/bug00067_135_exp.png b/tests/gdimagerotate/bug00067_135_exp.png Binary files differnew file mode 100644 index 0000000..9fbf1d3 --- /dev/null +++ b/tests/gdimagerotate/bug00067_135_exp.png diff --git a/tests/gdimagerotate/bug00067_150_exp.png b/tests/gdimagerotate/bug00067_150_exp.png Binary files differnew file mode 100644 index 0000000..6283143 --- /dev/null +++ b/tests/gdimagerotate/bug00067_150_exp.png diff --git a/tests/gdimagerotate/bug00067_165_exp.png b/tests/gdimagerotate/bug00067_165_exp.png Binary files differnew file mode 100644 index 0000000..567f3b4 --- /dev/null +++ b/tests/gdimagerotate/bug00067_165_exp.png diff --git a/tests/gdimagerotate/bug00067_180_exp.png b/tests/gdimagerotate/bug00067_180_exp.png Binary files differnew file mode 100644 index 0000000..d4f6598 --- /dev/null +++ b/tests/gdimagerotate/bug00067_180_exp.png diff --git a/tests/gdimagerotate/remirh128.jpg b/tests/gdimagerotate/remirh128.jpg Binary files differnew file mode 100644 index 0000000..bd5e3c7 --- /dev/null +++ b/tests/gdimagerotate/remirh128.jpg |