php-src/ext/gd/tests/bug49600.phpt
Christoph M. Becker a375d54785
Migrate skip checks to --EXTENSIONS-- for ext/gd
Cf. PR #6787.

Closes GH-6994.
2021-05-22 15:38:51 +02:00

34 lines
820 B
PHP

--TEST--
Bug #49600 (imageTTFText text shifted right)
--EXTENSIONS--
gd
--SKIPIF--
<?php
if(!function_exists('imagettftext')) die('skip imagettftext() not available');
if(!function_exists('imagettfbbox')) die('skip imagettfbbox() not available');
?>
--FILE--
<?php
$cwd = __DIR__;
$font = "$cwd/Tuffy.ttf";
$image = imagecreatetruecolor(50, 50);
$color = imagecolorallocate($image, 255, 255, 255);
foreach (array("E", "I", "P", "g", "i", "q") as $c)
{
$x = imagettftext($image, 32, 0, 0, 0, $color, $font, $c);
$y = imagettfbbox(32, 0, "$cwd/Tuffy.ttf", $c);
if ( abs($x[0] - $y[0]) > 1
|| abs($x[2] - $y[2]) > 1
|| abs($x[4] - $y[4]) > 1
|| abs($x[6] - $y[6]) > 1 ) {
echo "FAILED: \n";
var_dump($x);
var_dump($y);
exit;
}
}
echo 'OK';
?>
--EXPECT--
OK