xref: /PHP-8.1/ext/gd/tests/bug51263.phpt (revision a375d547)
1--TEST--
2Bug #51263 (imagettftext and rotated text uses wrong baseline)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7    if(!function_exists('imagettftext')) die('skip imagettftext() not available');
8?>
9--FILE--
10<?php
11$cwd = __DIR__;
12$ttf = "$cwd/Tuffy.ttf";
13$w = 23;
14$h = 70;
15$img = imagecreatetruecolor($w, $h);
16$blk = imagecolorallocate($img, 0, 0, 0);
17imagefilledrectangle($img, 0, 0, $w-1, $h-1, $blk);
18$col = imagecolorallocate($img, 255, 255, 255);
19imagettftext($img, 8, 90, 10, 60, $col, $ttf, "foo bar qux");
20$x = array(0, 1, 2, 3, 13);
21for ($j=0; $j<30; $j++) {
22    foreach ($x as $i) {
23        $c = imagecolorat($img, $i, $j);
24        if ($c != 0) {
25            echo "KO: ($i, $j)\n";
26            exit;
27        }
28    }
29}
30echo "OK\n";
31?>
32--EXPECT--
33OK
34