xref: /php-src/ext/gd/tests/bug68629.phpt (revision 0f40e62c)
1--TEST--
2Bug #68629 (Transparent artifacts when using imagerotate)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7if (!GD_BUNDLED && version_compare(GD_VERSION, "2.2.2") < 0) die("skip only fixed as of libgd 2.2.2");
8?>
9--FILE--
10<?php
11$im1 = imagecreatetruecolor(200, 200);
12$trans = imagecolorallocatealpha($im1, 0, 0, 0, 127);
13imagefill($im1, 0, 0, $trans);
14$im2 = imagerotate($im1, 45, $trans);
15$count = 0;
16$width = imagesx($im2);
17$height = imagesy($im2);
18for ($y = 0; $y < $height; $y++) {
19    for ($x = 0; $x < $width; $x++) {
20        $rgb = imagecolorat($im2, $x, $y);
21        if ($rgb !== 0x7f000000) {
22            $count++;
23        }
24    }
25}
26var_dump($count);
27?>
28--EXPECT--
29int(0)
30