1--TEST--
2Test imagecolorstotal() function : basic functionality
3--CREDITS--
4Felix 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
22echo "*** Testing imagecolorstotal() : basic functionality ***\n";
23
24// Palette image
25$img = imagecreate( 50, 50 );
26var_dump( imagecolorstotal( $img ) );
27$bg = imagecolorallocate( $img, 255, 255, 255 );
28var_dump( imagecolorstotal( $img ));
29$bg = imagecolorallocate( $img, 255, 0, 0 );
30$bg = imagecolorallocate( $img, 0, 0, 255 );
31var_dump( imagecolorstotal( $img ));
32imagedestroy( $img );
33
34// Truecolor image
35$img = imagecreatetruecolor( 50, 50 );
36var_dump( imagecolorstotal( $img ) );
37$bg = imagecolorallocate( $img, 255, 255, 255 );
38var_dump( imagecolorstotal( $img ) );
39imagedestroy( $img );
40
41?>
42===DONE===
43--EXPECT--
44*** Testing imagecolorstotal() : basic functionality ***
45int(0)
46int(1)
47int(3)
48int(0)
49int(0)
50===DONE===
51