bug70102.phpt 795 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Bug #70102 (imagecreatefromwebm() shifts colors)
  3. --EXTENSIONS--
  4. gd
  5. --SKIPIF--
  6. <?php
  7. if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
  8. die("skip test requires GD 2.2.0 or higher");
  9. }
  10. if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
  11. die('skip WebP support not available');
  12. ?>
  13. --FILE--
  14. <?php
  15. $filename = __DIR__ . '/bug70102.webp';
  16. $im = imagecreatetruecolor(8, 8);
  17. $white = imagecolorallocate($im, 255, 255, 255);
  18. var_dump($white & 0xffffff);
  19. imagefilledrectangle($im, 0, 0, 7, 7, $white);
  20. imagewebp($im, $filename);
  21. imagedestroy($im);
  22. $im = imagecreatefromwebp($filename);
  23. $color = imagecolorat($im, 4, 4);
  24. var_dump($color & 0xffffff);
  25. ?>
  26. --CLEAN--
  27. <?php
  28. unlink(__DIR__ . '/bug70102.webp');
  29. ?>
  30. --EXPECT--
  31. int(16777215)
  32. int(16777215)