summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorwilson chen <willson.chenwx@gmail.com>2019-11-28 13:04:50 +0800
committerMike Frysinger <vapier@gmail.com>2019-11-28 00:04:50 -0500
commit05ae40a4ba35652f7eca243f4e5cc7ff6f7d10cc (patch)
treedb52d285c16e3ebafa3ff3aeb294525d6c9f481b /tests
parent39facb195f7de08a9e120cbe5a86a8fbfb8ac6c3 (diff)
downloadlibgd-05ae40a4ba35652f7eca243f4e5cc7ff6f7d10cc.tar.gz
add testcase for gdImageString16
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/gdimagestring16/.gitignore1
-rw-r--r--tests/gdimagestring16/CMakeLists.txt7
-rw-r--r--tests/gdimagestring16/Makemodule.am8
-rw-r--r--tests/gdimagestring16/gdimagestring16.c32
-rw-r--r--tests/gdimagestring16/gdimagestring16_exp.pngbin0 -> 118 bytes
7 files changed, 50 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 3ef1e5b..6f39b2d 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -62,6 +62,7 @@ if (BUILD_TEST)
gdimagescatterex
gdimagesetpixel
gdimagestring
+ gdimagestring16
gdimagestringft
gdimagestringftex
gdimagetruecolortopalette
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5e9c5df..56d9317 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -58,6 +58,7 @@ include gdimagescale/Makemodule.am
include gdimagescatterex/Makemodule.am
include gdimagesetpixel/Makemodule.am
include gdimagestring/Makemodule.am
+include gdimagestring16/Makemodule.am
include gdimagestringft/Makemodule.am
include gdimagestringftex/Makemodule.am
include gdimagetruecolortopalette/Makemodule.am
diff --git a/tests/gdimagestring16/.gitignore b/tests/gdimagestring16/.gitignore
new file mode 100644
index 0000000..5ebaa0b
--- /dev/null
+++ b/tests/gdimagestring16/.gitignore
@@ -0,0 +1 @@
+/gdimagestring16
diff --git a/tests/gdimagestring16/CMakeLists.txt b/tests/gdimagestring16/CMakeLists.txt
new file mode 100644
index 0000000..e85db9b
--- /dev/null
+++ b/tests/gdimagestring16/CMakeLists.txt
@@ -0,0 +1,7 @@
+IF(PNG_FOUND)
+LIST(APPEND TESTS_FILES
+ gdimagestring16
+)
+ENDIF(PNG_FOUND)
+
+ADD_GD_TESTS()
diff --git a/tests/gdimagestring16/Makemodule.am b/tests/gdimagestring16/Makemodule.am
new file mode 100644
index 0000000..84b6b5f
--- /dev/null
+++ b/tests/gdimagestring16/Makemodule.am
@@ -0,0 +1,8 @@
+if HAVE_LIBPNG
+libgd_test_programs += \
+ gdimagestring16/gdimagestring16
+endif
+
+EXTRA_DIST += \
+ gdimagestring16/CMakeLists.txt \
+ gdimagestring16/gdimagestring16_exp.png
diff --git a/tests/gdimagestring16/gdimagestring16.c b/tests/gdimagestring16/gdimagestring16.c
new file mode 100644
index 0000000..57eae97
--- /dev/null
+++ b/tests/gdimagestring16/gdimagestring16.c
@@ -0,0 +1,32 @@
+/**
+ * Base test for gdImageString16()
+ */
+#include <gd.h>
+#include <gdfontl.h>
+#include "gdtest.h"
+
+int main()
+{
+ /* Declare the image */
+ gdImagePtr im = NULL;
+ wchar_t *wchr = L"H";
+ unsigned short *sptr;
+ sptr = (unsigned short *)wchr;
+ int foreground;
+ int errorcode = 0;
+ gdFontPtr fontptr = gdFontGetLarge();
+
+ im = gdImageCreate(20, 20);
+ gdImageColorAllocate(im, 255, 255, 255);
+ foreground = gdImageColorAllocate(im, 22, 4, 238);
+
+ gdImageString16(im, fontptr, 2, 2, sptr, foreground);
+
+ if (!gdAssertImageEqualsToFile("gdimagestring16/gdimagestring16_exp.png", im))
+ errorcode = 1;
+
+ /* Destroy the image in memory */
+ gdImageDestroy(im);
+
+ return errorcode;
+}
diff --git a/tests/gdimagestring16/gdimagestring16_exp.png b/tests/gdimagestring16/gdimagestring16_exp.png
new file mode 100644
index 0000000..5700578
--- /dev/null
+++ b/tests/gdimagestring16/gdimagestring16_exp.png
Binary files differ