diff options
author | Mike Frysinger <vapier@gentoo.org> | 2016-06-03 20:31:02 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2016-06-03 20:31:02 -0400 |
commit | d6c50766ee39d96f8b9899acd6e0d358623b9812 (patch) | |
tree | 5022d0804af777033455c954111122ec36720673 /tests/gdimagestringft | |
parent | 7b195d90c37354874d719f3a488abe16f94512c8 (diff) | |
download | libgd-d6c50766ee39d96f8b9899acd6e0d358623b9812.tar.gz |
tests: add helpers for accessing test data
A lot of tests want to read images/fonts that exist in tests/ for reading.
Rather than construct these paths by hand in every single test file, add a
few helper functions to quickly access them.
The helper functions are slightly slower (due to the repeated calls to the
strcat func), but they aren't terribly slow, especially relative to image
loading that these tests perform. They also make writing/maintaining the
tests a lot easier which is more important here.
Diffstat (limited to 'tests/gdimagestringft')
-rw-r--r-- | tests/gdimagestringft/gdimagestringft_bbox.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/gdimagestringft/gdimagestringft_bbox.c b/tests/gdimagestringft/gdimagestringft_bbox.c index 47037cc..5807918 100644 --- a/tests/gdimagestringft/gdimagestringft_bbox.c +++ b/tests/gdimagestringft/gdimagestringft_bbox.c @@ -28,7 +28,7 @@ static int EXPECT[16][8] = { int main() { - char path[2048]; + char *path; gdImagePtr im; int black; double cos_t, sin_t; @@ -38,7 +38,7 @@ int main() int error = 0; FILE *fp; - sprintf(path, "%s/freetype/DejaVuSans.ttf", GDTEST_TOP_DIR); + path = gdTestFilePath("freetype/DejaVuSans.ttf"); im = gdImageCreate(800, 800); gdImageColorAllocate(im, 0xFF, 0xFF, 0xFF); /* allocate white for background color */ black = gdImageColorAllocate(im, 0, 0, 0); @@ -73,5 +73,6 @@ int main() fclose(fp); done: gdImageDestroy(im); + free(path); return error; } |