Merge branch 'pull-request/742' into PHP-5.5

* pull-request/742:
  Fixed typo
  GD: imagepalettetotruecolor tests
This commit is contained in:
Stanislav Malyshev 2015-01-04 19:46:33 -08:00
commit 5639c3350e
4 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,22 @@
--TEST--
does the imagepalettetotruecollor function realy converts the image palette?
--CREDITS--
Carlos André Ferrari <caferrari [at] gmail [dot] com>
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available.");
?>
--FILE--
<?php
$im = imagecreate(100, 100);
var_dump(is_resource($im));
var_dump(imageistruecolor($im));
var_dump(imagepalettetotruecolor($im));
var_dump(imageistruecolor($im));
imagedestroy($im);
?>
--EXPECT--
bool(true)
bool(false)
bool(true)
bool(true)

View File

@ -0,0 +1,14 @@
--TEST--
imagepalettetotruecollor must return an error if no resource is given
--CREDITS--
Carlos André Ferrari <caferrari [at] gmail [dot] com>
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available.");
?>
--FILE--
<?php
imagepalettetotruecolor();
?>
--EXPECTF--
Warning: imagepalettetotruecolor() expects exactly 1 parameter, 0 given in %s on line %d

View File

@ -0,0 +1,14 @@
--TEST--
imagepalettetotruecollor must return an error if not a resource is given
--CREDITS--
Carlos André Ferrari <caferrari [at] gmail [dot] com>
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available.");
?>
--FILE--
<?php
imagepalettetotruecolor("bla");
?>
--EXPECTF--
Warning: imagepalettetotruecolor() expects parameter 1 to be resource, string given in %s on line %d

View File

@ -0,0 +1,15 @@
--TEST--
imagepalettetotruecollor must return an error if not an image resource is given
--CREDITS--
Carlos André Ferrari <caferrari [at] gmail [dot] com>
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available.");
?>
--FILE--
<?php
$im = fopen('php://memory', 'w');
imagepalettetotruecolor($im);
?>
--EXPECTF--
Warning: imagepalettetotruecolor(): supplied resource is not a valid Image resource in %s on line %d