php-src/ext/gd/tests/bug67325.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

32 lines
736 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);
imagedestroy($im);
?>
--EXPECT--
int(0)