summaryrefslogtreecommitdiff
path: root/ext/gd/tests/bug70102.phpt
blob: 81b189d4f4a8d504a1be393bd100fb18d0b7b6c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--TEST--
Bug #70102 (imagecreatefromwebm() shifts colors)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
    die("skip test requires GD 2.2.0 or higher");
}
if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
    die('skip WebP support not available');
?>
--FILE--
<?php
$filename = __DIR__ .  '/bug70102.webp';

$im = imagecreatetruecolor(8, 8);
$white = imagecolorallocate($im, 255, 255, 255);
var_dump($white & 0xffffff);
imagefilledrectangle($im, 0, 0, 7, 7, $white);
imagewebp($im, $filename);
imagedestroy($im);

$im = imagecreatefromwebp($filename);
$color = imagecolorat($im, 4, 4);
var_dump($color & 0xffffff);
?>
--CLEAN--
<?php
unlink(__DIR__ . '/bug70102.webp');
?>
--EXPECT--
int(16777215)
int(16777215)