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/bug67325.phpt

30 lines
716 B
PHP

--TEST--
Bug #67325 (imagetruecolortopalette: white is duplicated in palette)
--EXTENSIONS--
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.3', '<=')) {
die("skip test requires newer than GD 2.2.3");
}
if (!(imagetypes() & IMG_JPG)) die('skip JPEG support not available');
?>
--FILE--
<?php
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'bug67325.jpg';
$im = imagecreatefromjpeg($filename);
imagetruecolortopalette($im, 0, 256);
$white = 0;
for ($i = 0; $i < 256; $i++) {
$components = imagecolorsforindex($im, $i);
if ($components['red'] === 255 && $components['green'] === 255 && $components['blue'] === 255) {
$white++;
}
}
var_dump($white);
?>
--EXPECT--
int(0)