Commits

Ondřej Surý committed 030f1d1

Move new test to gdimagerotate dir to allow adding more tests

Comments (0)

Files changed (8)

 /tests/jpeg_read.c_28_diff.png
 /tests/jpeg_read.c_28_out.png
 /tests/test_config.h
-/tests/gdinterpolation/php_bug_64898
+/tests/gdimagerotate/php_bug_64898
 /tests/php_bug_64898.c_55_diff.png
 /tests/php_bug_64898.c_55_out.png

tests/Makefile.am

 	gdimagescatterex/bug00208_1 \
 	gdimagescatterex/bug00208_2 \
 	gdimagefilltoborder/bug00037 \
-	gdinterpolation/php_bug_64898
+	gdimagerotate/php_bug_64898
 
 if HAVE_LIBXPM
 check_PROGRAMS += \
 	gdimagescatterex/bug00208_1 \
 	gdimagescatterex/bug00208_2 \
 	gdimagefilltoborder/bug00037 \
-	gdinterpolation/php_bug_64898
+	gdimagerotate/php_bug_64898
 endif
 
 if HAVE_LIBTIFF
 	gdimagescatterex/CMakeLists.txt \
 	gdimagefilltoborder/CMakeLists.txt \
 	freetype/CMakeLists.txt \
-	gdinterpolation/php_bug_64898.png \
-	gdinterpolation/php_bug_64898_exp.png
+	gdimagerotate/php_bug_64898.png \
+	gdimagerotate/php_bug_64898_exp.png
 
 CLEANFILES = \
 	a.png \

tests/gdimagerotate/php_bug_64898.c

+#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 = gdImageCreateFromPng(fp);
+
+	fclose(fp);
+
+	if (!im) {
+		gdTestErrorMsg("loading %s failed.\n", path);
+		return 1;
+	}
+
+	color = gdImageColorAllocate(im, 255, 255, 255);
+
+	if (color < 0) {
+		gdTestErrorMsg("allocation color from image failed.\n");
+		gdFree(im);
+		return 1;
+	}
+
+/*	Try default interpolation method, but any non-optimized fails */
+/*	gdImageSetInterpolationMethod(im, GD_BICUBIC_FIXED); */
+
+	exp = gdImageRotateInterpolated(im, 45, color);
+
+	if (!exp) {
+		gdTestErrorMsg("rotating image failed.\n");
+		gdFree(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);
+		gdFree(im);
+		gdFree(exp);
+		return 1;
+	}
+
+	gdImageDestroy(exp);
+	gdImageDestroy(im);
+
+	return 0;
+}

tests/gdimagerotate/php_bug_64898.png

Added
New image

tests/gdimagerotate/php_bug_64898_exp.png

Added
New image

tests/gdinterpolation/php_bug_64898.c

-#include <stdio.h>
-#include <stdlib.h>
-#include "gd.h"
-
-#include "gdtest.h"
-
-int main()
-{
-	gdImagePtr im, exp;
-	char path[2048];
-	const char *file_im = "gdinterpolation/php_bug_64898.png";
-	const char *file_exp = "gdinterpolation/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 = gdImageCreateFromPng(fp);
-
-	fclose(fp);
-
-	if (!im) {
-		gdTestErrorMsg("loading %s failed.\n", path);
-		return 1;
-	}
-
-	color = gdImageColorAllocate(im, 255, 255, 255);
-
-	if (color < 0) {
-		gdTestErrorMsg("allocation color from image failed.\n");
-		gdFree(im);
-		return 1;
-	}
-
-/*	Try default interpolation method, but any non-optimized fails */
-/*	gdImageSetInterpolationMethod(im, GD_BICUBIC_FIXED); */
-
-	exp = gdImageRotateInterpolated(im, 45, color);
-
-	if (!exp) {
-		gdTestErrorMsg("rotating image failed.\n");
-		gdFree(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);
-		gdFree(im);
-		gdFree(exp);
-		return 1;
-	}
-
-	gdImageDestroy(exp);
-	gdImageDestroy(im);
-
-	return 0;
-}

tests/gdinterpolation/php_bug_64898.png

Removed
Old image

tests/gdinterpolation/php_bug_64898_exp.png

Removed
Old image