bug77200.phpt 1006 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Bug #77200 (imagecropauto(…, GD_CROP_SIDES) crops left but not right)
  3. --EXTENSIONS--
  4. gd
  5. --SKIPIF--
  6. <?php
  7. if (!GD_BUNDLED) die('skip upstream bugfix has not been released');
  8. ?>
  9. --FILE--
  10. <?php
  11. $orig = imagecreatetruecolor(8, 8);
  12. $red = imagecolorallocate($orig, 255, 0, 0);
  13. $green = imagecolorallocate($orig, 0, 255, 0);
  14. $blue = imagecolorallocate($orig, 0, 0, 255);
  15. imagefilledrectangle($orig, 0, 0, 3, 3, $green); // tl
  16. imagefilledrectangle($orig, 4, 0, 7, 3, $red); // tr
  17. imagefilledrectangle($orig, 0, 4, 3, 7, $green); // bl
  18. imagefilledrectangle($orig, 4, 4, 7, 7, $blue); // br
  19. $cropped = imagecropauto($orig, IMG_CROP_SIDES);
  20. var_dump(imagesx($cropped));
  21. imagefilledrectangle($orig, 0, 0, 3, 3, $red); // tl
  22. imagefilledrectangle($orig, 4, 0, 7, 3, $green); // tr
  23. imagefilledrectangle($orig, 0, 4, 3, 7, $blue); // bl
  24. imagefilledrectangle($orig, 4, 4, 7, 7, $green); // br
  25. $cropped = imagecropauto($orig, IMG_CROP_SIDES);
  26. var_dump(imagesx($cropped));
  27. ?>
  28. --EXPECT--
  29. int(4)
  30. int(4)