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/freetype | |
| 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/freetype')
| -rw-r--r-- | tests/freetype/bug00132.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/freetype/bug00132.c b/tests/freetype/bug00132.c index 88cdfc6..da0585e 100644 --- a/tests/freetype/bug00132.c +++ b/tests/freetype/bug00132.c @@ -10,8 +10,7 @@ int main() { gdImagePtr im; int error = 0; - char path[2048]; - const char *file_exp = "bug00132_exp.png"; + char *path; char *ret = NULL; im = gdImageCreateTrueColor(50, 30); @@ -24,15 +23,14 @@ int main() gdImageAlphaBlending(im, 0); gdImageFilledRectangle(im, 0, 0, 200, 200, gdTrueColorAlpha(0, 0, 0, 127)); - sprintf(path, "%s/freetype/DejaVuSans.ttf", GDTEST_TOP_DIR); - + path = gdTestFilePath("freetype/DejaVuSans.ttf"); ret = gdImageStringFT(im, NULL, - 0xFFFFFF, path, 14.0, 0.0, 10, 20, "ϑ θ"); + free(path); if (ret) { error = 1; printf("%s\n", ret); } else { - sprintf(path, "%s/freetype/%s", GDTEST_TOP_DIR, file_exp); - if (!gdAssertImageEqualsToFile(path, im)) { + if (!gdAssertImageEqualsToFile("freetype/bug00132_exp.png", im)) { error = 1; printf("Reference image and destination differ\n"); } |
