summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-src/tests/gdimagestring/gdimagestring.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/gd/libgd-src/tests/gdimagestring/gdimagestring.c')
-rw-r--r--Build/source/libs/gd/libgd-src/tests/gdimagestring/gdimagestring.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagestring/gdimagestring.c b/Build/source/libs/gd/libgd-src/tests/gdimagestring/gdimagestring.c
new file mode 100644
index 00000000000..c4b4aa1e898
--- /dev/null
+++ b/Build/source/libs/gd/libgd-src/tests/gdimagestring/gdimagestring.c
@@ -0,0 +1,34 @@
+/**
+ * Base test for gdImageString()
+ */
+#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 foreground = 0;
+ int error = 0;
+ gdFontPtr fontptr = gdFontGetLarge();
+
+ im = gdImageCreate(100, 50);
+ gdImageColorAllocate(im, 202, 202, 0);
+ foreground = gdImageColorAllocate(im, 22, 4, 238);
+
+ gdImageString(im, fontptr,
+ im->sx / 2 - (strlen(s) * fontptr->w / 2),
+ im->sy / 2 - fontptr->h / 2,
+ (unsigned char*)s, foreground);
+
+ if (!gdAssertImageEqualsToFile("gdimagestring/gdimagestring_exp.png", im))
+ error= 1;
+
+ /* Destroy the image in memory. */
+ gdImageDestroy(im);
+
+ return error;
+}