imagesetthickness_basic.phpt 837 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Testing imagetruecolortopalette() of GD library
  3. --CREDITS--
  4. Rafael Dohms <rdohms [at] gmail [dot] com>
  5. --SKIPIF--
  6. <?php
  7. if (!extension_loaded("gd")) die("skip GD not present");
  8. if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
  9. ?>
  10. --FILE--
  11. <?php
  12. // Create a 200x100 image
  13. $image = imagecreatetruecolor(200, 100);
  14. $white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
  15. $black = imagecolorallocate($image, 0x00, 0x00, 0x00);
  16. // Set the background to be white
  17. imagefilledrectangle($image, 0, 0, 299, 99, $white);
  18. // Set the line thickness to 5
  19. imagesetthickness($image, 5);
  20. // Draw the rectangle
  21. imagerectangle($image, 14, 14, 185, 85, $black);
  22. include_once __DIR__ . '/func.inc';
  23. test_image_equals_file(__DIR__ . '/imagesetthickness_basic.png', $image);
  24. ?>
  25. --EXPECT--
  26. The images are equal.