1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/gd/tests/gh17373.phpt
Michael Orlitzky 174a7fe6f9 Fix GH-17891 gh17373.phpt test issue without freetype support
skip if imagefttext() is not available

This test calls imagefttext(), which may not be available if libgd
was built without freetype support.

Closes GH-17910
2025-02-24 07:13:11 +00:00

31 lines
711 B
PHP

--TEST--
Bug GH-17373 (imagefttext() ignores clipping rect for palette images)
--EXTENSIONS--
gd
--SKIPIF--
<?php
if(!function_exists('imagefttext')) die('skip imagefttext() not available');
?>
--FILE--
<?php
$im = imagecreate(64, 32);
$bg = imagecolorallocate($im, 0, 0, 0);
$fg = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, 63, 31, $bg);
imagesetclip($im, 32, 0, 63, 31);
imagefttext($im, 16, 0, 10, 23, $fg, __DIR__ . "/Tuffy.ttf", "hello");
imagesetclip($im, 0, 0, 63, 31);
$count = 0;
for ($j = 0; $j < 31; $j++) {
for ($i = 0; $i < 31; $i++) {
if (imagecolorat($im, $i, $j) !== $bg) {
$count++;
}
}
}
var_dump($count);
?>
--EXPECT--
int(0)