xref: /php-src/ext/gd/tests/bug64641.phpt (revision 0b8466f2)
1--TEST--
2Bug #64641 (imagefilledpolygon doesn't draw horizontal line)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.2', '<')) {
8    die("skip test requires GD 2.2.2 or higher");
9}
10if (!(imagetypes() & IMG_PNG)) {
11    die("skip No PNG support");
12}
13?>
14--FILE--
15<?php
16require_once __DIR__ . '/similarity.inc';
17
18$im = imagecreatetruecolor(640, 480);
19
20$points = array(
21    100, 100,
22    100, 200,
23    100, 300
24);
25imagefilledpolygon($im, $points, 0xFFFF00);
26
27$points = array(
28    300, 200,
29    400, 200,
30    500, 200
31);
32imagefilledpolygon($im, $points, 0xFFFF00);
33
34$ex = imagecreatefrompng(__DIR__ . '/bug64641.png');
35if (($diss = calc_image_dissimilarity($ex, $im)) < 1e-5) {
36    echo "IDENTICAL";
37} else {
38    echo "DISSIMILARITY: $diss";
39}
40imagedestroy($ex);
41
42imagedestroy($im);
43?>
44--EXPECT--
45IDENTICAL
46