xref: /PHP-7.2/ext/gd/tests/bug72913.phpt (revision dc09f309)
1--TEST--
2Bug #72913 (imagecopy() loses single-color transparency on palette images)
3--SKIPIF--
4<?php
5if (!extension_loaded('gd')) die('skip gd extension not available');
6?>
7--FILE--
8<?php
9$base64 = 'iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAABnRSTlMAAAAAAABu'
10    . 'pgeRAAAAVklEQVRYw+3UQQqAMBAEwf3/p9eTBxEPiWAmWMU8oGFJqgAAuOpzWTX3'
11    . 'xQUti+uRJTZ9V5aY1bOTFZLV7yZr9zt6ibv/qPXfrMpsGipbIy7oqQ8AYJED1plD'
12    . 'y5PCu2sAAAAASUVORK5CYII=';
13$src = imagecreatefromstring(base64_decode($base64));
14
15$dst = imagecreate(50, 50);
16$transparent = imagecolorallocatealpha($dst, 255, 255, 255, 127);
17imagealphablending($dst, false);
18imagesavealpha($dst, true);
19
20imagecopy($dst, $src, 0,0, 0,0, 50,50);
21
22include_once __DIR__ . '/func.inc';
23test_image_equals_file(__DIR__ . '/bug72913.png', $dst);
24?>
25==DONE==
26--EXPECT--
27The images are equal.
28==DONE==
29