summaryrefslogtreecommitdiff
path: root/tests/gdimagerotate
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gdimagerotate')
-rw-r--r--tests/gdimagerotate/bug00067.c21
-rw-r--r--tests/gdimagerotate/php_bug_64898.c29
2 files changed, 14 insertions, 36 deletions
diff --git a/tests/gdimagerotate/bug00067.c b/tests/gdimagerotate/bug00067.c
index cd455dc..add483d 100644
--- a/tests/gdimagerotate/bug00067.c
+++ b/tests/gdimagerotate/bug00067.c
@@ -7,29 +7,19 @@
int main()
{
gdImagePtr im, exp;
- char path[2048];
+ char *path, filename[2048];
const char *file_im = "gdimagerotate/remirh128.png";
- 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;
- }
-
+ fp = gdTestFileOpen(file_im);
im = gdImageCreateFromPng(fp);
-
fclose(fp);
if (!im) {
- gdTestErrorMsg("loading %s failed.\n", path);
+ gdTestErrorMsg("loading %s failed.\n", file_im);
return 1;
}
@@ -51,12 +41,13 @@ int main()
return 1;
}
- sprintf(path, "%s/%s_%03d_exp.png", GDTEST_TOP_DIR, file_exp, angle);
-
+ sprintf(filename, "bug00067_%03d_exp.png", angle);
+ path = gdTestFilePath2("gdimagerotate", filename);
if (!gdAssertImageEqualsToFile(path, exp)) {
gdTestErrorMsg("comparing rotated image to %s failed.\n", path);
error += 1;
}
+ free(path);
gdImageDestroy(exp);
}
diff --git a/tests/gdimagerotate/php_bug_64898.c b/tests/gdimagerotate/php_bug_64898.c
index 99bf04e..6b723df 100644
--- a/tests/gdimagerotate/php_bug_64898.c
+++ b/tests/gdimagerotate/php_bug_64898.c
@@ -7,24 +7,15 @@
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 error = 0;
- 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;
- }
-
+ fp = gdTestFileOpen("gdimagerotate/php_bug_64898.png");
+(void)fp;
im = gdImageCreateTrueColor(141, 200);
if (!im) {
- gdTestErrorMsg("loading %s failed.\n", path);
+ gdTestErrorMsg("loading failed.\n");
return 1;
}
@@ -41,17 +32,13 @@ int main()
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;
+ if (!gdAssertImageEqualsToFile("gdimagerotate/php_bug_64898_exp.png", exp)) {
+ printf("comparing rotated image failed.\n");
+ error = 1;
}
gdImageDestroy(exp);
gdImageDestroy(im);
- return 0;
+ return error;
}