zoe             Mon Jun 16 19:23:43 2008 UTC

  Modified files:              
    /php-src/ext/gd/tests       imagecolourstotal_basic.phpt 
  Log:
  Test committed for felixdv
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/imagecolourstotal_basic.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/gd/tests/imagecolourstotal_basic.phpt
diff -u /dev/null php-src/ext/gd/tests/imagecolourstotal_basic.phpt:1.2
--- /dev/null   Mon Jun 16 19:23:43 2008
+++ php-src/ext/gd/tests/imagecolourstotal_basic.phpt   Mon Jun 16 19:23:43 2008
@@ -0,0 +1,50 @@
+--TEST--
+Test imagecolorstotal() function : basic functionality 
+--CREDITS--
+Felix De Vliegher <[EMAIL PROTECTED]>
+--SKIPIF--
+<?php
+       if (!extension_loaded('gd')) {
+               die("skip gd extension not available.");
+       }
+       if (!function_exists("imagecolorstotal")) {
+               die("skip imagecolorstotal() not available.");
+       }
+?>
+--FILE--
+<?php
+/* Prototype  : int imagecolorstotal(resource im)
+ * Description: Find out the number of colors in an image's palette 
+ * Source code: ext/gd/gd.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing imagecolorstotal() : basic functionality ***\n";
+
+// Palette image
+$img = imagecreate( 50, 50 );
+var_dump( imagecolorstotal( $img ) );
+$bg = imagecolorallocate( $img, 255, 255, 255 );
+var_dump( imagecolorstotal( $img ));
+$bg = imagecolorallocate( $img, 255, 0, 0 );
+$bg = imagecolorallocate( $img, 0, 0, 255 );
+var_dump( imagecolorstotal( $img ));
+imagedestroy( $img );
+
+// Truecolor image
+$img = imagecreatetruecolor( 50, 50 );
+var_dump( imagecolorstotal( $img ) );
+$bg = imagecolorallocate( $img, 255, 255, 255 );
+var_dump( imagecolorstotal( $img ) );
+imagedestroy( $img );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing imagecolorstotal() : basic functionality ***
+int(0)
+int(1)
+int(3)
+int(0)
+int(0)
+===DONE===



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to