libgd00186.phpt 938 B

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