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
parent
1e9d800842
commit
8d63621487
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue