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

1.1       misho       1: --TEST--
                      2: Test imagecolorstotal() function : basic functionality 
                      3: --CREDITS--
                      4: Felix De Vliegher <felix.devliegher@gmail.com>
                      5: --SKIPIF--
                      6: <?php
                      7:        if (!extension_loaded('gd')) {
                      8:                die("skip gd extension not available.");
                      9:        }
                     10:        if (!function_exists("imagecolorstotal")) {
                     11:                die("skip imagecolorstotal() not available.");
                     12:        }
                     13: ?>
                     14: --FILE--
                     15: <?php
                     16: /* Prototype  : int imagecolorstotal(resource im)
                     17:  * Description: Find out the number of colors in an image's palette 
                     18:  * Source code: ext/gd/gd.c
                     19:  * Alias to functions: 
                     20:  */
                     21: 
                     22: echo "*** Testing imagecolorstotal() : basic functionality ***\n";
                     23: 
                     24: // Palette image
                     25: $img = imagecreate( 50, 50 );
                     26: var_dump( imagecolorstotal( $img ) );
                     27: $bg = imagecolorallocate( $img, 255, 255, 255 );
                     28: var_dump( imagecolorstotal( $img ));
                     29: $bg = imagecolorallocate( $img, 255, 0, 0 );
                     30: $bg = imagecolorallocate( $img, 0, 0, 255 );
                     31: var_dump( imagecolorstotal( $img ));
                     32: imagedestroy( $img );
                     33: 
                     34: // Truecolor image
                     35: $img = imagecreatetruecolor( 50, 50 );
                     36: var_dump( imagecolorstotal( $img ) );
                     37: $bg = imagecolorallocate( $img, 255, 255, 255 );
                     38: var_dump( imagecolorstotal( $img ) );
                     39: imagedestroy( $img );
                     40: 
                     41: ?>
                     42: ===DONE===
                     43: --EXPECTF--
                     44: *** Testing imagecolorstotal() : basic functionality ***
                     45: int(0)
                     46: int(1)
                     47: int(3)
                     48: int(0)
                     49: int(0)
                     50: ===DONE===

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