summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-src/tests/gdimagerotate
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-02-16 01:04:51 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-02-16 01:04:51 +0000
commiteacd1b8f5c8024296c6fa4b19b3b99bd24de91a1 (patch)
treec0350d7eba85bcb5c01342bfef2f21d34b83c8bd /Build/source/libs/gd/libgd-src/tests/gdimagerotate
parent08bed0cad41932663940d45d7fcc96986c2cca3c (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')
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067.c67
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_000_exp.pngbin0 -> 30195 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_015_exp.pngbin0 -> 34731 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_030_exp.pngbin0 -> 36734 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_045_exp.pngbin0 -> 36631 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_060_exp.pngbin0 -> 36759 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_075_exp.pngbin0 -> 34775 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_090_exp.pngbin0 -> 30955 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_105_exp.pngbin0 -> 35010 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_120_exp.pngbin0 -> 36899 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_135_exp.pngbin0 -> 37111 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_150_exp.pngbin0 -> 36771 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_165_exp.pngbin0 -> 34593 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_180_exp.pngbin0 -> 30299 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898.c58
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898.pngbin0 -> 1191 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898_exp.pngbin0 -> 6363 bytes
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagerotate/remirh128.jpgbin0 -> 10619 bytes
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
new file mode 100644
index 00000000000..d06b5fe58fb
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_000_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..a0f8ce2efae
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_015_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..aad7f4ccb67
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_030_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..75916a51649
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_045_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..f24364a062f
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_060_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..f8dcf449086
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_075_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..a971447c7b2
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_090_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..2cf641d85a8
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_105_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..1890f92545c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_120_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..34ccb0aa054
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_135_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..330d030a7fa
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_150_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..df5b6400bc2
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_165_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..d4f65983615
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/bug00067_180_exp.png
Binary files differ
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
new file mode 100644
index 00000000000..089680a248c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898.png
Binary files differ
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
new file mode 100644
index 00000000000..a03bdb8e9d6
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/php_bug_64898_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagerotate/remirh128.jpg b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/remirh128.jpg
new file mode 100644
index 00000000000..bd5e3c77e3c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagerotate/remirh128.jpg
Binary files differ