libgd00186.phpt 864 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. libgd #186 (Tiling true colour with palette image does not work)
  3. --EXTENSIONS--
  4. gd
  5. --FILE--
  6. <?php
  7. $im = imagecreatetruecolor(10,10);
  8. $tile = imagecreate(10,10);
  9. $red = imagecolorallocate($tile,0xff,0,0);
  10. $green = imagecolorallocate($tile,0,0xff,0);
  11. $blue = imagecolorallocate($tile,0,0,0xff);
  12. $other = imagecolorallocate($tile,0,0,0x2);
  13. imagefilledrectangle($tile,0,0,2,10,$red);
  14. imagefilledrectangle($tile,3,0,4,10,$green);
  15. imagefilledrectangle($tile,5,0,7,10,$blue);
  16. imagefilledrectangle($tile,8,0,9,10,$other);
  17. imagecolortransparent($tile,$blue);
  18. imagesettile($im,$tile);
  19. for ($i=0; $i<10; $i++) {
  20. imagesetpixel($im,$i,$i,IMG_COLOR_TILED);
  21. }
  22. $index = imagecolorat($im,9,9);
  23. $arr = imagecolorsforindex($im, $index);
  24. if ($arr['blue'] == 2) {
  25. $r = "Ok";
  26. } else {
  27. $r = "Failed";
  28. }
  29. imagedestroy($tile);
  30. imagedestroy($im);
  31. echo $r;
  32. ?>
  33. --EXPECT--
  34. Ok