imagesetbrush_basic.phpt 805 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Test imagesetbrush() function : basic functionality
  3. --CREDITS--
  4. Erick Belluci Tedeschi <erickbt86 [at] gmail [dot] com>
  5. #testfest PHPSP on 2009-06-20
  6. --SKIPIF--
  7. <?php
  8. if (!extension_loaded('gd')) {
  9. die('skip gd extension is not loaded');
  10. }
  11. ?>
  12. --FILE--
  13. <?php
  14. // Create the brush image
  15. $img = imagecreate(10, 10);
  16. // Create the main image, 100x100
  17. $mainimg = imagecreatetruecolor(100, 100);
  18. $white = imagecolorallocate($img, 255, 0, 0);
  19. imagefilledrectangle($img, 0, 0, 299, 99, $white);
  20. // Set the brush
  21. imagesetbrush($mainimg, $img);
  22. // Draw a couple of brushes, each overlaying each
  23. imageline($mainimg, 50, 50, 50, 60, IMG_COLOR_BRUSHED);
  24. include_once __DIR__ . '/func.inc';
  25. test_image_equals_file(__DIR__ . '/imagesetbrush_basic.png', $mainimg);
  26. ?>
  27. --EXPECT--
  28. The images are equal.