Annotation of embedaddon/php/ext/gd/tests/bug49600.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #49600 (imageTTFText text shifted right)
                      3: --SKIPIF--
                      4: <?php
                      5:        if(!extension_loaded('gd')){ die('skip gd extension not available'); }
                      6:        if(!function_exists('imagettftext')) die('skip imagettftext() not available');
                      7:        if(!function_exists('imagettfbbox')) die('skip imagettfbbox() not available');
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: $cwd = dirname(__FILE__);
                     12: $font = "$cwd/Tuffy.ttf";
                     13: $image = imagecreatetruecolor(50, 50);
                     14: $color = imagecolorallocate($image, 255, 255, 255);
                     15: foreach (array("E", "I", "P", "g", "i", "q") as $c)
                     16: {
                     17:     $x = imagettftext($image, 32, 0, 0, 0, $color, $font, $c);
                     18:        $y = imagettfbbox(32, 0, "$cwd/Tuffy.ttf", $c);
                     19:     if ( abs($x[0] - $y[0]) > 1
                     20:       || abs($x[2] - $y[2]) > 1
                     21:       || abs($x[4] - $y[4]) > 1
                     22:       || abs($x[6] - $y[6]) > 1 ) {
                     23:       echo "FAILED: \n";
                     24:       var_dump($x);
                     25:       var_dump($y);
                     26:       exit;
                     27:     }
                     28: }
                     29: echo 'OK';
                     30: ?>
                     31: --EXPECTF--
                     32: OK

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>