Annotation of embedaddon/php/ext/gd/tests/imagecolorallocate_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test imagecolorallocate() function : error conditions 
                      3: --SKIPIF--
                      4: <?php
                      5: if(!extension_loaded('gd')) {
                      6:     die('skip gd extension is not loaded');
                      7: }
                      8: ?> 
                      9: --FILE--
                     10: <?php
                     11: /* Prototype  : int imagecolorallocate(resource im, int red, int green, int blue)
                     12:  * Description: Allocate a color for an image
                     13:  * Source code: ext/gd/gd.c
                     14:  */
                     15: 
                     16: $red = 10;
                     17: $green = 10;
                     18: $blue = 10;
                     19: $extra_arg = 10;
                     20: $im = imagecreate(200, 200);
                     21: 
                     22: echo "*** Testing imagecolorallocate() : error conditions ***\n";
                     23: 
                     24: //Test imagecolorallocate with one more than the expected number of arguments
                     25: echo "\n-- Testing imagecolorallocate() function with more than expected no. of arguments --\n";
                     26: var_dump( imagecolorallocate($im, $red, $green, $blue, $extra_arg) );
                     27: 
                     28: // Testing imagecolorallocate with one less than the expected number of arguments
                     29: echo "\n-- Testing imagecolorallocate() function with less than expected no. of arguments --\n";
                     30: var_dump( imagecolorallocate() );
                     31: var_dump( imagecolorallocate($im, $red, $green) );
                     32: ?>
                     33: ===DONE===
                     34: --EXPECTF--
                     35: *** Testing imagecolorallocate() : error conditions ***
                     36: 
                     37: -- Testing imagecolorallocate() function with more than expected no. of arguments --
                     38: 
                     39: Warning: imagecolorallocate() expects exactly 4 parameters, 5 given in %s on line %d
                     40: NULL
                     41: 
                     42: -- Testing imagecolorallocate() function with less than expected no. of arguments --
                     43: 
                     44: Warning: imagecolorallocate() expects exactly 4 parameters, 0 given in %s on line %d
                     45: NULL
                     46: 
                     47: Warning: imagecolorallocate() expects exactly 4 parameters, 3 given in %s on line %d
                     48: NULL
                     49: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>