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 16echo "*** Testing imagecolorstotal() : basic functionality ***\n"; 17 18// Palette image 19$img = imagecreate( 50, 50 ); 20var_dump( imagecolorstotal( $img ) ); 21$bg = imagecolorallocate( $img, 255, 255, 255 ); 22var_dump( imagecolorstotal( $img )); 23$bg = imagecolorallocate( $img, 255, 0, 0 ); 24$bg = imagecolorallocate( $img, 0, 0, 255 ); 25var_dump( imagecolorstotal( $img )); 26imagedestroy( $img ); 27 28// Truecolor image 29$img = imagecreatetruecolor( 50, 50 ); 30var_dump( imagecolorstotal( $img ) ); 31$bg = imagecolorallocate( $img, 255, 255, 255 ); 32var_dump( imagecolorstotal( $img ) ); 33imagedestroy( $img ); 34 35?> 36--EXPECT-- 37*** Testing imagecolorstotal() : basic functionality *** 38int(0) 39int(1) 40int(3) 41int(0) 42int(0) 43