summaryrefslogtreecommitdiff
path: root/tests/png
diff options
context:
space:
mode:
authorpajoye <none@none>2007-11-18 14:46:45 +0000
committerpajoye <none@none>2007-11-18 14:46:45 +0000
commit191ef868323d10b2e44b053b11005b7a41519424 (patch)
tree6971727266ab7430845eeeaa2e087340ad7ac1b3 /tests/png
parentd5e41b333c84b034202c2965ea62b670a66ac44e (diff)
downloadlibgd-191ef868323d10b2e44b053b11005b7a41519424.tar.gz
- #88, MFB: Bug loading png images in grayscale + alpha
- add test
Diffstat (limited to 'tests/png')
-rw-r--r--tests/png/CMakeLists.txt1
-rw-r--r--tests/png/bug00088.c44
-rw-r--r--tests/png/bug00088_1.pngbin0 -> 1892 bytes
-rw-r--r--tests/png/bug00088_1_exp.pngbin0 -> 2791 bytes
-rw-r--r--tests/png/bug00088_2.pngbin0 -> 238 bytes
-rw-r--r--tests/png/bug00088_2_exp.pngbin0 -> 284 bytes
6 files changed, 45 insertions, 0 deletions
diff --git a/tests/png/CMakeLists.txt b/tests/png/CMakeLists.txt
index 3f1d37a..13b3730 100644
--- a/tests/png/CMakeLists.txt
+++ b/tests/png/CMakeLists.txt
@@ -3,6 +3,7 @@ SET(TESTS_FILES
bug00011
bug00033
bug00086
+ bug00088
)
FOREACH(test_name ${TESTS_FILES})
diff --git a/tests/png/bug00088.c b/tests/png/bug00088.c
new file mode 100644
index 0000000..f383e7d
--- /dev/null
+++ b/tests/png/bug00088.c
@@ -0,0 +1,44 @@
+/* $Id$ */
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int main()
+{
+ int error;
+ gdImagePtr im;
+ FILE *fp;
+ char path[1024];
+ const char * files[2] = {"bug00088_1.png", "bug00088_2.png"};
+ const char * files_exp[2] = {"bug00088_1_exp.png", "bug00088_2_exp.png"};
+
+ int i, cnt = 2;
+ error = 0;
+
+ for (i = 0; i < cnt; i++) {
+
+ sprintf(path, "%s/png/%s", GDTEST_TOP_DIR, files[i]);
+ fp = fopen(path, "rb");
+ if (!fp) {
+ printf("failed, cannot open file <%s>\n", path);
+ return 1;
+ }
+
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+
+ if (!im) {
+ error |= 1;
+ continue;
+ }
+
+ sprintf(path, "%s/png/%s", GDTEST_TOP_DIR, files_exp[i]);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error |= 1;
+ }
+ gdImageDestroy(im);
+ }
+
+ return error;
+}
diff --git a/tests/png/bug00088_1.png b/tests/png/bug00088_1.png
new file mode 100644
index 0000000..3f9a5c7
--- /dev/null
+++ b/tests/png/bug00088_1.png
Binary files differ
diff --git a/tests/png/bug00088_1_exp.png b/tests/png/bug00088_1_exp.png
new file mode 100644
index 0000000..25ee05a
--- /dev/null
+++ b/tests/png/bug00088_1_exp.png
Binary files differ
diff --git a/tests/png/bug00088_2.png b/tests/png/bug00088_2.png
new file mode 100644
index 0000000..fa58ffe
--- /dev/null
+++ b/tests/png/bug00088_2.png
Binary files differ
diff --git a/tests/png/bug00088_2_exp.png b/tests/png/bug00088_2_exp.png
new file mode 100644
index 0000000..a21c840
--- /dev/null
+++ b/tests/png/bug00088_2_exp.png
Binary files differ