summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorwilson chen <willson.chenwx@gmail.com>2019-11-28 13:05:23 +0800
committerMike Frysinger <vapier@gmail.com>2019-11-28 00:05:23 -0500
commitfac913b874d0e6920e9c9609478fc5dae2d2399d (patch)
treefdbd53852b31168ae45ef92a05da9b6dfae663cd /tests
parent05ae40a4ba35652f7eca243f4e5cc7ff6f7d10cc (diff)
downloadlibgd-fac913b874d0e6920e9c9609478fc5dae2d2399d.tar.gz
add testcase for gdImageStringUp16
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/gdimagestringup16/.gitignore1
-rw-r--r--tests/gdimagestringup16/CMakeLists.txt7
-rw-r--r--tests/gdimagestringup16/Makemodule.am8
-rw-r--r--tests/gdimagestringup16/gdimagestringup16.c31
-rw-r--r--tests/gdimagestringup16/gdimagestringup16_exp.pngbin0 -> 117 bytes
7 files changed, 49 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 6f39b2d..49c6d3b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -65,6 +65,7 @@ if (BUILD_TEST)
gdimagestring16
gdimagestringft
gdimagestringftex
+ gdimagestringup16
gdimagetruecolortopalette
gdinterpolatedscale
gdnewfilectx
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 56d9317..9bc79fd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -61,6 +61,7 @@ include gdimagestring/Makemodule.am
include gdimagestring16/Makemodule.am
include gdimagestringft/Makemodule.am
include gdimagestringftex/Makemodule.am
+include gdimagestringup16/Makemodule.am
include gdimagetruecolortopalette/Makemodule.am
include gdinterpolatedscale/Makemodule.am
include gdnewfilectx/Makemodule.am
diff --git a/tests/gdimagestringup16/.gitignore b/tests/gdimagestringup16/.gitignore
new file mode 100644
index 0000000..1c009a5
--- /dev/null
+++ b/tests/gdimagestringup16/.gitignore
@@ -0,0 +1 @@
+/gdimagestringup16
diff --git a/tests/gdimagestringup16/CMakeLists.txt b/tests/gdimagestringup16/CMakeLists.txt
new file mode 100644
index 0000000..08f4ff8
--- /dev/null
+++ b/tests/gdimagestringup16/CMakeLists.txt
@@ -0,0 +1,7 @@
+IF(PNG_FOUND)
+LIST(APPEND TESTS_FILES
+ gdimagestringup16
+)
+ENDIF(PNG_FOUND)
+
+ADD_GD_TESTS()
diff --git a/tests/gdimagestringup16/Makemodule.am b/tests/gdimagestringup16/Makemodule.am
new file mode 100644
index 0000000..7735432
--- /dev/null
+++ b/tests/gdimagestringup16/Makemodule.am
@@ -0,0 +1,8 @@
+if HAVE_LIBPNG
+libgd_test_programs += \
+ gdimagestringup16/gdimagestringup16
+endif
+
+EXTRA_DIST += \
+ gdimagestringup16/CMakeLists.txt \
+ gdimagestringup16/gdimagestringup16_exp.png
diff --git a/tests/gdimagestringup16/gdimagestringup16.c b/tests/gdimagestringup16/gdimagestringup16.c
new file mode 100644
index 0000000..c843abe
--- /dev/null
+++ b/tests/gdimagestringup16/gdimagestringup16.c
@@ -0,0 +1,31 @@
+/**
+ * Base test for gdImageStringUp16()
+ */
+#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);
+
+ gdImageStringUp16(im, fontptr, 2, 18, sptr, foreground);
+
+ if (!gdAssertImageEqualsToFile("gdimagestringup16/gdimagestringup16_exp.png", im))
+ errorcode = 1;
+
+ gdImageDestroy(im);
+
+ return errorcode;
+}
diff --git a/tests/gdimagestringup16/gdimagestringup16_exp.png b/tests/gdimagestringup16/gdimagestringup16_exp.png
new file mode 100644
index 0000000..a1a4570
--- /dev/null
+++ b/tests/gdimagestringup16/gdimagestringup16_exp.png
Binary files differ