xref: /php-src/ext/gd/tests/bug70102.phpt (revision a375d547)
1--TEST--
2Bug #70102 (imagecreatefromwebm() shifts colors)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
8    die("skip test requires GD 2.2.0 or higher");
9}
10if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
11    die('skip WebP support not available');
12?>
13--FILE--
14<?php
15$filename = __DIR__ .  '/bug70102.webp';
16
17$im = imagecreatetruecolor(8, 8);
18$white = imagecolorallocate($im, 255, 255, 255);
19var_dump($white & 0xffffff);
20imagefilledrectangle($im, 0, 0, 7, 7, $white);
21imagewebp($im, $filename);
22imagedestroy($im);
23
24$im = imagecreatefromwebp($filename);
25$color = imagecolorat($im, 4, 4);
26var_dump($color & 0xffffff);
27?>
28--CLEAN--
29<?php
30unlink(__DIR__ . '/bug70102.webp');
31?>
32--EXPECT--
33int(16777215)
34int(16777215)
35