imagecolourstotal_basic.phpt 986 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. Test imagecolorstotal() function : basic functionality
  3. --CREDITS--
  4. Felix De Vliegher <felix.devliegher@gmail.com>
  5. --EXTENSIONS--
  6. gd
  7. --SKIPIF--
  8. <?php
  9. if (!function_exists("imagecolorstotal")) {
  10. die("skip imagecolorstotal() not available.");
  11. }
  12. ?>
  13. --FILE--
  14. <?php
  15. echo "*** Testing imagecolorstotal() : basic functionality ***\n";
  16. // Palette image
  17. $img = imagecreate( 50, 50 );
  18. var_dump( imagecolorstotal( $img ) );
  19. $bg = imagecolorallocate( $img, 255, 255, 255 );
  20. var_dump( imagecolorstotal( $img ));
  21. $bg = imagecolorallocate( $img, 255, 0, 0 );
  22. $bg = imagecolorallocate( $img, 0, 0, 255 );
  23. var_dump( imagecolorstotal( $img ));
  24. imagedestroy( $img );
  25. // Truecolor image
  26. $img = imagecreatetruecolor( 50, 50 );
  27. var_dump( imagecolorstotal( $img ) );
  28. $bg = imagecolorallocate( $img, 255, 255, 255 );
  29. var_dump( imagecolorstotal( $img ) );
  30. imagedestroy( $img );
  31. ?>
  32. --EXPECT--
  33. *** Testing imagecolorstotal() : basic functionality ***
  34. int(0)
  35. int(1)
  36. int(3)
  37. int(0)
  38. int(0)