diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-02-16 01:04:51 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-02-16 01:04:51 +0000 |
commit | eacd1b8f5c8024296c6fa4b19b3b99bd24de91a1 (patch) | |
tree | c0350d7eba85bcb5c01342bfef2f21d34b83c8bd /Build/source/libs/gd/libgd-src/tests/gdimagerotate | |
parent | 08bed0cad41932663940d45d7fcc96986c2cca3c (diff) |
libs/gd: new convention
git-svn-id: svn://tug.org/texlive/trunk@39737 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/gd/libgd-src/tests/gdimagerotate')
18 files changed, 125 insertions, 0 deletions
diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067.c b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067.c new file mode 100644 index 00000000000..4a6595988b9 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/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; + int error = 0; + int angle; + + 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; + } + + for (angle = 0; angle <= 180; angle += 15) { + + exp = gdImageRotateInterpolated(im, angle, color); + + if (!exp) { + gdTestErrorMsg("rotating image failed for %03d.\n", angle); + 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/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_000_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_000_exp.png Binary files differnew file mode 100644 index 00000000000..d06b5fe58fb --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_000_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_015_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_015_exp.png Binary files differnew file mode 100644 index 00000000000..a0f8ce2efae --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_015_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_030_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_030_exp.png Binary files differnew file mode 100644 index 00000000000..aad7f4ccb67 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_030_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_045_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_045_exp.png Binary files differnew file mode 100644 index 00000000000..75916a51649 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_045_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_060_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_060_exp.png Binary files differnew file mode 100644 index 00000000000..f24364a062f --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_060_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_075_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_075_exp.png Binary files differnew file mode 100644 index 00000000000..f8dcf449086 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_075_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_090_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_090_exp.png Binary files differnew file mode 100644 index 00000000000..a971447c7b2 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_090_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_105_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_105_exp.png Binary files differnew file mode 100644 index 00000000000..2cf641d85a8 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_105_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_120_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_120_exp.png Binary files differnew file mode 100644 index 00000000000..1890f92545c --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_120_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_135_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_135_exp.png Binary files differnew file mode 100644 index 00000000000..34ccb0aa054 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_135_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_150_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_150_exp.png Binary files differnew file mode 100644 index 00000000000..330d030a7fa --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_150_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_165_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_165_exp.png Binary files differnew file mode 100644 index 00000000000..df5b6400bc2 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_165_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_180_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_180_exp.png Binary files differnew file mode 100644 index 00000000000..d4f65983615 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_180_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898.c b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898.c new file mode 100644 index 00000000000..9bbd98b5313 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898.c @@ -0,0 +1,58 @@ +#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/php_bug_64898.png"; + const char *file_exp = "gdimagerotate/php_bug_64898_exp.png"; + FILE *fp; + int color; + + sprintf(path, "%s/%s", GDTEST_TOP_DIR, file_im); + + fp = fopen(path, "rb"); + + if (!fp) { + gdTestErrorMsg("opening PNG %s for reading failed.\n", path); + return 1; + } + + im = gdImageCreateTrueColor(141, 200); + + if (!im) { + gdTestErrorMsg("loading %s failed.\n", path); + return 1; + } + + gdImageFilledRectangle(im, 0, 0, 140, 199, 0x00ffffff); + +/* Try default interpolation method, but any non-optimized fails */ +/* gdImageSetInterpolationMethod(im, GD_BICUBIC_FIXED); */ + + exp = gdImageRotateInterpolated(im, 45, 0x0); + + if (!exp) { + gdTestErrorMsg("rotating image failed.\n"); + gdImageDestroy(im); + return 1; + } + + sprintf(path, "%s/%s", GDTEST_TOP_DIR, file_exp); + + if (!gdAssertImageEqualsToFile(path, exp)) { + printf("comparing rotated image to %s failed.\n", path); + gdImageDestroy(im); + gdImageDestroy(exp); + return 1; + } + + gdImageDestroy(exp); + gdImageDestroy(im); + + return 0; +} diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898.png Binary files differnew file mode 100644 index 00000000000..089680a248c --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898_exp.png Binary files differnew file mode 100644 index 00000000000..a03bdb8e9d6 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/remirh128.jpg b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/remirh128.jpg Binary files differnew file mode 100644 index 00000000000..bd5e3c77e3c --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/remirh128.jpg |