summaryrefslogtreecommitdiff
path: root/ext/gd
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2010-01-07 13:31:53 +0100
committerOndřej Surý <ondrej@sury.org>2010-01-07 13:31:53 +0100
commit0fab6db7cac8d2be99579dd049f812a8ff98e74f (patch)
tree91f01b0d06916c78262404096bfd466b8e95e5b5 /ext/gd
parentd3a8757891280dc6650ca7eead67830c794b0e7b (diff)
downloadphp-0fab6db7cac8d2be99579dd049f812a8ff98e74f.tar.gz
Imported Upstream version 5.3.1upstream/5.3.1
Diffstat (limited to 'ext/gd')
-rw-r--r--ext/gd/config.m42
-rw-r--r--ext/gd/config.w322
-rw-r--r--ext/gd/gd.c2
-rw-r--r--ext/gd/gd_ctx.c2
-rw-r--r--ext/gd/gdcache.c2
-rw-r--r--ext/gd/gdcache.h2
-rw-r--r--ext/gd/libgd/gd.c84
-rw-r--r--ext/gd/libgd/gd_compat.c2
-rw-r--r--ext/gd/libgd/gd_compat.h2
-rw-r--r--ext/gd/libgd/gd_gd.c3
-rw-r--r--ext/gd/libgd/gdft.c30
-rw-r--r--ext/gd/libgd/xbm.c2
-rw-r--r--ext/gd/php_gd.h2
-rw-r--r--ext/gd/tests/bug42434.phpt26
-rw-r--r--ext/gd/tests/bug43073.phpt48
-rw-r--r--ext/gd/tests/bug48555.phpt9
-rw-r--r--ext/gd/tests/bug48732.phpt22
-rw-r--r--ext/gd/tests/bug48801.phpt22
-rw-r--r--ext/gd/tests/crafted.gd2bin0 -> 1039 bytes
-rw-r--r--ext/gd/tests/crafted_gd2.phpt16
-rw-r--r--ext/gd/tests/gd_info_error.phpt74
-rw-r--r--ext/gd/tests/gd_info_variation1.phpt98
-rw-r--r--ext/gd/tests/gif.phpt2
-rw-r--r--ext/gd/tests/image_type_to_mime_type_error.phpt68
-rw-r--r--ext/gd/tests/image_type_to_mime_type_variation1.phpt302
-rw-r--r--ext/gd/tests/image_type_to_mime_type_variation2.phpt160
-rwxr-xr-xext/gd/tests/imageantialias_error1.phpt18
-rwxr-xr-xext/gd/tests/imageantialias_error2.phpt23
-rwxr-xr-xext/gd/tests/imagearc_basic.phpt28
-rwxr-xr-xext/gd/tests/imagearc_error1.phpt29
-rwxr-xr-xext/gd/tests/imagearc_variation1.phpt28
-rwxr-xr-xext/gd/tests/imagearc_variation2.phpt28
-rw-r--r--ext/gd/tests/imagechar_basic.phpt25
-rw-r--r--ext/gd/tests/imagechar_error1.phpt17
-rw-r--r--ext/gd/tests/imagechar_error2.phpt17
-rw-r--r--ext/gd/tests/imagechar_error3.phpt17
-rw-r--r--ext/gd/tests/imagechar_error4.phpt17
-rw-r--r--ext/gd/tests/imagechar_error5.phpt17
-rw-r--r--ext/gd/tests/imagechar_error6.phpt17
-rw-r--r--ext/gd/tests/imagechar_error7.phpt17
-rw-r--r--ext/gd/tests/imagecharup_basic.phpt25
-rw-r--r--ext/gd/tests/imagecharup_error1.phpt17
-rw-r--r--ext/gd/tests/imagecharup_error2.phpt17
-rw-r--r--ext/gd/tests/imagecharup_error3.phpt17
-rw-r--r--ext/gd/tests/imagecharup_error4.phpt17
-rw-r--r--ext/gd/tests/imagecharup_error5.phpt17
-rw-r--r--ext/gd/tests/imagecharup_error6.phpt17
-rw-r--r--ext/gd/tests/imagecharup_error7.phpt17
-rw-r--r--ext/gd/tests/imagecolorallocatealpha_basic.phpt30
-rw-r--r--ext/gd/tests/imagecolorallocatealpha_error1.phpt25
-rw-r--r--ext/gd/tests/imagecolorallocatealpha_error2.phpt22
-rw-r--r--ext/gd/tests/imagecolorallocatealpha_error3.phpt22
-rw-r--r--ext/gd/tests/imagecolorallocatealpha_error4.phpt22
-rw-r--r--ext/gd/tests/imagecolorallocatealpha_error5.phpt22
-rw-r--r--ext/gd/tests/imagecolordeallocate_basic.phpt21
-rw-r--r--ext/gd/tests/imagecolordeallocate_error1.phpt22
-rw-r--r--ext/gd/tests/imagecolordeallocate_error2.phpt19
-rw-r--r--ext/gd/tests/imagecolordeallocate_error3.phpt22
-rw-r--r--ext/gd/tests/imagecolordeallocate_error4.phpt22
-rwxr-xr-xext/gd/tests/imagecolormatch_basic.phpt19
-rwxr-xr-xext/gd/tests/imagecolormatch_error1.phpt18
-rwxr-xr-xext/gd/tests/imagecolormatch_error2.phpt20
-rwxr-xr-xext/gd/tests/imagecolormatch_error3.phpt20
-rwxr-xr-xext/gd/tests/imagecolormatch_error4.phpt20
-rwxr-xr-xext/gd/tests/imagecolorset_basic.phpt35
-rwxr-xr-xext/gd/tests/imageconvolution_basic.phpt33
-rwxr-xr-xext/gd/tests/imageconvolution_error1.phpt27
-rwxr-xr-xext/gd/tests/imageconvolution_error2.phpt26
-rwxr-xr-xext/gd/tests/imageconvolution_error3.phpt27
-rwxr-xr-xext/gd/tests/imagecopymerge_basic.phpt30
-rwxr-xr-xext/gd/tests/imagecopymerge_error.phpt17
-rw-r--r--ext/gd/tests/imagecreatetruecolor_basic.phpt22
-rw-r--r--ext/gd/tests/imagecreatetruecolor_error1.phpt18
-rw-r--r--ext/gd/tests/imagecreatetruecolor_error2.phpt24
-rw-r--r--ext/gd/tests/imagecreatetruecolor_error3.phpt21
-rwxr-xr-xext/gd/tests/imageellipse_basic.phpt27
-rwxr-xr-xext/gd/tests/imageellipse_error1.phpt21
-rwxr-xr-xext/gd/tests/imageellipse_error2.phpt21
-rwxr-xr-xext/gd/tests/imageellipse_error3.phpt21
-rwxr-xr-xext/gd/tests/imageellipse_error4.phpt21
-rwxr-xr-xext/gd/tests/imageellipse_error5.phpt21
-rwxr-xr-xext/gd/tests/imageellipse_error6.phpt21
-rwxr-xr-xext/gd/tests/imageellipse_error7.phpt20
-rwxr-xr-xext/gd/tests/imageellipse_error8.phpt21
-rwxr-xr-xext/gd/tests/imagefilledarc_basic.phpt28
-rwxr-xr-xext/gd/tests/imagefilledarc_error1.phpt29
-rwxr-xr-xext/gd/tests/imagefilledarc_variation1.phpt28
-rwxr-xr-xext/gd/tests/imagefilledarc_variation2.phpt28
-rwxr-xr-xext/gd/tests/imagefilltoborder_basic.phpt33
-rwxr-xr-xext/gd/tests/imagefilltoborder_error1.phpt26
-rwxr-xr-xext/gd/tests/imagefilltoborder_error2.phpt26
-rwxr-xr-xext/gd/tests/imagefilltoborder_error3.phpt26
-rwxr-xr-xext/gd/tests/imagefilltoborder_error4.phpt26
-rwxr-xr-xext/gd/tests/imagefilltoborder_error5.phpt26
-rwxr-xr-xext/gd/tests/imagefilltoborder_error6.phpt29
-rwxr-xr-xext/gd/tests/imagefilltoborder_error7.phpt26
-rwxr-xr-xext/gd/tests/imagefilter_error1.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error10.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error11.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error12.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error13.phpt17
-rwxr-xr-xext/gd/tests/imagefilter_error14.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error15.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error16.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error17.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error18.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error19.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error2.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error20.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error3.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error4.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error5.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error6.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error7.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error8.phpt18
-rwxr-xr-xext/gd/tests/imagefilter_error9.phpt18
-rw-r--r--ext/gd/tests/imagefontheight_basic.phpt19
-rw-r--r--ext/gd/tests/imagefontheight_error1.phpt15
-rw-r--r--ext/gd/tests/imagefontwidth_basic.phpt21
-rw-r--r--ext/gd/tests/imagefontwidth_error1.phpt15
-rw-r--r--ext/gd/tests/imagegammacorrect_basic.phpt32
-rw-r--r--ext/gd/tests/imagegammacorrect_error1.phpt17
-rw-r--r--ext/gd/tests/imagegammacorrect_error2.phpt17
-rw-r--r--ext/gd/tests/imagegammacorrect_error3.phpt17
-rw-r--r--ext/gd/tests/imagegammacorrect_error4.phpt17
-rw-r--r--ext/gd/tests/imagegammacorrect_variation1.phpt32
-rwxr-xr-xext/gd/tests/imageinterlace_basic.phpt17
-rwxr-xr-xext/gd/tests/imageinterlace_error1.phpt20
-rwxr-xr-xext/gd/tests/imageinterlace_error2.phpt17
-rwxr-xr-xext/gd/tests/imageinterlace_variation1.phpt20
-rwxr-xr-xext/gd/tests/imageinterlace_variation2.phpt24
-rw-r--r--ext/gd/tests/imageistruecolor_basic.phpt17
-rw-r--r--ext/gd/tests/imageistruecolor_error1.phpt24
-rw-r--r--ext/gd/tests/imagelayereffect_basic.phpt27
-rw-r--r--ext/gd/tests/imagelayereffect_error1.phpt16
-rw-r--r--ext/gd/tests/imagelayereffect_error2.phpt18
-rw-r--r--ext/gd/tests/imagelayereffect_error3.phpt17
-rwxr-xr-xext/gd/tests/imagerectangle_basic.phpt27
-rwxr-xr-xext/gd/tests/imagerectangle_error1.phpt19
-rwxr-xr-xext/gd/tests/imagerectangle_error2.phpt19
-rwxr-xr-xext/gd/tests/imagerectangle_error3.phpt19
-rwxr-xr-xext/gd/tests/imagerectangle_error4.phpt19
-rwxr-xr-xext/gd/tests/imagerectangle_error5.phpt19
-rwxr-xr-xext/gd/tests/imagerectangle_error6.phpt19
-rwxr-xr-xext/gd/tests/imagerectangle_error7.phpt19
-rwxr-xr-xext/gd/tests/imagerectangle_error8.phpt19
-rwxr-xr-xext/gd/tests/imagesetbrush_basic.phpt37
-rw-r--r--ext/gd/tests/imagesetthickness_basic.phpt34
-rw-r--r--ext/gd/tests/imagesetthickness_error1.phpt22
-rw-r--r--ext/gd/tests/imagesetthickness_error2.phpt24
-rw-r--r--ext/gd/tests/imagestring_basic.phpt25
-rw-r--r--ext/gd/tests/imagestring_error1.phpt17
-rw-r--r--ext/gd/tests/imagestring_error2.phpt17
-rw-r--r--ext/gd/tests/imagestring_error3.phpt17
-rw-r--r--ext/gd/tests/imagestring_error4.phpt17
-rw-r--r--ext/gd/tests/imagestring_error5.phpt17
-rw-r--r--ext/gd/tests/imagestring_error6.phpt17
-rw-r--r--ext/gd/tests/imagestring_error7.phpt17
-rw-r--r--ext/gd/tests/imagestringup_basic.phpt25
-rw-r--r--ext/gd/tests/imagestringup_error1.phpt17
-rw-r--r--ext/gd/tests/imagestringup_error2.phpt17
-rw-r--r--ext/gd/tests/imagestringup_error3.phpt17
-rw-r--r--ext/gd/tests/imagestringup_error4.phpt17
-rw-r--r--ext/gd/tests/imagestringup_error5.phpt17
-rw-r--r--ext/gd/tests/imagestringup_error6.phpt17
-rw-r--r--ext/gd/tests/imagestringup_error7.phpt17
-rw-r--r--ext/gd/tests/imagetruecolortopalette_basic.phpt31
-rw-r--r--ext/gd/tests/imagetruecolortopalette_error1.phpt26
-rw-r--r--ext/gd/tests/imagetruecolortopalette_error2.phpt22
-rw-r--r--ext/gd/tests/imagetruecolortopalette_error3.phpt28
-rw-r--r--ext/gd/tests/imagetruecolortopalette_error4.phpt21
-rwxr-xr-xext/gd/tests/jpeg2wbmp_error1.phpt42
-rwxr-xr-xext/gd/tests/jpeg2wbmp_error2.phpt31
-rwxr-xr-xext/gd/tests/jpeg2wbmp_error3.phpt43
-rwxr-xr-xext/gd/tests/png2wbmp_error1.phpt42
-rwxr-xr-xext/gd/tests/png2wbmp_error2.phpt31
-rwxr-xr-xext/gd/tests/png2wbmp_error3.phpt43
-rw-r--r--ext/gd/tests/test8859.ttfbin10576 -> 10576 bytes
-rw-r--r--ext/gd/tests/truecolor.phpt19
179 files changed, 3884 insertions, 434 deletions
diff --git a/ext/gd/config.m4 b/ext/gd/config.m4
index e433be7e2..1997594ab 100644
--- a/ext/gd/config.m4
+++ b/ext/gd/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.154.2.1.2.6.2.8 2009/05/27 08:18:23 pajoye Exp $
+dnl $Id: config.m4 281216 2009-05-27 08:18:24Z pajoye $
dnl
dnl
diff --git a/ext/gd/config.w32 b/ext/gd/config.w32
index 2e25ec845..491f9a9c4 100644
--- a/ext/gd/config.w32
+++ b/ext/gd/config.w32
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.10.4.4.2.15 2009/05/27 08:18:23 pajoye Exp $
+// $Id: config.w32 281216 2009-05-27 08:18:24Z pajoye $
// vim:ft=javascript
ARG_WITH("gd", "Bundled GD support", "yes,shared");
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index e418a70a5..8853e61a3 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd.c,v 1.312.2.20.2.32.2.43 2009/06/19 22:15:28 kalle Exp $ */
+/* $Id: gd.c 282455 2009-06-19 22:15:28Z kalle $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
index 464f07705..e4961cf79 100644
--- a/ext/gd/gd_ctx.c
+++ b/ext/gd/gd_ctx.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd_ctx.c,v 1.22.2.5.2.3.2.3 2008/12/31 11:15:37 sebastian Exp $ */
+/* $Id: gd_ctx.c 272370 2008-12-31 11:15:49Z sebastian $ */
#include "php_gd.h"
diff --git a/ext/gd/gdcache.c b/ext/gd/gdcache.c
index 598ec811d..695f289d2 100644
--- a/ext/gd/gdcache.c
+++ b/ext/gd/gdcache.c
@@ -1,5 +1,5 @@
/*
- * $Id: gdcache.c,v 1.10.6.1 2008/07/18 01:16:25 scottmac Exp $
+ * $Id: gdcache.c 262909 2008-07-18 01:16:25Z scottmac $
*
* Caches of pointers to user structs in which the least-recently-used
* element is replaced in the event of a cache miss after the cache has
diff --git a/ext/gd/gdcache.h b/ext/gd/gdcache.h
index 033aaefe1..13ed963ea 100644
--- a/ext/gd/gdcache.h
+++ b/ext/gd/gdcache.h
@@ -1,5 +1,5 @@
/*
- * $Id: gdcache.h,v 1.4 2003/12/28 21:08:46 iliaa Exp $
+ * $Id: gdcache.h 242949 2007-09-26 15:44:16Z cvs2svn $
*
* Caches of pointers to user structs in which the least-recently-used
* element is replaced in the event of a cache miss after the cache has
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
index d66bbbfad..a0ea6f198 100644
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -595,7 +595,7 @@ void gdImageColorTransparent (gdImagePtr im, int color)
if (im->transparent != -1) {
im->alpha[im->transparent] = gdAlphaOpaque;
}
- if (color > -1 && color<im->colorsTotal && color<=gdMaxColors) {
+ if (color > -1 && color < im->colorsTotal && color < gdMaxColors) {
im->alpha[color] = gdAlphaTransparent;
} else {
return;
@@ -1093,8 +1093,7 @@ void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
int w, wstart;
int thick = im->thick;
- if (color == gdAntiAliased)
- {
+ if (color == gdAntiAliased) {
/*
gdAntiAliased passed as color: use the much faster, much cheaper
and equally attractive gdImageAALine implementation. That
@@ -1191,7 +1190,7 @@ TBB: but watch out for /0! */
} else {
/* More-or-less vertical. use wid for horizontal stroke */
/* 2.0.12: Michael Schwartz: divide rather than multiply;
- TBB: but watch out for /0! */
+ TBB: but watch out for /0! */
double as = sin (atan2 (dy, dx));
if (as != 0) {
wid = thick / as;
@@ -1359,7 +1358,7 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
x = x1 << 16;
y = y1 << 16;
inc = (dy * 65536) / dx;
- while ((x >> 16) < x2) {
+ while ((x >> 16) <= x2) {
gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (y >> 8) & 0xFF);
if ((y >> 16) + 1 < im->sy) {
gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF);
@@ -1381,7 +1380,7 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
x = x1 << 16;
y = y1 << 16;
inc = (dx * 65536) / dy;
- while ((y>>16) < y2) {
+ while ((y>>16) <= y2) {
gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (x >> 8) & 0xFF);
if ((x >> 16) + 1 < im->sx) {
gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF);
@@ -1681,27 +1680,26 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
if ((s % 360) == (e % 360)) {
s = 0; e = 360;
- } else {
- if (s > 360) {
- s = s % 360;
- }
-
- if (e > 360) {
- e = e % 360;
- }
+ } else {
+ if (s > 360) {
+ s = s % 360;
+ }
- while (s < 0) {
- s += 360;
- }
+ if (e > 360) {
+ e = e % 360;
+ }
- while (e < s) {
- e += 360;
- }
+ while (s < 0) {
+ s += 360;
+ }
- if (s == e) {
+ while (e < s) {
+ e += 360;
+ }
+ if (s == e) {
s = 0; e = 360;
- }
- }
+ }
+ }
for (i = s; i <= e; i++) {
int x, y;
@@ -1987,7 +1985,7 @@ static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)
oc = gdImageGetPixel(im, x, y);
-/* required! */
+ /* required! */
FILL_PUSH(y,x,x,1);
/* seed segment (popped 1st) */
FILL_PUSH(y+1, x, x, -1);
@@ -2114,33 +2112,40 @@ void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int
{
int x, y;
- /* Nick Atty: limit the points at the edge. Note that this also
- * nicely kills any plotting for rectangles completely outside the
- * window as it makes the tests in the for loops fail
- */
- if (x1 < 0) {
- x1 = 0;
- }
- if (x1 > gdImageSX(im)) {
- x1 = gdImageSX(im);
- }
- if(y1 < 0) {
- y1 = 0;
- }
- if (y1 > gdImageSY(im)) {
- y1 = gdImageSY(im);
+
+ if (x1 == x2 && y1 == y2) {
+ gdImageSetPixel(im, x1, y1, color);
+ return;
}
+
if (x1 > x2) {
x = x1;
x1 = x2;
x2 = x;
}
+
if (y1 > y2) {
y = y1;
y1 = y2;
y2 = y;
}
+ if (x1 < 0) {
+ x1 = 0;
+ }
+
+ if (x2 >= gdImageSX(im)) {
+ x2 = gdImageSX(im) - 1;
+ }
+
+ if (y1 < 0) {
+ y1 = 0;
+ }
+
+ if (y2 >= gdImageSY(im)) {
+ y2 = gdImageSY(im) - 1;
+ }
+
for (y = y1; (y <= y2); y++) {
for (x = x1; (x <= x2); x++) {
gdImageSetPixel (im, x, y, color);
@@ -2301,7 +2306,6 @@ void gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i
for (x = srcX; (x < (srcX + w)); x++) {
int nc;
c = gdImageGetPixel (src, x, y);
-
/* Added 7/24/95: support transparent copies */
if (gdImageGetTransparent(src) == c) {
tox++;
diff --git a/ext/gd/libgd/gd_compat.c b/ext/gd/libgd/gd_compat.c
index bba62341c..473ea203e 100644
--- a/ext/gd/libgd/gd_compat.c
+++ b/ext/gd/libgd/gd_compat.c
@@ -14,7 +14,7 @@ int gdJpegGetVersionInt()
return JPEG_LIB_VERSION;
}
-int gdJpegGetVersionString()
+const char * gdJpegGetVersionString()
{
switch(JPEG_LIB_VERSION) {
case 62:
diff --git a/ext/gd/libgd/gd_compat.h b/ext/gd/libgd/gd_compat.h
index 022d0a889..c084a0069 100644
--- a/ext/gd/libgd/gd_compat.h
+++ b/ext/gd/libgd/gd_compat.h
@@ -8,7 +8,7 @@
#endif
const char * gdPngGetVersionString();
-int gdJpegGetVersionString();
+const char * gdJpegGetVersionString();
int gdJpegGetVersionInt();
int overflow2(int a, int b);
diff --git a/ext/gd/libgd/gd_gd.c b/ext/gd/libgd/gd_gd.c
index 55587d43e..81a957d41 100644
--- a/ext/gd/libgd/gd_gd.c
+++ b/ext/gd/libgd/gd_gd.c
@@ -39,6 +39,9 @@ int _gdGetColors (gdIOCtx * in, gdImagePtr im, int gd2xFlag)
if (!gdGetWord(&im->colorsTotal, in)) {
goto fail1;
}
+ if (im->colorsTotal > gdMaxColors) {
+ goto fail1;
+ }
}
/* Int to accommodate truecolor single-color transparency */
if (!gdGetInt(&im->transparent, in)) {
diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c
index 73cbb8dce..ffac3ebf6 100644
--- a/ext/gd/libgd/gdft.c
+++ b/ext/gd/libgd/gdft.c
@@ -785,6 +785,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
int len, i = 0, ch;
int x1 = 0, y1 = 0;
int xb = x, yb = y;
+ int yd = 0;
font_t *font;
fontkey_t fontkey;
char *next;
@@ -919,6 +920,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
}
#endif
+ i = 0;
while (*next) {
ch = *next;
@@ -934,6 +936,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
}
/* newlines */
if (ch == '\n') {
+ if (!*(++next)) break;
/* 2.0.13: reset penf.x. Christopher J. Grayce */
penf.x = 0;
penf.y -= (long)(face->size->metrics.height * linespace);
@@ -942,9 +945,9 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
y1 = (int)(- penf.y * cos_a + 32) / 64;
xb = x + x1;
yb = y + y1;
+ yd = 0;
pen.x = pen.y = 0;
previous = 0; /* clear kerning flag */
- next++;
continue;
}
@@ -1058,11 +1061,17 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
glyph_bbox.xMax += slot->metrics.horiAdvance;
}
if (!i) { /* if first character, init BB corner values */
+ yd = slot->metrics.height - slot->metrics.horiBearingY;
bbox.xMin = glyph_bbox.xMin;
bbox.yMin = glyph_bbox.yMin;
bbox.xMax = glyph_bbox.xMax;
bbox.yMax = glyph_bbox.yMax;
} else {
+ FT_Pos desc;
+
+ if ( (desc = (slot->metrics.height - slot->metrics.horiBearingY)) > yd) {
+ yd = desc;
+ }
if (bbox.xMin > glyph_bbox.xMin) {
bbox.xMin = glyph_bbox.xMin;
}
@@ -1119,15 +1128,18 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
normbox.xMax = bbox.xMax - bbox.xMin;
normbox.yMax = bbox.yMax - bbox.yMin;
+ brect[0] = brect[2] = brect[4] = brect[6] = (int) (yd * sin_a);
+ brect[1] = brect[3] = brect[5] = brect[7] = (int)(- yd * cos_a);
+
/* rotate bounding rectangle */
- brect[0] = (int) (normbox.xMin * cos_a - normbox.yMin * sin_a);
- brect[1] = (int) (normbox.xMin * sin_a + normbox.yMin * cos_a);
- brect[2] = (int) (normbox.xMax * cos_a - normbox.yMin * sin_a);
- brect[3] = (int) (normbox.xMax * sin_a + normbox.yMin * cos_a);
- brect[4] = (int) (normbox.xMax * cos_a - normbox.yMax * sin_a);
- brect[5] = (int) (normbox.xMax * sin_a + normbox.yMax * cos_a);
- brect[6] = (int) (normbox.xMin * cos_a - normbox.yMax * sin_a);
- brect[7] = (int) (normbox.xMin * sin_a + normbox.yMax * cos_a);
+ brect[0] += (int) (normbox.xMin * cos_a - normbox.yMin * sin_a);
+ brect[1] += (int) (normbox.xMin * sin_a + normbox.yMin * cos_a);
+ brect[2] += (int) (normbox.xMax * cos_a - normbox.yMin * sin_a);
+ brect[3] += (int) (normbox.xMax * sin_a + normbox.yMin * cos_a);
+ brect[4] += (int) (normbox.xMax * cos_a - normbox.yMax * sin_a);
+ brect[5] += (int) (normbox.xMax * sin_a + normbox.yMax * cos_a);
+ brect[6] += (int) (normbox.xMin * cos_a - normbox.yMax * sin_a);
+ brect[7] += (int) (normbox.xMin * sin_a + normbox.yMax * cos_a);
/* scale, round and offset brect */
brect[0] = xb + gdroundupdown(brect[0], d2 > 0);
diff --git a/ext/gd/libgd/xbm.c b/ext/gd/libgd/xbm.c
index 4be7ec8c1..983163ae5 100644
--- a/ext/gd/libgd/xbm.c
+++ b/ext/gd/libgd/xbm.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xbm.c,v 1.7.2.2.2.2.2.2 2008/12/31 11:15:37 sebastian Exp $ */
+/* $Id: xbm.c 272370 2008-12-31 11:15:49Z sebastian $ */
#include <stdio.h>
#include <math.h>
diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h
index cefe4ca92..d2970ce0c 100644
--- a/ext/gd/php_gd.h
+++ b/ext/gd/php_gd.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_gd.h,v 1.59.2.3.2.5.2.9 2009/05/27 08:18:24 pajoye Exp $ */
+/* $Id: php_gd.h 281216 2009-05-27 08:18:24Z pajoye $ */
#ifndef PHP_GD_H
#define PHP_GD_H
diff --git a/ext/gd/tests/bug42434.phpt b/ext/gd/tests/bug42434.phpt
new file mode 100644
index 000000000..cede1ac17
--- /dev/null
+++ b/ext/gd/tests/bug42434.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #42434 (ImageLine w/ antialias = 1px shorter)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) {
+ die('skip gd extension not available');
+}
+?>
+--FILE--
+<?php
+$im = imagecreatetruecolor(10, 2);
+imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF);
+
+imageantialias($im, true);
+imageline($im, 0, 0, 10, 0, 0x000000);
+
+if (imagecolorat($im, 9, 0) == 0x000000) {
+ echo 'DONE';
+} else {
+ echo 'Bugged';
+}
+
+imagedestroy($im);
+?>
+--EXPECTF--
+DONE \ No newline at end of file
diff --git a/ext/gd/tests/bug43073.phpt b/ext/gd/tests/bug43073.phpt
new file mode 100644
index 000000000..df4ffe37e
--- /dev/null
+++ b/ext/gd/tests/bug43073.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Bug #43073 (TrueType bounding box is wrong for angle<>0)
+--SKIPIF--
+<?php
+ if(!extension_loaded('gd')){ die('skip gd extension not available'); }
+ if(!function_exists('imagettftext')) die('skip imagettftext() not available');
+?>
+--FILE--
+<?php
+$cwd = dirname(__FILE__);
+$font = "$cwd/Tuffy.ttf";
+$delta_t = 360.0 / 16; # Make 16 steps around
+$g = imagecreate(800, 800);
+$bgnd = imagecolorallocate($g, 255, 255, 255);
+$black = imagecolorallocate($g, 0, 0, 0);
+$x = 100;
+$y = 0;
+$cos_t = cos(deg2rad($delta_t));
+$sin_t = sin(deg2rad($delta_t));
+for ($angle = 0.0; $angle < 360.0; $angle += $delta_t) {
+ $bbox = imagettftext($g, 24, $angle, 400+$x, 400+$y, $black, $font, 'ABCDEF');
+ $s = vsprintf("(%d, %d), (%d, %d), (%d, %d), (%d, %d)\n", $bbox);
+ echo $s;
+ $temp = $cos_t * $x + $sin_t * $y;
+ $y = $cos_t * $y - $sin_t * $x;
+ $x = $temp;
+}
+imagepng($g, "$cwd/bug43073.png");
+?>
+--CLEAN--
+<?php @unlink(dirname(__FILE__) . '/bug43073.png'); ?>
+--EXPECTF--
+(500, 402), (610, 402), (610, 376), (500, 376)
+(492, 363), (591, 322), (580, 295), (480, 336)
+(470, 331), (548, 254), (527, 233), (449, 310)
+(439, 309), (483, 202), (461, 193), (416, 299)
+(401, 300), (401, 183), (381, 183), (381, 300)
+(362, 307), (316, 195), (291, 205), (337, 318)
+(330, 329), (246, 244), (224, 265), (308, 350)
+(308, 360), (202, 316), (190, 344), (296, 388)
+(300, 399), (186, 399), (186, 425), (300, 425)
+(306, 437), (195, 483), (206, 510), (318, 464)
+(328, 469), (240, 557), (260, 578), (349, 491)
+(359, 491), (312, 607), (334, 616), (382, 501)
+(398, 500), (398, 618), (418, 618), (418, 500)
+(436, 493), (483, 607), (507, 597), (461, 482)
+(468, 471), (555, 558), (577, 538), (490, 450)
+(490, 440), (600, 485), (611, 457), (502, 412)
diff --git a/ext/gd/tests/bug48555.phpt b/ext/gd/tests/bug48555.phpt
index a505f0033..f2030fece 100644
--- a/ext/gd/tests/bug48555.phpt
+++ b/ext/gd/tests/bug48555.phpt
@@ -3,16 +3,17 @@ Bug #48555 (ImageFTBBox() differs from previous versions for texts with new line
--SKIPIF--
<?php
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
+ if(!function_exists('imageftbbox')) die('skip imageftbbox() not available');
?>
--FILE--
<?php
$cwd = dirname(__FILE__);
$font = "$cwd/Tuffy.ttf";
-$box = ImageFTBBox(13, 0, $font, "Text without line-break");
+$box = ImageFTBBox(14, 0, $font, "Text without line-break");
echo 'Top without line-break: ' . $box[7] . "\n";
-$box = ImageFTBBox(13, 0, $font, "Text with\nline-break\none more");
+$box = ImageFTBBox(14, 0, $font, "Text with\nline-break\none more");
echo 'Top with line-break: ' . $box[7] . "\n";
?>
--EXPECTF--
-Top without line-break: -15
-Top with line-break: -15
+Top without line-break: -14
+Top with line-break: -14
diff --git a/ext/gd/tests/bug48732.phpt b/ext/gd/tests/bug48732.phpt
new file mode 100644
index 000000000..f8cb5e2ba
--- /dev/null
+++ b/ext/gd/tests/bug48732.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #48732 (TTF Bounding box wrong for letters below baseline)
+--SKIPIF--
+<?php
+ if(!extension_loaded('gd')){ die('skip gd extension not available'); }
+ if(!function_exists('imagefttext')) die('skip imagefttext() not available');
+?>
+--FILE--
+<?php
+$cwd = dirname(__FILE__);
+$font = "$cwd/Tuffy.ttf";
+$g = imagecreate(100, 50);
+$bgnd = imagecolorallocate($g, 255, 255, 255);
+$black = imagecolorallocate($g, 0, 0, 0);
+$bbox = imagettftext($g, 12, 0, 0, 20, $black, $font, "ABCEDFGHIJKLMN\nopqrstu\n");
+imagepng($g, "$cwd/bug48732.png");
+echo 'Left Bottom: (' . $bbox[0] . ', ' . $bbox[1] . ')';
+?>
+--CLEAN--
+<?php @unlink(dirname(__FILE__) . '/bug48732.png'); ?>
+--EXPECTF--
+Left Bottom: (0, 47)
diff --git a/ext/gd/tests/bug48801.phpt b/ext/gd/tests/bug48801.phpt
new file mode 100644
index 000000000..a6a9874ab
--- /dev/null
+++ b/ext/gd/tests/bug48801.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #48801 (Problem with imagettfbbox)
+--SKIPIF--
+<?php
+ if(!extension_loaded('gd')){ die('skip gd extension not available'); }
+ if(!function_exists('imageftbbox')) die('skip imageftbbox() not available');
+?>
+--FILE--
+<?php
+$cwd = dirname(__FILE__);
+$font = "$cwd/Tuffy.ttf";
+$bbox = imageftbbox(50, 0, $font, "image");
+echo '(' . $bbox[0] . ', ' . $bbox[1] . ")\n";
+echo '(' . $bbox[2] . ', ' . $bbox[3] . ")\n";
+echo '(' . $bbox[4] . ', ' . $bbox[5] . ")\n";
+echo '(' . $bbox[6] . ', ' . $bbox[7] . ")\n";
+?>
+--EXPECTF--
+(-1, 15)
+(155, 15)
+(155, -48)
+(-1, -48)
diff --git a/ext/gd/tests/crafted.gd2 b/ext/gd/tests/crafted.gd2
new file mode 100644
index 000000000..45c944cc2
--- /dev/null
+++ b/ext/gd/tests/crafted.gd2
Binary files differ
diff --git a/ext/gd/tests/crafted_gd2.phpt b/ext/gd/tests/crafted_gd2.phpt
new file mode 100644
index 000000000..7bcbc4e68
--- /dev/null
+++ b/ext/gd/tests/crafted_gd2.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Test max colors for a gd image.
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) {
+ die("skip gd extension not available\n");
+ }
+?>
+--FILE--
+<?php
+imagecreatefromgd(dirname(__FILE__) . '/crafted.gd2');
+?>
+--EXPECTF--
+
+Warning: imagecreatefromgd(): '%scrafted.gd2' is not a valid GD file in %s on line %d
+
diff --git a/ext/gd/tests/gd_info_error.phpt b/ext/gd/tests/gd_info_error.phpt
index 07cabdf52..15a26e4a4 100644
--- a/ext/gd/tests/gd_info_error.phpt
+++ b/ext/gd/tests/gd_info_error.phpt
@@ -1,38 +1,38 @@
---TEST--
-Test gd_info() function : error conditions - with more than expected number of arguments
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('gd_info')) {
- die('skip gd_info function is not available');
-}
-?>
---FILE--
-<?php
-/* Prototype : array gd_info()
- * Description: Retrieve information about the currently installed GD library
- * Source code: ext/gd/gd.c
- */
-$extra_arg_number = 10;
-$extra_arg_string = "Hello";
-
-echo "*** Testing gd_info() : error conditions ***\n";
-
-echo "\n-- Testing gd_info() function with more than expected number of arguments --\n";
-var_dump(gd_info($extra_arg_number));
-var_dump(gd_info($extra_arg_string, $extra_arg_number));
-?>
-===DONE===
---EXPECTF--
-*** Testing gd_info() : error conditions ***
-
--- Testing gd_info() function with more than expected number of arguments --
-
-Warning: gd_info() expects exactly 0 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: gd_info() expects exactly 0 parameters, 2 given in %s on line %d
-bool(false)
+--TEST--
+Test gd_info() function : error conditions - with more than expected number of arguments
+--SKIPIF--
+<?php
+if(!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+if(!function_exists('gd_info')) {
+ die('skip gd_info function is not available');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array gd_info()
+ * Description: Retrieve information about the currently installed GD library
+ * Source code: ext/gd/gd.c
+ */
+$extra_arg_number = 10;
+$extra_arg_string = "Hello";
+
+echo "*** Testing gd_info() : error conditions ***\n";
+
+echo "\n-- Testing gd_info() function with more than expected number of arguments --\n";
+var_dump(gd_info($extra_arg_number));
+var_dump(gd_info($extra_arg_string, $extra_arg_number));
+?>
+===DONE===
+--EXPECTF--
+*** Testing gd_info() : error conditions ***
+
+-- Testing gd_info() function with more than expected number of arguments --
+
+Warning: gd_info() expects exactly 0 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: gd_info() expects exactly 0 parameters, 2 given in %s on line %d
+bool(false)
===DONE=== \ No newline at end of file
diff --git a/ext/gd/tests/gd_info_variation1.phpt b/ext/gd/tests/gd_info_variation1.phpt
index e77f6fb01..a725f6554 100644
--- a/ext/gd/tests/gd_info_variation1.phpt
+++ b/ext/gd/tests/gd_info_variation1.phpt
@@ -1,50 +1,50 @@
---TEST--
-Test gd_info() function : variation - Checking all the values in returned array
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('gd_info')) {
- die('skip gd_info function is not available');
-}
-?>
---FILE--
-<?php
-/* Prototype : array gd_info()
- * Description: Retrieve information about the currently installed GD library
- * Source code: ext/gd/gd.c
- */
-
-echo "*** Testing gd_info() : variation ***\n";
-
-var_dump(gd_info());
-?>
-===DONE===
---EXPECTF--
-*** Testing gd_info() : variation ***
-array(%d) {
- ["GD Version"]=>
- string(%d) %a
- ["FreeType Support"]=>
- bool%a
- ["T1Lib Support"]=>
- bool%a
- ["GIF Read Support"]=>
- bool%a
- ["GIF Create Support"]=>
- bool%a
- ["JPEG Support"]=>
- bool%a
- ["PNG Support"]=>
- bool%a
- ["WBMP Support"]=>
- bool%a
- ["XPM Support"]=>
- bool%a
- ["XBM Support"]=>
- bool%a
- ["JIS-mapped Japanese Font Support"]=>
- bool%a
-}
+--TEST--
+Test gd_info() function : variation - Checking all the values in returned array
+--SKIPIF--
+<?php
+if(!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+if(!function_exists('gd_info')) {
+ die('skip gd_info function is not available');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array gd_info()
+ * Description: Retrieve information about the currently installed GD library
+ * Source code: ext/gd/gd.c
+ */
+
+echo "*** Testing gd_info() : variation ***\n";
+
+var_dump(gd_info());
+?>
+===DONE===
+--EXPECTF--
+*** Testing gd_info() : variation ***
+array(%d) {
+ ["GD Version"]=>
+ string(%d) %a
+ ["FreeType Support"]=>
+ bool%a
+ ["T1Lib Support"]=>
+ bool%a
+ ["GIF Read Support"]=>
+ bool%a
+ ["GIF Create Support"]=>
+ bool%a
+ ["JPEG Support"]=>
+ bool%a
+ ["PNG Support"]=>
+ bool%a
+ ["WBMP Support"]=>
+ bool%a
+ ["XPM Support"]=>
+ bool%a
+ ["XBM Support"]=>
+ bool%a
+ ["JIS-mapped Japanese Font Support"]=>
+ bool%a
+}
===DONE=== \ No newline at end of file
diff --git a/ext/gd/tests/gif.phpt b/ext/gd/tests/gif.phpt
index dd71a5404..2a3687ad7 100644
--- a/ext/gd/tests/gif.phpt
+++ b/ext/gd/tests/gif.phpt
@@ -2,7 +2,7 @@
gif in/out
--SKIPIF--
<?php
-// $Id: gif.phpt,v 1.2.2.3 2006/11/03 14:51:02 bjori Exp $
+// $Id: gif.phpt 222747 2006-11-03 14:51:02Z bjori $
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
diff --git a/ext/gd/tests/image_type_to_mime_type_error.phpt b/ext/gd/tests/image_type_to_mime_type_error.phpt
index 91801c6f7..88aacbf17 100644
--- a/ext/gd/tests/image_type_to_mime_type_error.phpt
+++ b/ext/gd/tests/image_type_to_mime_type_error.phpt
@@ -1,35 +1,35 @@
---TEST--
-Test image_type_to_mime_type() function : error conditions - Pass incorrect number of arguments
---FILE--
-<?php
-/* Prototype : proto string image_type_to_mime_type(int imagetype)
- * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
- * Source code: ext/standard/image.c
- */
-
-$imagetype = IMAGETYPE_GIF;
-$extra_arg = 10;
-echo "*** Testing image_type_to_mime_type() : error conditions ***\n";
-
-// Zero arguments
-echo "\n-- Testing image_type_to_mime_type() function with Zero arguments --\n";
-var_dump( image_type_to_mime_type() );
-
-//Test image_type_to_mime_type with one more than the expected number of arguments
-echo "\n-- Testing image_type_to_mime_type() function with more than expected no. of arguments --\n";
-var_dump( image_type_to_mime_type($imagetype, $extra_arg) );
-?>
-===DONE===
---EXPECTF--
-*** Testing image_type_to_mime_type() : error conditions ***
-
--- Testing image_type_to_mime_type() function with Zero arguments --
-
-Warning: image_type_to_mime_type() expects exactly 1 parameter, 0 given in %simage_type_to_mime_type_error.php on line 13
-NULL
-
--- Testing image_type_to_mime_type() function with more than expected no. of arguments --
-
-Warning: image_type_to_mime_type() expects exactly 1 parameter, 2 given in %simage_type_to_mime_type_error.php on line 17
-NULL
+--TEST--
+Test image_type_to_mime_type() function : error conditions - Pass incorrect number of arguments
+--FILE--
+<?php
+/* Prototype : proto string image_type_to_mime_type(int imagetype)
+ * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
+ * Source code: ext/standard/image.c
+ */
+
+$imagetype = IMAGETYPE_GIF;
+$extra_arg = 10;
+echo "*** Testing image_type_to_mime_type() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing image_type_to_mime_type() function with Zero arguments --\n";
+var_dump( image_type_to_mime_type() );
+
+//Test image_type_to_mime_type with one more than the expected number of arguments
+echo "\n-- Testing image_type_to_mime_type() function with more than expected no. of arguments --\n";
+var_dump( image_type_to_mime_type($imagetype, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing image_type_to_mime_type() : error conditions ***
+
+-- Testing image_type_to_mime_type() function with Zero arguments --
+
+Warning: image_type_to_mime_type() expects exactly 1 parameter, 0 given in %simage_type_to_mime_type_error.php on line 13
+NULL
+
+-- Testing image_type_to_mime_type() function with more than expected no. of arguments --
+
+Warning: image_type_to_mime_type() expects exactly 1 parameter, 2 given in %simage_type_to_mime_type_error.php on line 17
+NULL
===DONE=== \ No newline at end of file
diff --git a/ext/gd/tests/image_type_to_mime_type_variation1.phpt b/ext/gd/tests/image_type_to_mime_type_variation1.phpt
index 81851979e..0023b7125 100644
--- a/ext/gd/tests/image_type_to_mime_type_variation1.phpt
+++ b/ext/gd/tests/image_type_to_mime_type_variation1.phpt
@@ -1,152 +1,152 @@
---TEST--
-Test image_type_to_mime_type() function : usage variations - Pass different data types as imagetype
---FILE--
-<?php
-/* Prototype : string image_type_to_mime_type(int imagetype)
- * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
- * Source code: ext/standard/image.c
- */
-
-echo "*** Testing image_type_to_mime_type() : usage variations ***\n";
-
-error_reporting(E_ALL ^ E_NOTICE);
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-class MyClass
-{
- function __toString() {
- return "MyClass";
- }
-}
-
-//array of values to iterate over
-$values = array(
-
- // float data
- 100.5,
- -100.5,
- 100.1234567e10,
- 100.7654321E-10,
- .5,
-
- // array data
- array(),
- array('color' => 'red', 'item' => 'pen'),
-
- // null data
- NULL,
- null,
-
- // boolean data
- true,
- false,
- TRUE,
- FALSE,
-
- // empty data
- "",
- '',
-
- // string data
- "string",
- 'string',
-
- // object data
- new MyClass(),
-
- // undefined data
- @$undefined_var,
-
- // unset data
- @$unset_var,
-);
-
-// loop through each element of the array for imagetype
-$iterator = 1;
-foreach($values as $value) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( image_type_to_mime_type($value) );
- $iterator++;
-};
-?>
-===DONE===
---EXPECTF--
-*** Testing image_type_to_mime_type() : usage variations ***
-
--- Iteration 1 --
-string(24) "application/octet-stream"
-
--- Iteration 2 --
-string(24) "application/octet-stream"
-
--- Iteration 3 --
-string(24) "application/octet-stream"
-
--- Iteration 4 --
-string(24) "application/octet-stream"
-
--- Iteration 5 --
-string(24) "application/octet-stream"
-
--- Iteration 6 --
-
-Warning: image_type_to_mime_type() expects parameter 1 to be long, array given in %s on line %d
-NULL
-
--- Iteration 7 --
-
-Warning: image_type_to_mime_type() expects parameter 1 to be long, array given in %s on line %d
-NULL
-
--- Iteration 8 --
-string(24) "application/octet-stream"
-
--- Iteration 9 --
-string(24) "application/octet-stream"
-
--- Iteration 10 --
-string(9) "image/gif"
-
--- Iteration 11 --
-string(24) "application/octet-stream"
-
--- Iteration 12 --
-string(9) "image/gif"
-
--- Iteration 13 --
-string(24) "application/octet-stream"
-
--- Iteration 14 --
-
-Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
-NULL
-
--- Iteration 15 --
-
-Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
-NULL
-
--- Iteration 16 --
-
-Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
-NULL
-
--- Iteration 17 --
-
-Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
-NULL
-
--- Iteration 18 --
-
-Warning: image_type_to_mime_type() expects parameter 1 to be long, object given in %s on line %d
-NULL
-
--- Iteration 19 --
-string(24) "application/octet-stream"
-
--- Iteration 20 --
-string(24) "application/octet-stream"
+--TEST--
+Test image_type_to_mime_type() function : usage variations - Pass different data types as imagetype
+--FILE--
+<?php
+/* Prototype : string image_type_to_mime_type(int imagetype)
+ * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
+ * Source code: ext/standard/image.c
+ */
+
+echo "*** Testing image_type_to_mime_type() : usage variations ***\n";
+
+error_reporting(E_ALL ^ E_NOTICE);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+class MyClass
+{
+ function __toString() {
+ return "MyClass";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 100.5,
+ -100.5,
+ 100.1234567e10,
+ 100.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+);
+
+// loop through each element of the array for imagetype
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( image_type_to_mime_type($value) );
+ $iterator++;
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing image_type_to_mime_type() : usage variations ***
+
+-- Iteration 1 --
+string(24) "application/octet-stream"
+
+-- Iteration 2 --
+string(24) "application/octet-stream"
+
+-- Iteration 3 --
+string(24) "application/octet-stream"
+
+-- Iteration 4 --
+string(24) "application/octet-stream"
+
+-- Iteration 5 --
+string(24) "application/octet-stream"
+
+-- Iteration 6 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 8 --
+string(24) "application/octet-stream"
+
+-- Iteration 9 --
+string(24) "application/octet-stream"
+
+-- Iteration 10 --
+string(9) "image/gif"
+
+-- Iteration 11 --
+string(24) "application/octet-stream"
+
+-- Iteration 12 --
+string(9) "image/gif"
+
+-- Iteration 13 --
+string(24) "application/octet-stream"
+
+-- Iteration 14 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 19 --
+string(24) "application/octet-stream"
+
+-- Iteration 20 --
+string(24) "application/octet-stream"
===DONE=== \ No newline at end of file
diff --git a/ext/gd/tests/image_type_to_mime_type_variation2.phpt b/ext/gd/tests/image_type_to_mime_type_variation2.phpt
index 63a035a4a..141bc576f 100644
--- a/ext/gd/tests/image_type_to_mime_type_variation2.phpt
+++ b/ext/gd/tests/image_type_to_mime_type_variation2.phpt
@@ -1,80 +1,80 @@
---TEST--
-Test image_type_to_mime_type() function : usage variations - Pass decimal, octal, and hexadecimal values as imagetype
---FILE--
-<?php
-/* Prototype : string image_type_to_mime_type(int imagetype)
- * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
- * Source code: ext/standard/image.c
- */
-
-echo "*** Testing image_type_to_mime_type() : usage variations ***\n";
-
-error_reporting(E_ALL ^ E_NOTICE);
-$values = array (
- //Decimal values
- 0,
- 1,
- 12345,
- -12345,
-
- //Octal values
- 02,
- 010,
- 030071,
- -030071,
-
- //Hexadecimal values
- 0x0,
- 0x1,
- 0xABCD,
- -0xABCD
-);
-
-// loop through each element of the array for imagetype
-$iterator = 1;
-foreach($values as $value) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( image_type_to_mime_type($value) );
- $iterator++;
-};
-?>
-===DONE===
---EXPECT--
-*** Testing image_type_to_mime_type() : usage variations ***
-
--- Iteration 1 --
-string(24) "application/octet-stream"
-
--- Iteration 2 --
-string(9) "image/gif"
-
--- Iteration 3 --
-string(24) "application/octet-stream"
-
--- Iteration 4 --
-string(24) "application/octet-stream"
-
--- Iteration 5 --
-string(10) "image/jpeg"
-
--- Iteration 6 --
-string(10) "image/tiff"
-
--- Iteration 7 --
-string(24) "application/octet-stream"
-
--- Iteration 8 --
-string(24) "application/octet-stream"
-
--- Iteration 9 --
-string(24) "application/octet-stream"
-
--- Iteration 10 --
-string(9) "image/gif"
-
--- Iteration 11 --
-string(24) "application/octet-stream"
-
--- Iteration 12 --
-string(24) "application/octet-stream"
-===DONE===
+--TEST--
+Test image_type_to_mime_type() function : usage variations - Pass decimal, octal, and hexadecimal values as imagetype
+--FILE--
+<?php
+/* Prototype : string image_type_to_mime_type(int imagetype)
+ * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
+ * Source code: ext/standard/image.c
+ */
+
+echo "*** Testing image_type_to_mime_type() : usage variations ***\n";
+
+error_reporting(E_ALL ^ E_NOTICE);
+$values = array (
+ //Decimal values
+ 0,
+ 1,
+ 12345,
+ -12345,
+
+ //Octal values
+ 02,
+ 010,
+ 030071,
+ -030071,
+
+ //Hexadecimal values
+ 0x0,
+ 0x1,
+ 0xABCD,
+ -0xABCD
+);
+
+// loop through each element of the array for imagetype
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( image_type_to_mime_type($value) );
+ $iterator++;
+};
+?>
+===DONE===
+--EXPECT--
+*** Testing image_type_to_mime_type() : usage variations ***
+
+-- Iteration 1 --
+string(24) "application/octet-stream"
+
+-- Iteration 2 --
+string(9) "image/gif"
+
+-- Iteration 3 --
+string(24) "application/octet-stream"
+
+-- Iteration 4 --
+string(24) "application/octet-stream"
+
+-- Iteration 5 --
+string(10) "image/jpeg"
+
+-- Iteration 6 --
+string(10) "image/tiff"
+
+-- Iteration 7 --
+string(24) "application/octet-stream"
+
+-- Iteration 8 --
+string(24) "application/octet-stream"
+
+-- Iteration 9 --
+string(24) "application/octet-stream"
+
+-- Iteration 10 --
+string(9) "image/gif"
+
+-- Iteration 11 --
+string(24) "application/octet-stream"
+
+-- Iteration 12 --
+string(24) "application/octet-stream"
+===DONE===
diff --git a/ext/gd/tests/imageantialias_error1.phpt b/ext/gd/tests/imageantialias_error1.phpt
new file mode 100755
index 000000000..53fe0cc66
--- /dev/null
+++ b/ext/gd/tests/imageantialias_error1.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource in imageantialias() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imageantialias($image, true));
+?>
+--EXPECTF--
+Warning: imageantialias(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imageantialias_error2.phpt b/ext/gd/tests/imageantialias_error2.phpt
new file mode 100755
index 000000000..8dad8bd11
--- /dev/null
+++ b/ext/gd/tests/imageantialias_error2.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Testing wrong parameter passing in imageantialias() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+/*
+
+It seems the second argument passing is not being correclty checked.
+This test is failing due to this wrogn check
+
+*/
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imageantialias($image, 'wrong param')); // 'wrogn param' is converted to true
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/gd/tests/imagearc_basic.phpt b/ext/gd/tests/imagearc_basic.phpt
new file mode 100755
index 000000000..4647dd1e3
--- /dev/null
+++ b/ext/gd/tests/imagearc_basic.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Testing imagearc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc with white color
+imagearc($image, 50, 50, 30, 30, 0, 180, $white);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+f18ad8001afefee2e9b8c08d6884425b
diff --git a/ext/gd/tests/imagearc_error1.phpt b/ext/gd/tests/imagearc_error1.phpt
new file mode 100755
index 000000000..423f0356a
--- /dev/null
+++ b/ext/gd/tests/imagearc_error1.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Testing wrong param passing imagearc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc with white color
+imagearc($image, 50, 50, 30, 30, 0, 180);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECTF--
+Warning: imagearc() expects exactly 8 parameters, 7 given in %s on line %d
+abebb25b5a2813cfbf92f1f24365786a
diff --git a/ext/gd/tests/imagearc_variation1.phpt b/ext/gd/tests/imagearc_variation1.phpt
new file mode 100755
index 000000000..568d3a6d4
--- /dev/null
+++ b/ext/gd/tests/imagearc_variation1.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Testing passing negative end angle to imagearc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc with white color
+imagearc($image, 50, 50, 30, 30, 0, -90, $white);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+ed2c8427a9922dfd8a105f10a88a0d20
diff --git a/ext/gd/tests/imagearc_variation2.phpt b/ext/gd/tests/imagearc_variation2.phpt
new file mode 100755
index 000000000..045c68e61
--- /dev/null
+++ b/ext/gd/tests/imagearc_variation2.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Testing passing negative start angle to imagearc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc with white color
+imagearc($image, 50, 50, 30, 30, -90, 0, $white);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+463b4aea9d9acfab30016ee92613c779
diff --git a/ext/gd/tests/imagechar_basic.phpt b/ext/gd/tests/imagechar_basic.phpt
new file mode 100644
index 000000000..7e5fa931b
--- /dev/null
+++ b/ext/gd/tests/imagechar_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Testing imagechar() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$white = imagecolorallocate($image, 255,255,255);
+
+$result = imagechar($image, 1, 5, 5, 'C', $white);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+e94962ac28ad03bd4142cb1abe9ef98b
diff --git a/ext/gd/tests/imagechar_error1.phpt b/ext/gd/tests/imagechar_error1.phpt
new file mode 100644
index 000000000..373d3042e
--- /dev/null
+++ b/ext/gd/tests/imagechar_error1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-resource parameter 1 of imagechar() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$result = imagechar('string', 1, 5, 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagechar() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagechar_error2.phpt b/ext/gd/tests/imagechar_error2.phpt
new file mode 100644
index 000000000..02a95994f
--- /dev/null
+++ b/ext/gd/tests/imagechar_error2.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-image resource parameter 1 of imagechar() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$result = imagechar(tmpfile(), 1, 5, 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagechar(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagechar_error3.phpt b/ext/gd/tests/imagechar_error3.phpt
new file mode 100644
index 000000000..aec65e9cf
--- /dev/null
+++ b/ext/gd/tests/imagechar_error3.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 2 of imagechar() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagechar($image, 'string', 5, 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagechar() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagechar_error4.phpt b/ext/gd/tests/imagechar_error4.phpt
new file mode 100644
index 000000000..a9485f7bb
--- /dev/null
+++ b/ext/gd/tests/imagechar_error4.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 3 of imagechar() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagechar($image, 1, 'string', 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagechar() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagechar_error5.phpt b/ext/gd/tests/imagechar_error5.phpt
new file mode 100644
index 000000000..8670d1947
--- /dev/null
+++ b/ext/gd/tests/imagechar_error5.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 4 of imagechar() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagechar($image, 1, 5, 'string', 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagechar() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagechar_error6.phpt b/ext/gd/tests/imagechar_error6.phpt
new file mode 100644
index 000000000..eaef2f88c
--- /dev/null
+++ b/ext/gd/tests/imagechar_error6.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-string parameter 5 of imagechar() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagechar($image, 1, 5, 5, $image, 1);
+
+?>
+--EXPECTF--
+Warning: imagechar() expects parameter 5 to be string%S, %s given in %s on line %d
diff --git a/ext/gd/tests/imagechar_error7.phpt b/ext/gd/tests/imagechar_error7.phpt
new file mode 100644
index 000000000..fae23a71e
--- /dev/null
+++ b/ext/gd/tests/imagechar_error7.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 6 of imagechar() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagechar($image, 1, 5, 5, 'C', 'font');
+
+?>
+--EXPECTF--
+Warning: imagechar() expects parameter 6 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecharup_basic.phpt b/ext/gd/tests/imagecharup_basic.phpt
new file mode 100644
index 000000000..54c8dfaa4
--- /dev/null
+++ b/ext/gd/tests/imagecharup_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Testing imagecharup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$white = imagecolorallocate($image, 255,255,255);
+
+$result = imagecharup($image, 1, 5, 5, 'C', $white);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+79b48d5cef6d489bb68573df0296d775
diff --git a/ext/gd/tests/imagecharup_error1.phpt b/ext/gd/tests/imagecharup_error1.phpt
new file mode 100644
index 000000000..e0b3e318a
--- /dev/null
+++ b/ext/gd/tests/imagecharup_error1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-resource parameter 1 of imagecharup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$result = imagecharup('string', 1, 5, 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagecharup() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error2.phpt b/ext/gd/tests/imagecharup_error2.phpt
new file mode 100644
index 000000000..b78dc9221
--- /dev/null
+++ b/ext/gd/tests/imagecharup_error2.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-image resource parameter 1 of imagecharup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$result = imagecharup(tmpfile(), 1, 5, 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagecharup(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error3.phpt b/ext/gd/tests/imagecharup_error3.phpt
new file mode 100644
index 000000000..7e811bade
--- /dev/null
+++ b/ext/gd/tests/imagecharup_error3.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 2 of imagecharup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagecharup($image, 'string', 5, 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagecharup() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error4.phpt b/ext/gd/tests/imagecharup_error4.phpt
new file mode 100644
index 000000000..f76fdaca8
--- /dev/null
+++ b/ext/gd/tests/imagecharup_error4.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 3 of imagecharup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagecharup($image, 1, 'string', 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagecharup() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error5.phpt b/ext/gd/tests/imagecharup_error5.phpt
new file mode 100644
index 000000000..b56525933
--- /dev/null
+++ b/ext/gd/tests/imagecharup_error5.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 4 of imagecharup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagecharup($image, 1, 5, 'string', 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagecharup() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error6.phpt b/ext/gd/tests/imagecharup_error6.phpt
new file mode 100644
index 000000000..a1f12f1ea
--- /dev/null
+++ b/ext/gd/tests/imagecharup_error6.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-string parameter 5 of imagecharup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagecharup($image, 1, 5, 5, $image, 1);
+
+?>
+--EXPECTF--
+Warning: imagecharup() expects parameter 5 to be string%S, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error7.phpt b/ext/gd/tests/imagecharup_error7.phpt
new file mode 100644
index 000000000..b61189a54
--- /dev/null
+++ b/ext/gd/tests/imagecharup_error7.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 6 of imagecharup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagecharup($image, 1, 5, 5, 'C', 'font');
+
+?>
+--EXPECTF--
+Warning: imagecharup() expects parameter 6 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecolorallocatealpha_basic.phpt b/ext/gd/tests/imagecolorallocatealpha_basic.phpt
new file mode 100644
index 000000000..720c50098
--- /dev/null
+++ b/ext/gd/tests/imagecolorallocatealpha_basic.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Testing imagecolorallocatealpha()
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$img = imagecreatetruecolor(150, 150);
+
+$cor = imagecolorallocate($img, 50, 100, 255);
+$corA = imagecolorallocatealpha($img, 50, 100, 255, 50);
+//$whiteA = imagecolorallocatealpha($img, 255, 255, 255, 127);
+
+$half = imagefilledarc ( $img, 75, 75, 70, 70, 0, 180, $cor, IMG_ARC_PIE );
+$half2 = imagefilledarc ( $img, 75, 75, 70, 70, 180, 360, $corA, IMG_ARC_PIE );
+
+ob_start();
+imagepng($img, null, 9);
+$imgsrc = ob_get_contents();
+ob_end_clean();
+
+var_dump(md5(base64_encode($imgsrc)));
+var_dump($corA);
+?>
+--EXPECT--
+string(32) "b856a0b1a15efe0f79551ebbb5651fe8"
+int(842163455) \ No newline at end of file
diff --git a/ext/gd/tests/imagecolorallocatealpha_error1.phpt b/ext/gd/tests/imagecolorallocatealpha_error1.phpt
new file mode 100644
index 000000000..a9030248b
--- /dev/null
+++ b/ext/gd/tests/imagecolorallocatealpha_error1.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Testing imagecolorallocatealpha(): Wrong types for parameter 1
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$resource = tmpfile();
+
+imagecolorallocatealpha($resource, 255, 255, 255, 50);
+imagecolorallocatealpha('string', 255, 255, 255, 50);
+imagecolorallocatealpha(array(), 255, 255, 255, 50);
+imagecolorallocatealpha(null, 255, 255, 255, 50);
+?>
+--EXPECTF--
+Warning: imagecolorallocatealpha(): supplied resource is not a valid Image resource in %s on line %d
+
+Warning: imagecolorallocatealpha() expects parameter 1 to be resource, %s given in %s on line %d
+
+Warning: imagecolorallocatealpha() expects parameter 1 to be resource, array given in %s on line %d
+
+Warning: imagecolorallocatealpha() expects parameter 1 to be resource, null given in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagecolorallocatealpha_error2.phpt b/ext/gd/tests/imagecolorallocatealpha_error2.phpt
new file mode 100644
index 000000000..ba9e5de69
--- /dev/null
+++ b/ext/gd/tests/imagecolorallocatealpha_error2.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagecolorallocatealpha(): Wrong types for parameter 2
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$img = imagecreatetruecolor(200, 200);
+
+imagecolorallocatealpha($img, 'string-non-numeric', 255, 255, 50);
+imagecolorallocatealpha($img, array(), 255, 255, 50);
+imagecolorallocatealpha($img, tmpfile(), 255, 255, 50);
+?>
+--EXPECTF--
+Warning: imagecolorallocatealpha() expects parameter 2 to be long, %s given in %s on line %d
+
+Warning: imagecolorallocatealpha() expects parameter 2 to be long, array given in %s on line %d
+
+Warning: imagecolorallocatealpha() expects parameter 2 to be long, resource given in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagecolorallocatealpha_error3.phpt b/ext/gd/tests/imagecolorallocatealpha_error3.phpt
new file mode 100644
index 000000000..ee8f646e7
--- /dev/null
+++ b/ext/gd/tests/imagecolorallocatealpha_error3.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagecolorallocatealpha(): Wrong types for parameter 3
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$img = imagecreatetruecolor(200, 200);
+
+imagecolorallocatealpha($img, 255, 'string-non-numeric', 255, 50);
+imagecolorallocatealpha($img, 255, array(), 255, 50);
+imagecolorallocatealpha($img, 255, tmpfile(), 255, 50);
+?>
+--EXPECTF--
+Warning: imagecolorallocatealpha() expects parameter 3 to be long, %s given in %s on line %d
+
+Warning: imagecolorallocatealpha() expects parameter 3 to be long, array given in %s on line %d
+
+Warning: imagecolorallocatealpha() expects parameter 3 to be long, resource given in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagecolorallocatealpha_error4.phpt b/ext/gd/tests/imagecolorallocatealpha_error4.phpt
new file mode 100644
index 000000000..2b5b47189
--- /dev/null
+++ b/ext/gd/tests/imagecolorallocatealpha_error4.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagecolorallocatealpha(): Wrong types for parameter 4
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$img = imagecreatetruecolor(200, 200);
+
+imagecolorallocatealpha($img, 255, 255, 'string-non-numeric', 50);
+imagecolorallocatealpha($img, 255, 255, array(), 50);
+imagecolorallocatealpha($img, 255, 255, tmpfile(), 50);
+?>
+--EXPECTF--
+Warning: imagecolorallocatealpha() expects parameter 4 to be long, %s given in %s on line %d
+
+Warning: imagecolorallocatealpha() expects parameter 4 to be long, array given in %s on line %d
+
+Warning: imagecolorallocatealpha() expects parameter 4 to be long, resource given in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagecolorallocatealpha_error5.phpt b/ext/gd/tests/imagecolorallocatealpha_error5.phpt
new file mode 100644
index 000000000..2d77833e9
--- /dev/null
+++ b/ext/gd/tests/imagecolorallocatealpha_error5.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagecolorallocatealpha(): Wrong types for parameter 5
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$img = imagecreatetruecolor(200, 200);
+
+imagecolorallocatealpha($img, 255, 255, 255, 'string-non-numeric');
+imagecolorallocatealpha($img, 255, 255, 255, array());
+imagecolorallocatealpha($img, 255, 255, 255, tmpfile());
+?>
+--EXPECTF--
+Warning: imagecolorallocatealpha() expects parameter 5 to be long, %s given in %s on line %d
+
+Warning: imagecolorallocatealpha() expects parameter 5 to be long, array given in %s on line %d
+
+Warning: imagecolorallocatealpha() expects parameter 5 to be long, resource given in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagecolordeallocate_basic.phpt b/ext/gd/tests/imagecolordeallocate_basic.phpt
new file mode 100644
index 000000000..3c80c690f
--- /dev/null
+++ b/ext/gd/tests/imagecolordeallocate_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing imagecolordeallocate() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+$white = imagecolorallocate($image, 255, 255, 255);
+$result = imagecolordeallocate($image, $white);
+
+var_dump($result);
+
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/gd/tests/imagecolordeallocate_error1.phpt b/ext/gd/tests/imagecolordeallocate_error1.phpt
new file mode 100644
index 000000000..6d642d4a2
--- /dev/null
+++ b/ext/gd/tests/imagecolordeallocate_error1.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagecolordeallocate() of GD library with invalid resource type
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(180, 30);
+$white = imagecolorallocate($image, 255, 255, 255);
+
+$resource = tmpfile();
+
+$result = imagecolordeallocate($resource, $white);
+
+?>
+--EXPECTF--
+Warning: imagecolordeallocate(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagecolordeallocate_error2.phpt b/ext/gd/tests/imagecolordeallocate_error2.phpt
new file mode 100644
index 000000000..989e0fd97
--- /dev/null
+++ b/ext/gd/tests/imagecolordeallocate_error2.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Testing imagecolordeallocate() of GD library with no resource
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(180, 30);
+$white = imagecolorallocate($image, 255, 255, 255);
+$result = imagecolordeallocate('image', $white);
+
+?>
+--EXPECTF--
+Warning: imagecolordeallocate() expects parameter 1 to be resource, %s given %s on line %d
diff --git a/ext/gd/tests/imagecolordeallocate_error3.phpt b/ext/gd/tests/imagecolordeallocate_error3.phpt
new file mode 100644
index 000000000..8000218ad
--- /dev/null
+++ b/ext/gd/tests/imagecolordeallocate_error3.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagecolordeallocate() of GD library with Out of range intergers (Above)
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreate(180, 30);
+$white = imagecolorallocate($image, 255, 255, 255);
+
+$totalColors = imagecolorstotal($image);
+
+$result = imagecolordeallocate($image, $totalColors + 100);
+var_dump($result);
+?>
+--EXPECTF--
+Warning: imagecolordeallocate(): Color index 101 out of range in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagecolordeallocate_error4.phpt b/ext/gd/tests/imagecolordeallocate_error4.phpt
new file mode 100644
index 000000000..7aaeffebe
--- /dev/null
+++ b/ext/gd/tests/imagecolordeallocate_error4.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagecolordeallocate() of GD library with Out of range intergers (Below)
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreate(180, 30);
+$white = imagecolorallocate($image, 255, 255, 255);
+
+$totalColors = imagecolorstotal($image);
+
+$result = imagecolordeallocate($image, -1.0);
+var_dump($result);
+?>
+--EXPECTF--
+Warning: imagecolordeallocate(): Color index -1 out of range in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagecolormatch_basic.phpt b/ext/gd/tests/imagecolormatch_basic.phpt
new file mode 100755
index 000000000..1d188121b
--- /dev/null
+++ b/ext/gd/tests/imagecolormatch_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Basic test imagecolormatch() of GD library
+--CREDITS--
+Paulo Alves de Sousa Filho <pspalves [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$ima = imagecreatetruecolor(110, 20);
+$background_color = imagecolorallocate($ima, 0, 0, 0);
+$imb = imagecreate(110, 20);
+$background_color = imagecolorallocate($imb, 0, 0, 100);
+var_dump(imagecolormatch($ima, $imb));
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/gd/tests/imagecolormatch_error1.phpt b/ext/gd/tests/imagecolormatch_error1.phpt
new file mode 100755
index 000000000..9750a8b24
--- /dev/null
+++ b/ext/gd/tests/imagecolormatch_error1.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Send only 1 parameter imagecolormatch() of GD library
+--CREDITS--
+Paulo Alves de Sousa Filho <pspalves [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$ima = imagecreatetruecolor(110, 20);
+$background_color = imagecolorallocate($ima, 0, 0, 0);
+var_dump(imagecolormatch($ima));
+?>
+--EXPECTF--
+Warning: imagecolormatch() expects exactly 2 parameters, %d given in %s on line %d
+NULL
diff --git a/ext/gd/tests/imagecolormatch_error2.phpt b/ext/gd/tests/imagecolormatch_error2.phpt
new file mode 100755
index 000000000..bdb3c2460
--- /dev/null
+++ b/ext/gd/tests/imagecolormatch_error2.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Send not TrueColor to Image 1 parameter imagecolormatch() of GD library
+--CREDITS--
+Paulo Alves de Sousa Filho <pspalves [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$ima = imagecreate(110, 20);
+$background_color = imagecolorallocate($ima, 0, 0, 0);
+$imb = imagecreate(110, 20);
+$background_color = imagecolorallocate($imb, 0, 0, 100);
+var_dump(imagecolormatch($ima, $imb));
+?>
+--EXPECTF--
+Warning: imagecolormatch(): Image1 must be TrueColor in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagecolormatch_error3.phpt b/ext/gd/tests/imagecolormatch_error3.phpt
new file mode 100755
index 000000000..8793e1522
--- /dev/null
+++ b/ext/gd/tests/imagecolormatch_error3.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Send not TrueColor to Image 1 parameter imagecolormatch() of GD library
+--CREDITS--
+Paulo Alves de Sousa Filho <pspalves [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$ima = imagecreatetruecolor(110, 20);
+$background_color = imagecolorallocate($ima, 0, 0, 0);
+$imb = imagecreatetruecolor(110, 20);
+$background_color = imagecolorallocate($imb, 0, 0, 100);
+var_dump(imagecolormatch($ima, $imb));
+?>
+--EXPECTF--
+Warning: imagecolormatch(): Image2 must be Palette in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagecolormatch_error4.phpt b/ext/gd/tests/imagecolormatch_error4.phpt
new file mode 100755
index 000000000..0bfe767c2
--- /dev/null
+++ b/ext/gd/tests/imagecolormatch_error4.phpt
@@ -0,0 +1,20 @@
+--TEST--
+using different image sizes imagecolormatch() of GD library
+--CREDITS--
+Paulo Alves de Sousa Filho <pspalves [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$ima = imagecreatetruecolor(110, 20);
+$background_color = imagecolorallocate($ima, 0, 0, 0);
+$imb = imagecreate(100, 20);
+$background_color = imagecolorallocate($imb, 0, 0, 100);
+var_dump(imagecolormatch($ima, $imb));
+?>
+--EXPECTF--
+Warning: imagecolormatch(): Image1 and Image2 must be the same size in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagecolorset_basic.phpt b/ext/gd/tests/imagecolorset_basic.phpt
new file mode 100755
index 000000000..a1776ff50
--- /dev/null
+++ b/ext/gd/tests/imagecolorset_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test imagecolorset() function : basic functionality
+--CREDITS--
+Erick Belluci Tedeschi <erickbt86 [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+?>
+--FILE--
+<?php
+// Create a 300x100 image
+$im = imagecreate(300, 100);
+
+// Set the background to be red
+imagecolorallocate($im, 255, 0, 0);
+
+// Get the color index for the background
+$bg = imagecolorat($im, 0, 0);
+
+// Set the backgrund to be blue
+imagecolorset($im, $bg, 0, 0, 255);
+
+// Get output and generate md5 hash
+ob_start();
+imagepng($im, null, 9);
+$result_image = ob_get_contents();
+ob_end_clean();
+echo md5(base64_encode($result_image));
+imagedestroy($im);
+?>
+--EXPECT--
+6f2002aafb57b2d275fad6a6258d7476
diff --git a/ext/gd/tests/imageconvolution_basic.phpt b/ext/gd/tests/imageconvolution_basic.phpt
new file mode 100755
index 000000000..5a9aa8f95
--- /dev/null
+++ b/ext/gd/tests/imageconvolution_basic.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Testing imageconvolution() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+// Writes the text and apply a gaussian blur on the image
+imagestring($image, 5, 10, 8, 'Gaussian Blur Text', 0x00ff00);
+
+$gaussian = array(
+ array(1.0, 2.0, 1.0),
+ array(2.0, 4.0, 2.0),
+ array(1.0, 2.0, 1.0)
+);
+
+imageconvolution($image, $gaussian, 16, 0);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+594576a2a2a689447ffc07eb5a73f09b
diff --git a/ext/gd/tests/imageconvolution_error1.phpt b/ext/gd/tests/imageconvolution_error1.phpt
new file mode 100755
index 000000000..5dc250a85
--- /dev/null
+++ b/ext/gd/tests/imageconvolution_error1.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Testing wrong param passing imageconvolution() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+// Writes the text and apply a gaussian blur on the image
+imagestring($image, 5, 10, 8, 'Gaussian Blur Text', 0x00ff00);
+
+$gaussian = array(
+ array(1.0, 2.0, 1.0),
+ array(2.0, 4.0, 2.0),
+ array(1.0, 2.0, 1.0)
+);
+
+var_dump(imageconvolution($image, $gaussian, 16));
+?>
+--EXPECTF--
+Warning: imageconvolution() expects exactly 4 parameters, 3 given in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imageconvolution_error2.phpt b/ext/gd/tests/imageconvolution_error2.phpt
new file mode 100755
index 000000000..5161c198c
--- /dev/null
+++ b/ext/gd/tests/imageconvolution_error2.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Testing wrong array size 2x3 in imageconvolution() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+// Writes the text and apply a gaussian blur on the image
+imagestring($image, 5, 10, 8, 'Gaussian Blur Text', 0x00ff00);
+
+$gaussian = array(
+ array(1.0, 2.0, 1.0),
+ array(2.0, 4.0, 2.0)
+);
+
+var_dump(imageconvolution($image, $gaussian, 16, 0));
+?>
+--EXPECTF--
+Warning: imageconvolution(): You must have 3x3 array in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imageconvolution_error3.phpt b/ext/gd/tests/imageconvolution_error3.phpt
new file mode 100755
index 000000000..df6b148bd
--- /dev/null
+++ b/ext/gd/tests/imageconvolution_error3.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Testing wrong array size 3x2 in imageconvolution() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+// Writes the text and apply a gaussian blur on the image
+imagestring($image, 5, 10, 8, 'Gaussian Blur Text', 0x00ff00);
+
+$gaussian = array(
+ array(1.0, 2.0, 1.0),
+ array(2.0, 4.0, 2.0),
+ array(1.0, 2.0)
+);
+
+var_dump(imageconvolution($image, $gaussian, 16, 0));
+?>
+--EXPECTF--
+Warning: imageconvolution(): You must have 3x3 array in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagecopymerge_basic.phpt b/ext/gd/tests/imagecopymerge_basic.phpt
new file mode 100755
index 000000000..85f116262
--- /dev/null
+++ b/ext/gd/tests/imagecopymerge_basic.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Testing imagecopymerge() of GD library
+--CREDITS--
+Cleston Viel Vieira de Sousa <cleston [dot] vs [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$des = imagecreate(120, 120);
+$src = imagecreate(100, 100);
+
+imagecolorallocate($des, 50, 50, 200);
+$colorTXT_des = imagecolorallocate($des, 255, 255, 255);
+
+imagecolorallocate($src, 255, 255, 255);
+$colorTXT_src = imagecolorallocate($src, 0, 255, 255);
+
+imagestring($src, 1, 5, 5, "A Simple Text", $colorTXT_src);
+imagestring($des, 1, 5, 5, "Another Simple Text", $colorTXT_des);
+
+var_dump(imagecopymerge($des, $src, 20, 20, 0, 0, 50, 50, 75));
+
+
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/gd/tests/imagecopymerge_error.phpt b/ext/gd/tests/imagecopymerge_error.phpt
new file mode 100755
index 000000000..e43bf6945
--- /dev/null
+++ b/ext/gd/tests/imagecopymerge_error.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing wrong parameter passing imagecopymerge() of GD library
+--CREDITS--
+Cleston Viel Vieira de Sousa <cleston [dot] vs [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+imagecopymerge();
+
+?>
+--EXPECTF--
+Warning: imagecopymerge() expects exactly 9 parameters, 0 given in %s on line %d
diff --git a/ext/gd/tests/imagecreatetruecolor_basic.phpt b/ext/gd/tests/imagecreatetruecolor_basic.phpt
new file mode 100644
index 000000000..5c85f5238
--- /dev/null
+++ b/ext/gd/tests/imagecreatetruecolor_basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagecreatetruecolor() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+5a8fe9864cbd20e5dbe730c77f30db95
diff --git a/ext/gd/tests/imagecreatetruecolor_error1.phpt b/ext/gd/tests/imagecreatetruecolor_error1.phpt
new file mode 100644
index 000000000..e161688ce
--- /dev/null
+++ b/ext/gd/tests/imagecreatetruecolor_error1.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing imagecreatetruecolor(): error on non-long parameters
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor('s', 30);
+$image = imagecreatetruecolor(30, 's');
+?>
+--EXPECTF--
+Warning: imagecreatetruecolor() expects parameter 1 to be long, %s given in %s on line %d
+
+Warning: imagecreatetruecolor() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecreatetruecolor_error2.phpt b/ext/gd/tests/imagecreatetruecolor_error2.phpt
new file mode 100644
index 000000000..e4de7e382
--- /dev/null
+++ b/ext/gd/tests/imagecreatetruecolor_error2.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Testing imagecreatetruecolor(): error on out of bound parameters
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(-1, 30);
+$image = imagecreatetruecolor(30, -1);
+$image = imagecreatetruecolor(999999999999999999999999999, 30);
+$image = imagecreatetruecolor(30, 999999999999999999999999999);
+?>
+--EXPECTF--
+Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d
+
+Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d
+
+Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d
+
+Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagecreatetruecolor_error3.phpt b/ext/gd/tests/imagecreatetruecolor_error3.phpt
new file mode 100644
index 000000000..332cdef3a
--- /dev/null
+++ b/ext/gd/tests/imagecreatetruecolor_error3.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing imagecreatetruecolor(): error on wrong parameter count
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor();
+$image = imagecreatetruecolor(30);
+$image = imagecreatetruecolor(1,1,1);
+?>
+--EXPECTF--
+Warning: imagecreatetruecolor() expects exactly 2 parameters, 0 given in %s on line %d
+
+Warning: imagecreatetruecolor() expects exactly 2 parameters, 1 given in %s on line %d
+
+Warning: imagecreatetruecolor() expects exactly 2 parameters, 3 given in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imageellipse_basic.phpt b/ext/gd/tests/imageellipse_basic.phpt
new file mode 100755
index 000000000..bfd0b79f5
--- /dev/null
+++ b/ext/gd/tests/imageellipse_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Testing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// Draw a white ellipse
+imageellipse($image, 200, 150, 300, 200, 16777215);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+d8b9bc2ca224bd68569413f4617f8e1f
diff --git a/ext/gd/tests/imageellipse_error1.phpt b/ext/gd/tests/imageellipse_error1.phpt
new file mode 100755
index 000000000..aa8ad789d
--- /dev/null
+++ b/ext/gd/tests/imageellipse_error1.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// try to draw a white ellipse
+imageellipse('wrong param', 200, 150, 300, 200, 16777215);
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error2.phpt b/ext/gd/tests/imageellipse_error2.phpt
new file mode 100755
index 000000000..5b65bf8a5
--- /dev/null
+++ b/ext/gd/tests/imageellipse_error2.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// try to draw a white ellipse
+imageellipse($image, 'wrong param', 150, 300, 200, 16777215);
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error3.phpt b/ext/gd/tests/imageellipse_error3.phpt
new file mode 100755
index 000000000..cbac2f0e7
--- /dev/null
+++ b/ext/gd/tests/imageellipse_error3.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// try to draw a white ellipse
+imageellipse($image, 200, 'wrong param', 300, 200, 16777215);
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error4.phpt b/ext/gd/tests/imageellipse_error4.phpt
new file mode 100755
index 000000000..dec2e0fbd
--- /dev/null
+++ b/ext/gd/tests/imageellipse_error4.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// try to draw a white ellipse
+imageellipse($image, 200, 150, 'wrong param', 200, 16777215);
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error5.phpt b/ext/gd/tests/imageellipse_error5.phpt
new file mode 100755
index 000000000..4272470c6
--- /dev/null
+++ b/ext/gd/tests/imageellipse_error5.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// try to draw a white ellipse
+imageellipse($image, 200, 150, 300, 'wrong param', 16777215);
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects parameter 5 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error6.phpt b/ext/gd/tests/imageellipse_error6.phpt
new file mode 100755
index 000000000..8628525b6
--- /dev/null
+++ b/ext/gd/tests/imageellipse_error6.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// try to draw a white ellipse
+imageellipse($image, 200, 150, 300, 200, 'wrong param');
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects parameter 6 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error7.phpt b/ext/gd/tests/imageellipse_error7.phpt
new file mode 100755
index 000000000..23f1eeeab
--- /dev/null
+++ b/ext/gd/tests/imageellipse_error7.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a resource
+$image = tmpfile();
+
+// try to draw a white ellipse
+imageellipse($image, 200, 150, 300, 200, 16777215);
+?>
+--EXPECTF--
+Warning: imageellipse(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error8.phpt b/ext/gd/tests/imageellipse_error8.phpt
new file mode 100755
index 000000000..3fefb56bd
--- /dev/null
+++ b/ext/gd/tests/imageellipse_error8.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor( 400, 300 );
+
+// try to draw a white ellipse
+imageellipse( $image, 200, 150, 300, 200 );
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects exactly 6 parameters, %d given in %s on line %d
diff --git a/ext/gd/tests/imagefilledarc_basic.phpt b/ext/gd/tests/imagefilledarc_basic.phpt
new file mode 100755
index 000000000..9ff9bd371
--- /dev/null
+++ b/ext/gd/tests/imagefilledarc_basic.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Testing imagefilledarc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc and fill it with white color
+imagefilledarc($image, 50, 50, 30, 30, 0, 90, $white, IMG_ARC_PIE);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+894f394c7f2e2364642ef27fea6bfc33
diff --git a/ext/gd/tests/imagefilledarc_error1.phpt b/ext/gd/tests/imagefilledarc_error1.phpt
new file mode 100755
index 000000000..b2bc4172d
--- /dev/null
+++ b/ext/gd/tests/imagefilledarc_error1.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Testing wrong param passing imagefilledarc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc and fill it with white color
+imagefilledarc($image, 50, 50, 30, 30, 0, 90, $white);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECTF--
+Warning: imagefilledarc() expects exactly 9 parameters, 8 given in %s on line %d
+abebb25b5a2813cfbf92f1f24365786a
diff --git a/ext/gd/tests/imagefilledarc_variation1.phpt b/ext/gd/tests/imagefilledarc_variation1.phpt
new file mode 100755
index 000000000..2dec1ead2
--- /dev/null
+++ b/ext/gd/tests/imagefilledarc_variation1.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Testing passing negative end angle to imagefilledarc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc and fill it with white color
+imagefilledarc($image, 50, 50, 30, 30, 0, -25, $white, IMG_ARC_PIE);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+b77bbb8207e5adbebfcc8bd1c4074305
diff --git a/ext/gd/tests/imagefilledarc_variation2.phpt b/ext/gd/tests/imagefilledarc_variation2.phpt
new file mode 100755
index 000000000..5c8ffba00
--- /dev/null
+++ b/ext/gd/tests/imagefilledarc_variation2.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Testing passing negative start angle to imagefilledarc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc and fill it with white color
+imagefilledarc($image, 50, 50, 30, 30, -25, 25, $white, IMG_ARC_PIE);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+b8b572812b3c85678f6c38c4ecca7619
diff --git a/ext/gd/tests/imagefilltoborder_basic.phpt b/ext/gd/tests/imagefilltoborder_basic.phpt
new file mode 100755
index 000000000..80b84d2c6
--- /dev/null
+++ b/ext/gd/tests/imagefilltoborder_basic.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Testing imagefilltoborder() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Fill border
+imagefilltoborder( $image, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
+
+ob_start();
+imagepng( $image, null, 9 );
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+
+?>
+--EXPECT--
+847ec236f1c4d14c465306c8408550fc
diff --git a/ext/gd/tests/imagefilltoborder_error1.phpt b/ext/gd/tests/imagefilltoborder_error1.phpt
new file mode 100755
index 000000000..9412da739
--- /dev/null
+++ b/ext/gd/tests/imagefilltoborder_error1.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Testing wrong param passing imagefilltoborder() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( 'wrong param', 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
+
+?>
+--EXPECTF--
+Warning: imagefilltoborder() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagefilltoborder_error2.phpt b/ext/gd/tests/imagefilltoborder_error2.phpt
new file mode 100755
index 000000000..dcbf90470
--- /dev/null
+++ b/ext/gd/tests/imagefilltoborder_error2.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Testing wrong param passing imagefilltoborder() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( $image, 'wrong param', 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
+
+?>
+--EXPECTF--
+Warning: imagefilltoborder() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagefilltoborder_error3.phpt b/ext/gd/tests/imagefilltoborder_error3.phpt
new file mode 100755
index 000000000..73f6cf7b8
--- /dev/null
+++ b/ext/gd/tests/imagefilltoborder_error3.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Testing wrong param passing imagefilltoborder() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( $image, 50, 'wrong param', imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
+
+?>
+--EXPECTF--
+Warning: imagefilltoborder() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagefilltoborder_error4.phpt b/ext/gd/tests/imagefilltoborder_error4.phpt
new file mode 100755
index 000000000..a5073d80b
--- /dev/null
+++ b/ext/gd/tests/imagefilltoborder_error4.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Testing wrong param passing imagefilltoborder() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( $image, 50, 50, 'wrong param', imagecolorallocate( $image, 255, 0, 0 ) );
+
+?>
+--EXPECTF--
+Warning: imagefilltoborder() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagefilltoborder_error5.phpt b/ext/gd/tests/imagefilltoborder_error5.phpt
new file mode 100755
index 000000000..eff344a78
--- /dev/null
+++ b/ext/gd/tests/imagefilltoborder_error5.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Testing wrong param passing imagefilltoborder() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( $image, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), 'wrong param' );
+
+?>
+--EXPECTF--
+Warning: imagefilltoborder() expects parameter 5 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagefilltoborder_error6.phpt b/ext/gd/tests/imagefilltoborder_error6.phpt
new file mode 100755
index 000000000..b5ce53b0d
--- /dev/null
+++ b/ext/gd/tests/imagefilltoborder_error6.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Testing wrong param passing imagefilltoborder() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+$image_foo = tmpfile();
+imagefilltoborder( $image_foo, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
+
+?>
+--EXPECTF--
+Warning: imagefilltoborder(): supplied resource is not a valid Image resource in %s on line %d
+
+
diff --git a/ext/gd/tests/imagefilltoborder_error7.phpt b/ext/gd/tests/imagefilltoborder_error7.phpt
new file mode 100755
index 000000000..aeb7d8262
--- /dev/null
+++ b/ext/gd/tests/imagefilltoborder_error7.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Testing wrong param passing imagefilltoborder() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded("gd")) die("skip GD not present; skipping test");
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( $image, 50, 50 );
+
+?>
+--EXPECTF--
+Warning: imagefilltoborder() expects exactly 5 parameters, %d given in %s on line %d
diff --git a/ext/gd/tests/imagefilter_error1.phpt b/ext/gd/tests/imagefilter_error1.phpt
new file mode 100755
index 000000000..fb96ae32b
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error1.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter passing in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image));
+?>
+--EXPECTF--
+Warning: Wrong parameter count for imagefilter() in %s on line %d
+NULL
diff --git a/ext/gd/tests/imagefilter_error10.phpt b/ext/gd/tests/imagefilter_error10.phpt
new file mode 100755
index 000000000..8b4121162
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error10.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of EMBOSS in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_EMBOSS));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error11.phpt b/ext/gd/tests/imagefilter_error11.phpt
new file mode 100755
index 000000000..9b1cf4d92
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error11.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource passing of EDGEDETECT in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_EDGEDETECT));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error12.phpt b/ext/gd/tests/imagefilter_error12.phpt
new file mode 100755
index 000000000..33fee28e6
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error12.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of COLORIZE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_COLORIZE, 255, 255, 255));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error13.phpt b/ext/gd/tests/imagefilter_error13.phpt
new file mode 100755
index 000000000..687d148be
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error13.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing wrong parameter value of COLORIZE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, IMG_FILTER_COLORIZE, 800, 255, 255)); // Wrong value is truncated to 255
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/gd/tests/imagefilter_error14.phpt b/ext/gd/tests/imagefilter_error14.phpt
new file mode 100755
index 000000000..64103954d
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error14.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter type of COLORIZE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, IMG_FILTER_COLORIZE, 'wrong parameter', 255, 255));
+?>
+--EXPECTF--
+Warning: imagefilter() expects parameter 3 to be long, %unicode_string_optional% given in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error15.phpt b/ext/gd/tests/imagefilter_error15.phpt
new file mode 100755
index 000000000..87a412e4c
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error15.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of CONTRAST in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_CONTRAST, 2));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error16.phpt b/ext/gd/tests/imagefilter_error16.phpt
new file mode 100755
index 000000000..2a84c2f78
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error16.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter type of CONTRAST in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, IMG_FILTER_CONTRAST, 'wrong parameter'));
+?>
+--EXPECTF--
+Warning: imagefilter() expects parameter 3 to be long, %unicode_string_optional% given in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error17.phpt b/ext/gd/tests/imagefilter_error17.phpt
new file mode 100755
index 000000000..adafc3e5e
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error17.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of GRAYSCALE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_GRAYSCALE));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error18.phpt b/ext/gd/tests/imagefilter_error18.phpt
new file mode 100755
index 000000000..b636bfc07
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error18.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of NEGATE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_NEGATE));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error19.phpt b/ext/gd/tests/imagefilter_error19.phpt
new file mode 100755
index 000000000..e36b817aa
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error19.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter type of BRIGHTNESS in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, IMG_FILTER_BRIGHTNESS, 'wrong parameter'));
+?>
+--EXPECTF--
+Warning: imagefilter() expects parameter 3 to be long, %unicode_string_optional% given in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error2.phpt b/ext/gd/tests/imagefilter_error2.phpt
new file mode 100755
index 000000000..62ac6620c
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error2.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter passing in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, 'wrong parameter'));
+?>
+--EXPECTF--
+Warning: imagefilter() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
+NULL
diff --git a/ext/gd/tests/imagefilter_error20.phpt b/ext/gd/tests/imagefilter_error20.phpt
new file mode 100755
index 000000000..f3db724ac
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error20.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of BRIGHTNESS in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_BRIGHTNESS, 1));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error3.phpt b/ext/gd/tests/imagefilter_error3.phpt
new file mode 100755
index 000000000..67f6c199f
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error3.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter passing of PIXELATE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, IMG_FILTER_PIXELATE, 'wrong parameter'));
+?>
+--EXPECTF--
+Warning: imagefilter() expects parameter 3 to be long, %unicode_string_optional% given in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error4.phpt b/ext/gd/tests/imagefilter_error4.phpt
new file mode 100755
index 000000000..babb37e0a
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error4.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of PIXELATE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_PIXELATE, 3));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error5.phpt b/ext/gd/tests/imagefilter_error5.phpt
new file mode 100755
index 000000000..a7d944342
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error5.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter passing of SMOOTH in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, IMG_FILTER_SMOOTH, 'wrong parameter'));
+?>
+--EXPECTF--
+Warning: imagefilter() expects parameter 3 to be double, %unicode_string_optional% given in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error6.phpt b/ext/gd/tests/imagefilter_error6.phpt
new file mode 100755
index 000000000..05dd187a2
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error6.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of SMOOTH in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_SMOOTH, 3.0));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error7.phpt b/ext/gd/tests/imagefilter_error7.phpt
new file mode 100755
index 000000000..6c08e5acf
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error7.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of MEAN_REMOVAL in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_MEAN_REMOVAL));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error8.phpt b/ext/gd/tests/imagefilter_error8.phpt
new file mode 100755
index 000000000..57c3168f7
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error8.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of SELECTIVE_BLUR in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_SELECTIVE_BLUR));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error9.phpt b/ext/gd/tests/imagefilter_error9.phpt
new file mode 100755
index 000000000..a74ea643c
--- /dev/null
+++ b/ext/gd/tests/imagefilter_error9.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of GAUSSIAN_BLUR in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefontheight_basic.phpt b/ext/gd/tests/imagefontheight_basic.phpt
new file mode 100644
index 000000000..bfcd0bb27
--- /dev/null
+++ b/ext/gd/tests/imagefontheight_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Testing imagefontheight() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+var_dump(imagefontheight(1),imagefontheight(2),imagefontheight(3),imagefontheight(4),imagefontheight(5));
+?>
+--EXPECT--
+int(8)
+int(13)
+int(13)
+int(16)
+int(15)
diff --git a/ext/gd/tests/imagefontheight_error1.phpt b/ext/gd/tests/imagefontheight_error1.phpt
new file mode 100644
index 000000000..88d177164
--- /dev/null
+++ b/ext/gd/tests/imagefontheight_error1.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Testing error on string parameter for imagefontheight() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+imagefontheight('string');
+?>
+--EXPECTF--
+Warning: imagefontheight() expects parameter 1 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagefontwidth_basic.phpt b/ext/gd/tests/imagefontwidth_basic.phpt
new file mode 100644
index 000000000..0a9df5209
--- /dev/null
+++ b/ext/gd/tests/imagefontwidth_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing imagefontwidth() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+var_dump(imagefontwidth(1),imagefontwidth(2),imagefontwidth(3),imagefontwidth(4),imagefontwidth(5));
+var_dump(imagefontwidth(1) < imagefontwidth(5));
+?>
+--EXPECT--
+int(5)
+int(6)
+int(7)
+int(8)
+int(9)
+bool(true)
diff --git a/ext/gd/tests/imagefontwidth_error1.phpt b/ext/gd/tests/imagefontwidth_error1.phpt
new file mode 100644
index 000000000..dd80034fc
--- /dev/null
+++ b/ext/gd/tests/imagefontwidth_error1.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Testing error on string parameter for imagefontwidth() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+imagefontwidth('string');
+?>
+--EXPECTF--
+Warning: imagefontwidth() expects parameter 1 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagegammacorrect_basic.phpt b/ext/gd/tests/imagegammacorrect_basic.phpt
new file mode 100644
index 000000000..b568728e7
--- /dev/null
+++ b/ext/gd/tests/imagegammacorrect_basic.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Testing imagegammacorrect() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(150, 150);
+
+$grey = imagecolorallocate($image,6,6,6);
+$gray = imagecolorallocate($image,15,15,15);
+
+$half = imagefilledarc ( $image, 75, 75, 70, 70, 0, 180, $grey, IMG_ARC_PIE );
+$half2 = imagefilledarc ( $image, 75, 75, 70, 70, 0, -180, $gray, IMG_ARC_PIE );
+
+$gamma = imagegammacorrect($image, 1, 5);
+
+if ($gamma){
+ ob_start();
+ imagepng($image, null, 9);
+ $img = ob_get_contents();
+ ob_end_clean();
+}
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+30639772903913594bc665743e1b9ab8
diff --git a/ext/gd/tests/imagegammacorrect_error1.phpt b/ext/gd/tests/imagegammacorrect_error1.phpt
new file mode 100644
index 000000000..fdcdec8be
--- /dev/null
+++ b/ext/gd/tests/imagegammacorrect_error1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error with non-resource paramenter of imagegammacorrect() of GD library,
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$gamma = imagegammacorrect('string', 1, 5);
+
+?>
+--EXPECTF--
+Warning: imagegammacorrect() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagegammacorrect_error2.phpt b/ext/gd/tests/imagegammacorrect_error2.phpt
new file mode 100644
index 000000000..604d7da79
--- /dev/null
+++ b/ext/gd/tests/imagegammacorrect_error2.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error with non-Image resource paramenter of imagegammacorrect() of GD library,
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+$gamma = imagegammacorrect($image, 1, 5);
+
+?>
+--EXPECTF--
+Warning: imagegammacorrect(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagegammacorrect_error3.phpt b/ext/gd/tests/imagegammacorrect_error3.phpt
new file mode 100644
index 000000000..fd680aa13
--- /dev/null
+++ b/ext/gd/tests/imagegammacorrect_error3.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error with non-double first paramenter of imagegammacorrect() of GD library,
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$gamma = imagegammacorrect($image, 'string', 5);
+
+?>
+--EXPECTF--
+Warning: imagegammacorrect() expects parameter 2 to be double, %s given in %s on line %d
diff --git a/ext/gd/tests/imagegammacorrect_error4.phpt b/ext/gd/tests/imagegammacorrect_error4.phpt
new file mode 100644
index 000000000..5476d4c85
--- /dev/null
+++ b/ext/gd/tests/imagegammacorrect_error4.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error with non-double second paramenter of imagegammacorrect() of GD library,
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$gamma = imagegammacorrect($image, 1, 'string');
+
+?>
+--EXPECTF--
+Warning: imagegammacorrect() expects parameter 3 to be double, %s given in %s on line %d
diff --git a/ext/gd/tests/imagegammacorrect_variation1.phpt b/ext/gd/tests/imagegammacorrect_variation1.phpt
new file mode 100644
index 000000000..cda96c628
--- /dev/null
+++ b/ext/gd/tests/imagegammacorrect_variation1.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Testing imagegammacorrect() of GD library with non TrueColor image
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreate(150, 150);
+
+$grey = imagecolorallocate($image,6,6,6);
+$gray = imagecolorallocate($image,15,15,15);
+
+$half = imagefilledarc ( $image, 75, 75, 70, 70, 0, 180, $grey, IMG_ARC_PIE );
+$half2 = imagefilledarc ( $image, 75, 75, 70, 70, 0, -180, $gray, IMG_ARC_PIE );
+
+$gamma = imagegammacorrect($image, 1, 5);
+
+if ($gamma){
+ ob_start();
+ imagepng($image, null, 9);
+ $img = ob_get_contents();
+ ob_end_clean();
+}
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+7716c0905ae08bd84b4d6cba8969a42e
diff --git a/ext/gd/tests/imageinterlace_basic.phpt b/ext/gd/tests/imageinterlace_basic.phpt
new file mode 100755
index 000000000..657b256d6
--- /dev/null
+++ b/ext/gd/tests/imageinterlace_basic.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing imageinterlace() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+var_dump(imageinterlace($image));
+?>
+--EXPECT--
+int(0)
diff --git a/ext/gd/tests/imageinterlace_error1.phpt b/ext/gd/tests/imageinterlace_error1.phpt
new file mode 100755
index 000000000..5c871e7bb
--- /dev/null
+++ b/ext/gd/tests/imageinterlace_error1.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Testing passing no parameters to imageinterlace() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+//calling with no parameters
+var_dump(imageinterlace());
+?>
+--EXPECTF--
+Warning: imageinterlace() expects at least 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/gd/tests/imageinterlace_error2.phpt b/ext/gd/tests/imageinterlace_error2.phpt
new file mode 100755
index 000000000..808c88a31
--- /dev/null
+++ b/ext/gd/tests/imageinterlace_error2.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing resource that is not a image to imageinterlace() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = fopen('php://stdin', 'r');
+var_dump(imageinterlace($image));
+?>
+--EXPECTF--
+Warning: imageinterlace(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imageinterlace_variation1.phpt b/ext/gd/tests/imageinterlace_variation1.phpt
new file mode 100755
index 000000000..2c224ef41
--- /dev/null
+++ b/ext/gd/tests/imageinterlace_variation1.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Testing setting the interlace bit on with imageinterlace() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+var_dump(imageinterlace($image, 1));
+var_dump(imageinterlace($image));
+?>
+--EXPECT--
+int(1)
+int(1)
diff --git a/ext/gd/tests/imageinterlace_variation2.phpt b/ext/gd/tests/imageinterlace_variation2.phpt
new file mode 100755
index 000000000..b4735dcfb
--- /dev/null
+++ b/ext/gd/tests/imageinterlace_variation2.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Testing setting the interlace bit off with imageinterlace() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+//setting the interlace bit to on
+imageinterlace($image, 1);
+
+//setting de interlace bit to off
+var_dump(imageinterlace($image, 0));
+var_dump(imageinterlace($image));
+?>
+--EXPECT--
+int(0)
+int(0)
diff --git a/ext/gd/tests/imageistruecolor_basic.phpt b/ext/gd/tests/imageistruecolor_basic.phpt
new file mode 100644
index 000000000..a78aaa46e
--- /dev/null
+++ b/ext/gd/tests/imageistruecolor_basic.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing imageistruecolor() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imageistruecolor($image));
+?>
+--EXPECT--
+bool(true) \ No newline at end of file
diff --git a/ext/gd/tests/imageistruecolor_error1.phpt b/ext/gd/tests/imageistruecolor_error1.phpt
new file mode 100644
index 000000000..06453b7d3
--- /dev/null
+++ b/ext/gd/tests/imageistruecolor_error1.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Testing imageistruecolor(): wrong parameters
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$resource = tmpfile();
+
+imageistruecolor('string');
+imageistruecolor($resource);
+imageistruecolor(array());
+?>
+--EXPECTF--
+Warning: imageistruecolor() expects parameter 1 to be resource, string given in %s on line %d
+
+Warning: imageistruecolor(): supplied resource is not a valid Image resource in %s on line %d
+
+Warning: imageistruecolor() expects parameter 1 to be resource, array given in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagelayereffect_basic.phpt b/ext/gd/tests/imagelayereffect_basic.phpt
new file mode 100644
index 000000000..6dbc8600c
--- /dev/null
+++ b/ext/gd/tests/imagelayereffect_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Testing imagelayereffect() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!GD_BUNDLED) die('function only available in bundled, external GD detected');
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+$layer = imagelayereffect($image, IMG_EFFECT_REPLACE);
+
+if ($layer){
+ ob_start();
+ imagepng($image, null, 9);
+ $img = ob_get_contents();
+ ob_end_clean();
+}
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+5a8fe9864cbd20e5dbe730c77f30db95
diff --git a/ext/gd/tests/imagelayereffect_error1.phpt b/ext/gd/tests/imagelayereffect_error1.phpt
new file mode 100644
index 000000000..ad457103c
--- /dev/null
+++ b/ext/gd/tests/imagelayereffect_error1.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Testing imagelayereffect() with invalid resource of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!GD_BUNDLED) die('function only available in bundled, external GD detected');
+?>
+--FILE--
+<?php
+$layer = imagelayereffect('invalid_resource', IMG_EFFECT_REPLACE);
+?>
+--EXPECTF--
+Warning: imagelayereffect() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagelayereffect_error2.phpt b/ext/gd/tests/imagelayereffect_error2.phpt
new file mode 100644
index 000000000..7fb993969
--- /dev/null
+++ b/ext/gd/tests/imagelayereffect_error2.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Testing imagelayereffect() wth invalid effect of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!GD_BUNDLED) die('function only available in bundled, external GD detected');
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+$layer = imagelayereffect($image, 'IMG_EFFECT_REPLACE');
+?>
+--EXPECTF--
+Warning: imagelayereffect() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagelayereffect_error3.phpt b/ext/gd/tests/imagelayereffect_error3.phpt
new file mode 100644
index 000000000..9f9918633
--- /dev/null
+++ b/ext/gd/tests/imagelayereffect_error3.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing imagelayereffect() with invalid resource of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!GD_BUNDLED) die('function only available in bundled, external GD detected');
+?>
+--FILE--
+<?php
+$resource = tmpfile();
+$layer = imagelayereffect($resource, IMG_EFFECT_REPLACE);
+?>
+--EXPECTF--
+Warning: imagelayereffect(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_basic.phpt b/ext/gd/tests/imagerectangle_basic.phpt
new file mode 100755
index 000000000..0574ad35c
--- /dev/null
+++ b/ext/gd/tests/imagerectangle_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Testing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
+
+ob_start();
+imagepng( $image, null, 9 );
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+
+?>
+--EXPECT--
+282aaecfdd50091821d63093d9bb1bb9 \ No newline at end of file
diff --git a/ext/gd/tests/imagerectangle_error1.phpt b/ext/gd/tests/imagerectangle_error1.phpt
new file mode 100755
index 000000000..2b4235e85
--- /dev/null
+++ b/ext/gd/tests/imagerectangle_error1.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error2.phpt b/ext/gd/tests/imagerectangle_error2.phpt
new file mode 100755
index 000000000..c6e740214
--- /dev/null
+++ b/ext/gd/tests/imagerectangle_error2.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a resource
+$image = tmpfile();
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50, 2 );
+?>
+--EXPECTF--
+Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagerectangle_error3.phpt b/ext/gd/tests/imagerectangle_error3.phpt
new file mode 100755
index 000000000..d5dd4c1d8
--- /dev/null
+++ b/ext/gd/tests/imagerectangle_error3.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error4.phpt b/ext/gd/tests/imagerectangle_error4.phpt
new file mode 100755
index 000000000..7ecc4167a
--- /dev/null
+++ b/ext/gd/tests/imagerectangle_error4.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error5.phpt b/ext/gd/tests/imagerectangle_error5.phpt
new file mode 100755
index 000000000..b4288d270
--- /dev/null
+++ b/ext/gd/tests/imagerectangle_error5.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error6.phpt b/ext/gd/tests/imagerectangle_error6.phpt
new file mode 100755
index 000000000..aab378e55
--- /dev/null
+++ b/ext/gd/tests/imagerectangle_error6.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects parameter 5 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error7.phpt b/ext/gd/tests/imagerectangle_error7.phpt
new file mode 100755
index 000000000..f6ed778db
--- /dev/null
+++ b/ext/gd/tests/imagerectangle_error7.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects parameter 6 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error8.phpt b/ext/gd/tests/imagerectangle_error8.phpt
new file mode 100755
index 000000000..361de69cd
--- /dev/null
+++ b/ext/gd/tests/imagerectangle_error8.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50 );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects exactly 6 parameters, %d given in %s on line %d
diff --git a/ext/gd/tests/imagesetbrush_basic.phpt b/ext/gd/tests/imagesetbrush_basic.phpt
new file mode 100755
index 000000000..790184ddc
--- /dev/null
+++ b/ext/gd/tests/imagesetbrush_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test imagesetbrush() function : basic functionality
+--CREDITS--
+Erick Belluci Tedeschi <erickbt86 [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+?>
+--FILE--
+<?php
+// Create the brush image
+$img = imagecreate(10, 10);
+
+// Create the main image, 100x100
+$mainimg = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($img, 255, 0, 0);
+imagefilledrectangle($img, 0, 0, 299, 99, $white);
+
+// Set the brush
+imagesetbrush($mainimg, $img);
+
+// Draw a couple of brushes, each overlaying each
+imageline($mainimg, 50, 50, 50, 60, IMG_COLOR_BRUSHED);
+
+// Get output and generate md5 hash
+ob_start();
+imagepng($mainimg, null, 9);
+$result_image = ob_get_contents();
+ob_end_clean();
+echo md5(base64_encode($result_image));
+?>
+--EXPECT--
+8168577c0d1fe6d9d11397cb15263d82
diff --git a/ext/gd/tests/imagesetthickness_basic.phpt b/ext/gd/tests/imagesetthickness_basic.phpt
new file mode 100644
index 000000000..a8b079bed
--- /dev/null
+++ b/ext/gd/tests/imagesetthickness_basic.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Testing imagetruecolortopalette() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+// Create a 200x100 image
+$image = imagecreatetruecolor(200, 100);
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+$black = imagecolorallocate($image, 0x00, 0x00, 0x00);
+
+// Set the background to be white
+imagefilledrectangle($image, 0, 0, 299, 99, $white);
+
+// Set the line thickness to 5
+imagesetthickness($image, 5);
+
+// Draw the rectangle
+imagerectangle($image, 14, 14, 185, 85, $black);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+93c3077f1bdc372cd0b0db96db282985 \ No newline at end of file
diff --git a/ext/gd/tests/imagesetthickness_error1.phpt b/ext/gd/tests/imagesetthickness_error1.phpt
new file mode 100644
index 000000000..0aed3a1f2
--- /dev/null
+++ b/ext/gd/tests/imagesetthickness_error1.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong types for first parameter
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$resource = tmpfile();
+
+imagesetthickness('string', 5);
+imagesetthickness(array(), 5);
+imagesetthickness($resource, 5);
+?>
+--EXPECTF--
+Warning: imagesetthickness() expects parameter 1 to be resource, %s given in %s on line %d
+
+Warning: imagesetthickness() expects parameter 1 to be resource, array given in %s on line %d
+
+Warning: imagesetthickness(): supplied resource is not a valid Image resource in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagesetthickness_error2.phpt b/ext/gd/tests/imagesetthickness_error2.phpt
new file mode 100644
index 000000000..4c8924e46
--- /dev/null
+++ b/ext/gd/tests/imagesetthickness_error2.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong types for second parameter
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(200, 100);
+
+imagesetthickness($image, 's');
+imagesetthickness($image, array());
+imagesetthickness($image, $image);
+
+?>
+--EXPECTF--
+Warning: imagesetthickness() expects parameter 2 to be long, string given in %s on line %d
+
+Warning: imagesetthickness() expects parameter 2 to be long, array given in %s on line %d
+
+Warning: imagesetthickness() expects parameter 2 to be long, resource given in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagestring_basic.phpt b/ext/gd/tests/imagestring_basic.phpt
new file mode 100644
index 000000000..adc68a67f
--- /dev/null
+++ b/ext/gd/tests/imagestring_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Testing imagestring() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$white = imagecolorallocate($image, 255,255,255);
+
+$result = imagestring($image, 1, 5, 5, 'String Text', $white);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+d0d2fe757400cb7846b36a8c34b41e4a
diff --git a/ext/gd/tests/imagestring_error1.phpt b/ext/gd/tests/imagestring_error1.phpt
new file mode 100644
index 000000000..b31f74ebf
--- /dev/null
+++ b/ext/gd/tests/imagestring_error1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-resource parameter 1 of imagestring() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$result = imagestring('string', 1, 5, 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestring_error2.phpt b/ext/gd/tests/imagestring_error2.phpt
new file mode 100644
index 000000000..d6146f708
--- /dev/null
+++ b/ext/gd/tests/imagestring_error2.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-image resource parameter 1 of imagestring() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$result = imagestring(tmpfile(), 1, 5, 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestring(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagestring_error3.phpt b/ext/gd/tests/imagestring_error3.phpt
new file mode 100644
index 000000000..d9a9e47d2
--- /dev/null
+++ b/ext/gd/tests/imagestring_error3.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 2 of imagestring() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagestring($image, 'string', 5, 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestring_error4.phpt b/ext/gd/tests/imagestring_error4.phpt
new file mode 100644
index 000000000..40330b17b
--- /dev/null
+++ b/ext/gd/tests/imagestring_error4.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 3 of imagestring() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagestring($image, 1, 'string', 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestring_error5.phpt b/ext/gd/tests/imagestring_error5.phpt
new file mode 100644
index 000000000..6f45c55a6
--- /dev/null
+++ b/ext/gd/tests/imagestring_error5.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 4 of imagestring() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagestring($image, 1, 5, 'string', 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestring_error6.phpt b/ext/gd/tests/imagestring_error6.phpt
new file mode 100644
index 000000000..29bc79d4f
--- /dev/null
+++ b/ext/gd/tests/imagestring_error6.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-string parameter 5 of imagestring() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagestring($image, 1, 5, 5, $image, 1);
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 5 to be string%S, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestring_error7.phpt b/ext/gd/tests/imagestring_error7.phpt
new file mode 100644
index 000000000..75ab2f6af
--- /dev/null
+++ b/ext/gd/tests/imagestring_error7.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 6 of imagestring() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagestring($image, 1, 5, 5, 'String', 'font');
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 6 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestringup_basic.phpt b/ext/gd/tests/imagestringup_basic.phpt
new file mode 100644
index 000000000..0c748b6aa
--- /dev/null
+++ b/ext/gd/tests/imagestringup_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Testing imagestringup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$white = imagecolorallocate($image, 255,255,255);
+
+$result = imagestringup($image, 1, 5, 25, 'Str', $white);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+7c28016adcf620b772af2a8655b87bd2
diff --git a/ext/gd/tests/imagestringup_error1.phpt b/ext/gd/tests/imagestringup_error1.phpt
new file mode 100644
index 000000000..14477273b
--- /dev/null
+++ b/ext/gd/tests/imagestringup_error1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-resource parameter 1 of imagestringup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$result = imagestringup('string', 1, 5, 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestringup() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error2.phpt b/ext/gd/tests/imagestringup_error2.phpt
new file mode 100644
index 000000000..d1d5aa26a
--- /dev/null
+++ b/ext/gd/tests/imagestringup_error2.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-image resource parameter 1 of imagestringup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$result = imagestringup(tmpfile(), 1, 5, 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestringup(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error3.phpt b/ext/gd/tests/imagestringup_error3.phpt
new file mode 100644
index 000000000..27e9007d3
--- /dev/null
+++ b/ext/gd/tests/imagestringup_error3.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 2 of imagestringup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagestringup($image, 'string', 5, 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestringup() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error4.phpt b/ext/gd/tests/imagestringup_error4.phpt
new file mode 100644
index 000000000..af2b8c05f
--- /dev/null
+++ b/ext/gd/tests/imagestringup_error4.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 3 of imagestringup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagestringup($image, 1, 'string', 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestringup() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error5.phpt b/ext/gd/tests/imagestringup_error5.phpt
new file mode 100644
index 000000000..6f45c55a6
--- /dev/null
+++ b/ext/gd/tests/imagestringup_error5.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 4 of imagestring() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagestring($image, 1, 5, 'string', 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error6.phpt b/ext/gd/tests/imagestringup_error6.phpt
new file mode 100644
index 000000000..ac6fe4a88
--- /dev/null
+++ b/ext/gd/tests/imagestringup_error6.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-string parameter 5 of imagestringup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagestringup($image, 1, 5, 5, $image, 1);
+
+?>
+--EXPECTF--
+Warning: imagestringup() expects parameter 5 to be string%S, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error7.phpt b/ext/gd/tests/imagestringup_error7.phpt
new file mode 100644
index 000000000..396f2ddd6
--- /dev/null
+++ b/ext/gd/tests/imagestringup_error7.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 6 of imagestringup() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$result = imagestringup($image, 1, 5, 5, 'String', 'font');
+
+?>
+--EXPECTF--
+Warning: imagestringup() expects parameter 6 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagetruecolortopalette_basic.phpt b/ext/gd/tests/imagetruecolortopalette_basic.phpt
new file mode 100644
index 000000000..b0a0394b5
--- /dev/null
+++ b/ext/gd/tests/imagetruecolortopalette_basic.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Testing imagetruecolortopalette() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(150, 150);
+
+$a = imagecolorallocate($image,255,0,255);
+$b = imagecolorallocate($image,0,255,255);
+
+$half = imagefilledarc ( $image, 75, 75, 70, 70, 0, 180, $a, IMG_ARC_PIE );
+$half2 = imagefilledarc ( $image, 75, 55, 80, 70, 0, -180, $b, IMG_ARC_PIE );
+
+var_dump(imagetruecolortopalette($image, true, 2));
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+bool(true)
+0843f63ab2f9fddedd69b0b421686bc5 \ No newline at end of file
diff --git a/ext/gd/tests/imagetruecolortopalette_error1.phpt b/ext/gd/tests/imagetruecolortopalette_error1.phpt
new file mode 100644
index 000000000..ecafa158b
--- /dev/null
+++ b/ext/gd/tests/imagetruecolortopalette_error1.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong parameters for parameter 1
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$resource = tmpfile();
+
+imagetruecolortopalette($resource, true, 2);
+imagetruecolortopalette('string', true, 2);
+imagetruecolortopalette(array(), true, 2);
+imagetruecolortopalette(null, true, 2);
+?>
+--EXPECTF--
+Warning: imagetruecolortopalette(): supplied resource is not a valid Image resource in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 1 to be resource, %s given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 1 to be resource, array given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 1 to be resource, null given in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagetruecolortopalette_error2.phpt b/ext/gd/tests/imagetruecolortopalette_error2.phpt
new file mode 100644
index 000000000..cb7004caa
--- /dev/null
+++ b/ext/gd/tests/imagetruecolortopalette_error2.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong parameters for parameter 2
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(50, 50);
+$resource = tmpfile();
+
+imagetruecolortopalette($image, $resource, 2);
+imagetruecolortopalette($image, array(), 2);
+
+?>
+--EXPECTF--
+Warning: imagetruecolortopalette() expects parameter 2 to be boolean, resource given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 2 to be boolean, array given in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagetruecolortopalette_error3.phpt b/ext/gd/tests/imagetruecolortopalette_error3.phpt
new file mode 100644
index 000000000..d65a99501
--- /dev/null
+++ b/ext/gd/tests/imagetruecolortopalette_error3.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong parameters for parameter 3
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(50, 50);
+$resource = tmpfile();
+
+imagetruecolortopalette($image, true, 'string');
+imagetruecolortopalette($image, true, $resource);
+imagetruecolortopalette($image, true, array());
+imagetruecolortopalette($image, true, null);
+
+?>
+--EXPECTF--
+Warning: imagetruecolortopalette() expects parameter 3 to be long, string given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 3 to be long, resource given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 3 to be long, array given in %s on line %d
+
+Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagetruecolortopalette_error4.phpt b/ext/gd/tests/imagetruecolortopalette_error4.phpt
new file mode 100644
index 000000000..b9661e3b8
--- /dev/null
+++ b/ext/gd/tests/imagetruecolortopalette_error4.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing imagetruecolortopalette(): out of range parameter 3
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(50, 50);
+
+imagetruecolortopalette($image, true, 0);
+imagetruecolortopalette($image, true, -1);
+
+?>
+--EXPECTF--
+Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d
+
+Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/jpeg2wbmp_error1.phpt b/ext/gd/tests/jpeg2wbmp_error1.phpt
new file mode 100755
index 000000000..d0496cc82
--- /dev/null
+++ b/ext/gd/tests/jpeg2wbmp_error1.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test jpeg2wbmp() function : wrong threshold value param
+--CREDITS--
+Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if(!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+if(!function_exists('jpeg2wbmp')) {
+ die('skip jpeg2wbmp function is not available');
+}
+?>
+--FILE--
+<?php
+// Create a blank image and add some text
+$im = imagecreatetruecolor(120, 20);
+$text_color = imagecolorallocate($im, 255, 255, 255);
+imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
+
+$file = dirname(__FILE__) .'/simpletext.jpg';
+$file2 = dirname(__FILE__) .'/simpletext.wbmp';
+
+// Save the image as 'simpletext.jpg'
+imagejpeg($im, $file);
+
+// Free up memory
+imagedestroy($im);
+
+jpeg2wbmp($file, $file2, 20, 120, 9);
+jpeg2wbmp($file, $file2, 20, 120, -1);
+?>
+--EXPECTF--
+Warning: jpeg2wbmp(): Invalid threshold value '9' in %s on line %d
+
+Warning: jpeg2wbmp(): Invalid threshold value '-1' in %s on line %d
+--CLEAN--
+<?php
+unlink(dirname(__FILE__) .'/simpletext.jpg');
+unlink(dirname(__FILE__) .'/simpletext.wbmp');
+?>
diff --git a/ext/gd/tests/jpeg2wbmp_error2.phpt b/ext/gd/tests/jpeg2wbmp_error2.phpt
new file mode 100755
index 000000000..692dcb842
--- /dev/null
+++ b/ext/gd/tests/jpeg2wbmp_error2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test jpeg2wbmp() function : wrong origin filename param
+--CREDITS--
+Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if(!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+if(!function_exists('jpeg2wbmp')) {
+ die('skip jpeg2wbmp function is not available');
+}
+?>
+--FILE--
+<?php
+$file = dirname(__FILE__) .'/simpletext.wbmp';
+jpeg2wbmp('', $file, 20, 120, 8);
+jpeg2wbmp(null, $file, 20, 120, 8);
+jpeg2wbmp(false, $file, 20, 120, 8);
+?>
+--EXPECTF--
+Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
+
+Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
+
+Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
+--CLEAN--
+<?php
+unlink(dirname(__FILE__) .'/simpletext.wbmp');
+?>
diff --git a/ext/gd/tests/jpeg2wbmp_error3.phpt b/ext/gd/tests/jpeg2wbmp_error3.phpt
new file mode 100755
index 000000000..df436c8cc
--- /dev/null
+++ b/ext/gd/tests/jpeg2wbmp_error3.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test jpeg2wbmp() function : wrong destination filename param
+--CREDITS--
+Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if(!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+if(!function_exists('jpeg2wbmp')) {
+ die('skip jpeg2wbmp function is not available');
+}
+?>
+--FILE--
+<?php
+// Create a blank image and add some text
+$im = imagecreatetruecolor(120, 20);
+$text_color = imagecolorallocate($im, 255, 255, 255);
+imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
+
+$file = dirname(__FILE__) .'/simpletext.jpg';
+
+// Save the image as 'simpletext.jpg'
+imagejpeg($im, $file);
+
+// Free up memory
+imagedestroy($im);
+
+jpeg2wbmp($file, '', 20, 120, 8);
+jpeg2wbmp($file, null, 20, 120, 8);
+jpeg2wbmp($file, false, 20, 120, 8);
+?>
+--EXPECTF--
+Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d
+
+Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d
+
+Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d
+--CLEAN--
+<?php
+unlink(dirname(__FILE__) .'/simpletext.jpg');
+?>
diff --git a/ext/gd/tests/png2wbmp_error1.phpt b/ext/gd/tests/png2wbmp_error1.phpt
new file mode 100755
index 000000000..1e9d717d9
--- /dev/null
+++ b/ext/gd/tests/png2wbmp_error1.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test png2wbmp() function : wrong threshold value param
+--CREDITS--
+Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if(!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+if(!function_exists('png2wbmp')) {
+ die('skip png2wbmp function is not available');
+}
+?>
+--FILE--
+<?php
+// Create a blank image and add some text
+$im = imagecreatetruecolor(120, 20);
+$text_color = imagecolorallocate($im, 255, 255, 255);
+imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
+
+$file = dirname(__FILE__) .'/simpletext.png';
+$file2 = dirname(__FILE__) .'/simpletext.wbmp';
+
+// Save the image as 'simpletext.png'
+imagepng($im, $file);
+
+// Free up memory
+imagedestroy($im);
+
+png2wbmp($file, $file2, 20, 120, 9);
+png2wbmp($file, $file2, 20, 120, -1);
+?>
+--EXPECTF--
+Warning: png2wbmp(): Invalid threshold value '9' in %s on line %d
+
+Warning: png2wbmp(): Invalid threshold value '-1' in %s on line %d
+--CLEAN--
+<?php
+unlink(dirname(__FILE__) .'/simpletext.png');
+unlink(dirname(__FILE__) .'/simpletext.wbmp');
+?>
diff --git a/ext/gd/tests/png2wbmp_error2.phpt b/ext/gd/tests/png2wbmp_error2.phpt
new file mode 100755
index 000000000..ba8e43e7f
--- /dev/null
+++ b/ext/gd/tests/png2wbmp_error2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test png2wbmp() function : wrong origin filename param
+--CREDITS--
+Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if(!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+if(!function_exists('png2wbmp')) {
+ die('skip png2wbmp function is not available');
+}
+?>
+--FILE--
+<?php
+$file = dirname(__FILE__) .'/simpletext.wbmp';
+png2wbmp('', $file, 20, 120, 8);
+png2wbmp(null, $file, 20, 120, 8);
+png2wbmp(false, $file, 20, 120, 8);
+?>
+--EXPECTF--
+Warning: png2wbmp(): Unable to open '' for reading in %s on line %d
+
+Warning: png2wbmp(): Unable to open '' for reading in %s on line %d
+
+Warning: png2wbmp(): Unable to open '' for reading in %s on line %d
+--CLEAN--
+<?php
+unlink(dirname(__FILE__) .'/simpletext.wbmp');
+?>
diff --git a/ext/gd/tests/png2wbmp_error3.phpt b/ext/gd/tests/png2wbmp_error3.phpt
new file mode 100755
index 000000000..1e33f59b1
--- /dev/null
+++ b/ext/gd/tests/png2wbmp_error3.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test png2wbmp() function : wrong destination filename param
+--CREDITS--
+Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if(!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+if(!function_exists('png2wbmp')) {
+ die('skip png2wbmp function is not available');
+}
+?>
+--FILE--
+<?php
+// Create a blank image and add some text
+$im = imagecreatetruecolor(120, 20);
+$text_color = imagecolorallocate($im, 255, 255, 255);
+imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
+
+$file = dirname(__FILE__) .'/simpletext.png';
+
+// Save the image as 'simpletext.png'
+imagepng($im, $file);
+
+// Free up memory
+imagedestroy($im);
+
+png2wbmp($file, '', 20, 120, 8);
+png2wbmp($file, null, 20, 120, 8);
+png2wbmp($file, false, 20, 120, 8);
+?>
+--EXPECTF--
+Warning: png2wbmp(): Unable to open '' for writing in %s on line %d
+
+Warning: png2wbmp(): Unable to open '' for writing in %s on line %d
+
+Warning: png2wbmp(): Unable to open '' for writing in %s on line %d
+--CLEAN--
+<?php
+unlink(dirname(__FILE__) .'/simpletext.png');
+?>
diff --git a/ext/gd/tests/test8859.ttf b/ext/gd/tests/test8859.ttf
index ccdc23a59..dff237cd2 100644
--- a/ext/gd/tests/test8859.ttf
+++ b/ext/gd/tests/test8859.ttf
Binary files differ
diff --git a/ext/gd/tests/truecolor.phpt b/ext/gd/tests/truecolor.phpt
deleted file mode 100644
index 9e30cbe29..000000000
--- a/ext/gd/tests/truecolor.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-imageistruecolor, truecolortopalette
---SKIPIF--
-<?php
- if (!function_exists('imagetruecolortopalette')) die("skip gd extension not available\n");
-?>
---FILE--
-<?php
-$im = imagecreatetruecolor(1,1);
-if (imageistruecolor($im)) echo "ok\n";
-
-if (imagetruecolortopalette($im, 1,2)) echo "ok\n";
-if (!imageistruecolor($im)) echo "ok\n";
-
-?>
---EXPECTF--
-ok
-ok
-ok