summaryrefslogtreecommitdiff
path: root/tests/gdimagetruecolortopalette
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2016-09-21 00:15:47 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2016-09-21 00:15:47 +0200
commita74909b9a43a46518cac18eefba8809e712e210e (patch)
treee8689fab69f6cc8b4b5122edaf958c0ed150e4c9 /tests/gdimagetruecolortopalette
parent40bec0f38f50e8510f5bb71a82f516d46facde03 (diff)
downloadlibgd-a74909b9a43a46518cac18eefba8809e712e210e.tar.gz
Fix #307: GD_QUANT_NEUQUANT fails to unset trueColor flag
We must unset the trueColor image after converting it; gdImageCopy() wont't (rightly) do that for us.
Diffstat (limited to 'tests/gdimagetruecolortopalette')
-rw-r--r--tests/gdimagetruecolortopalette/.gitignore1
-rw-r--r--tests/gdimagetruecolortopalette/CMakeLists.txt1
-rw-r--r--tests/gdimagetruecolortopalette/Makemodule.am1
-rw-r--r--tests/gdimagetruecolortopalette/bug00307.c26
4 files changed, 29 insertions, 0 deletions
diff --git a/tests/gdimagetruecolortopalette/.gitignore b/tests/gdimagetruecolortopalette/.gitignore
index f049ddd..410ef59 100644
--- a/tests/gdimagetruecolortopalette/.gitignore
+++ b/tests/gdimagetruecolortopalette/.gitignore
@@ -1,2 +1,3 @@
+/bug00307
/php_bug_67325
/php_bug_72512
diff --git a/tests/gdimagetruecolortopalette/CMakeLists.txt b/tests/gdimagetruecolortopalette/CMakeLists.txt
index 44ea4ac..b23d2a1 100644
--- a/tests/gdimagetruecolortopalette/CMakeLists.txt
+++ b/tests/gdimagetruecolortopalette/CMakeLists.txt
@@ -1,4 +1,5 @@
SET(TESTS_FILES
+ bug00307
php_bug_72512
)
diff --git a/tests/gdimagetruecolortopalette/Makemodule.am b/tests/gdimagetruecolortopalette/Makemodule.am
index 96b1182..31f0362 100644
--- a/tests/gdimagetruecolortopalette/Makemodule.am
+++ b/tests/gdimagetruecolortopalette/Makemodule.am
@@ -1,5 +1,6 @@
libgd_test_programs += \
+ gdimagetruecolortopalette/bug00307 \
gdimagetruecolortopalette/php_bug_72512
if HAVE_LIBJPEG
diff --git a/tests/gdimagetruecolortopalette/bug00307.c b/tests/gdimagetruecolortopalette/bug00307.c
new file mode 100644
index 0000000..a5c6a04
--- /dev/null
+++ b/tests/gdimagetruecolortopalette/bug00307.c
@@ -0,0 +1,26 @@
+/**
+ * Regression test for <https://github.com/libgd/libgd/issues/307>
+ *
+ * We're testing that an image that has been converted to palette with
+ * GD_QUANT_NEUQUANT has its trueColor flag unset.
+ */
+
+
+#include "gd.h"
+#include "gdtest.h"
+
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreateTrueColor(100, 100);
+
+ gdTestAssert(gdImageTrueColorToPaletteSetMethod(im, GD_QUANT_NEUQUANT, 0));
+ gdImageTrueColorToPalette(im, 0, 256);
+ gdTestAssert(!gdImageTrueColor(im));
+
+ gdImageDestroy(im);
+
+ return gdNumFailures();
+}