tests: fix out-of-tree runs with relative images

When we build out-of-tree, the gdTestImageFromPng logic will be passed a
fully constructed relative path using existing test helpers.  Don't try
to create a relative path on top of the relative path as the result will
be invalid.
master
Mike Frysinger 2016-07-21 20:49:27 +05:30
parent 1e9d800842
commit 8d63621487
2 changed files with 2 additions and 5 deletions

View File

@ -7,7 +7,6 @@ int main()
{
gdImagePtr im, im2;
int error = 0;
char *path;
im = gdImageCreateTrueColor(width, width);
gdImageFilledRectangle(im, 0,0, width, width, 0xFF0000);
@ -18,13 +17,11 @@ int main()
im2 = gdImageCreateTrueColor(width, width);
gdImageCopyRotated(im2, im, width / 2, width / 2, 0,0, width, width, 60);
path = gdTestFilePath2("gdimagecopyrotated", "bug00020_exp.png");
if (!gdAssertImageEqualsToFile(path, im2)) {
if (!gdAssertImageEqualsToFile("gdimagecopyrotated/bug00020_exp.png", im2)) {
error = 1;
}
gdImageDestroy(im2);
gdImageDestroy(im);
free(path);
return error;
}

View File

@ -46,7 +46,7 @@ gdImagePtr gdTestImageFromPng(const char *filename)
FILE *fp;
/* If the path is relative, then assume it's in the tests/ dir. */
if (filename[0] == '/'
if (filename[0] == '/' || filename[0] == '.'
#ifdef _WIN32
|| filename[1] == ':'
#endif