summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/gd2/.gitignore1
-rw-r--r--tests/gd2/CMakeLists.txt1
-rw-r--r--tests/gd2/Makemodule.am1
-rw-r--r--tests/gd2/createimagefromgd2part.c35
4 files changed, 38 insertions, 0 deletions
diff --git a/tests/gd2/.gitignore b/tests/gd2/.gitignore
index d21010c..a0e2fa3 100644
--- a/tests/gd2/.gitignore
+++ b/tests/gd2/.gitignore
@@ -3,6 +3,7 @@
/bug00309
/bug00354
/bug00383
+/createimagefromgd2part
/createimagefromgd2partptr
/gd2_empty_file
/gd2_im2im
diff --git a/tests/gd2/CMakeLists.txt b/tests/gd2/CMakeLists.txt
index 3c6b466..cc188ca 100644
--- a/tests/gd2/CMakeLists.txt
+++ b/tests/gd2/CMakeLists.txt
@@ -6,6 +6,7 @@ LIST(APPEND TESTS_FILES
bug00309
bug00354
bug00383
+ createimagefromgd2part
createimagefromgd2partptr
gd2_empty_file
php_bug_72339
diff --git a/tests/gd2/Makemodule.am b/tests/gd2/Makemodule.am
index 7121018..5cd29e6 100644
--- a/tests/gd2/Makemodule.am
+++ b/tests/gd2/Makemodule.am
@@ -6,6 +6,7 @@ libgd_test_programs += \
gd2/bug00309 \
gd2/bug00354 \
gd2/bug00383 \
+ gd2/createimagefromgd2part \
gd2/createimagefromgd2partptr \
gd2/gd2_empty_file \
gd2/php_bug_72339 \
diff --git a/tests/gd2/createimagefromgd2part.c b/tests/gd2/createimagefromgd2part.c
new file mode 100644
index 0000000..0c81ba6
--- /dev/null
+++ b/tests/gd2/createimagefromgd2part.c
@@ -0,0 +1,35 @@
+/**
+ *Base test for gdImageCreateFromGd2Part()
+ */
+#include "gd.h"
+#include "gdtest.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+int main()
+{
+ gdImagePtr im;
+ FILE *p;
+ int expected_color = 0xffffff;
+ int actual_color = 0;
+
+ p = gdTestFileOpen2("gd2", "conv_test.gd2");
+
+ if (!p) {
+ gdTestErrorMsg("failed, connot open gd2 file: conv_test.gd2");
+ return 1;
+ }
+
+ im = gdImageCreateFromGd2Part(p, 3, 3, 3, 3);
+ fclose(p);
+
+ if (!im) {
+ return 1;
+ }
+
+ actual_color = gdImageGetPixel(im, 2, 2);
+ gdImageDestroy(im);
+ gdTestAssert(expected_color == actual_color);
+
+ return gdNumFailures();
+}