xref: /PHP-8.2/ext/gd/tests/bug64641.phpt (revision a375d547)
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}
10?>
11--FILE--
12<?php
13require_once __DIR__ . '/similarity.inc';
14
15$im = imagecreatetruecolor(640, 480);
16
17$points = array(
18    100, 100,
19    100, 200,
20    100, 300
21);
22imagefilledpolygon($im, $points, 0xFFFF00);
23
24$points = array(
25    300, 200,
26    400, 200,
27    500, 200
28);
29imagefilledpolygon($im, $points, 0xFFFF00);
30
31$ex = imagecreatefrompng(__DIR__ . '/bug64641.png');
32if (($diss = calc_image_dissimilarity($ex, $im)) < 1e-5) {
33    echo "IDENTICAL";
34} else {
35    echo "DISSIMILARITY: $diss";
36}
37imagedestroy($ex);
38
39imagedestroy($im);
40?>
41--EXPECT--
42IDENTICAL
43