summaryrefslogtreecommitdiff
path: root/tests/gdimagestringup/gdimagestringup.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gdimagestringup/gdimagestringup.c')
-rw-r--r--tests/gdimagestringup/gdimagestringup.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/gdimagestringup/gdimagestringup.c b/tests/gdimagestringup/gdimagestringup.c
new file mode 100644
index 0000000..0832bd7
--- /dev/null
+++ b/tests/gdimagestringup/gdimagestringup.c
@@ -0,0 +1,34 @@
+/**
+ * Base test for gdImageStringUp()
+ */
+#include <gd.h>
+#include <gdfontl.h>
+#include "gdtest.h"
+#include <string.h>
+
+int main()
+{
+ /* Declare the image */
+ gdImagePtr im = NULL;
+ char *s = "Hello gd";
+ int errorcode = 0;
+ int foreground;
+ gdFontPtr fontptr = gdFontGetLarge();
+
+ im = gdImageCreate(50, 100);
+ gdImageColorAllocate(im, 202, 202, 0);
+ foreground = gdImageColorAllocate(im, 22, 4, 238);
+
+ gdImageStringUp(im, fontptr,
+ im->sx / 2 - fontptr->h / 2,
+ im->sy / 2 + (strlen(s) * fontptr->w / 2),
+ (unsigned char*)s, foreground);
+
+ if (!gdAssertImageEqualsToFile("gdimagestringup/gdimagestringup_exp.png", im))
+ errorcode = 1;
+
+ /* Destroy the image im memory */
+ gdImageDestroy(im);
+
+ return errorcode;
+}