imageopenpolygon_basic.phpt 923 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. imageopenpolygon(): basic test
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('gd')) die('skip gd extension not available');
  6. ?>
  7. --FILE--
  8. <?php
  9. require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
  10. $im = imagecreatetruecolor(100, 100);
  11. $white = imagecolorallocate($im, 255, 255, 255);
  12. $black = imagecolorallocate($im, 0, 0, 0);
  13. $red = imagecolorallocate($im, 255, 0, 0);
  14. $green = imagecolorallocate($im, 0, 128, 0);
  15. $blue = imagecolorallocate($im, 0, 0, 255);
  16. imagefilledrectangle($im, 0,0, 99,99, $white);
  17. imageopenpolygon($im, [10,10, 49,89, 89,10], 3, $black);
  18. imageopenpolygon($im, [10,89, 35,10, 60,89, 85,10], 4, $red);
  19. imageopenpolygon($im, [10,49, 30,89, 50,10, 70,89, 90,10], 5, $green);
  20. imageopenpolygon($im, [10,50, 25,10, 40,89, 55,10, 80,89, 90,50], 6, $blue);
  21. test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imageopenpolygon.png', $im);
  22. ?>
  23. ===DONE===
  24. --EXPECT--
  25. The images are equal.
  26. ===DONE===