summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-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
4 files changed, 85 insertions, 0 deletions
diff --git a/ext/gd/tests/imagecreatetruecolor_basic.phpt b/ext/gd/tests/imagecreatetruecolor_basic.phpt
new file mode 100644
index 0000000000..5c85f52380
--- /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 0000000000..facf2c894a
--- /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(): Invalid image dimensions in %s on line %d
+
+Warning: imagecreatetruecolor(): Invalid image dimensions 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 0000000000..e4de7e382d
--- /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 0000000000..ade12ad718
--- /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: Wrong parameter count for imagecreatetruecolor() in %s on line %d
+
+Warning: Wrong parameter count for imagecreatetruecolor() in %s on line %d
+
+Warning: Wrong parameter count for imagecreatetruecolor() in %s on line %d \ No newline at end of file