xref: /PHP-8.2/ext/gd/tests/bug77200.phpt (revision a375d547)
1--TEST--
2Bug #77200 (imagecropauto(…, GD_CROP_SIDES) crops left but not right)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7if (!GD_BUNDLED) die('skip upstream bugfix has not been released');
8?>
9--FILE--
10<?php
11
12$orig = imagecreatetruecolor(8, 8);
13$red = imagecolorallocate($orig, 255, 0, 0);
14$green = imagecolorallocate($orig, 0, 255, 0);
15$blue = imagecolorallocate($orig, 0, 0, 255);
16
17imagefilledrectangle($orig, 0, 0, 3, 3, $green); // tl
18imagefilledrectangle($orig, 4, 0, 7, 3, $red);   // tr
19imagefilledrectangle($orig, 0, 4, 3, 7, $green); // bl
20imagefilledrectangle($orig, 4, 4, 7, 7, $blue);  // br
21
22$cropped = imagecropauto($orig, IMG_CROP_SIDES);
23var_dump(imagesx($cropped));
24
25imagefilledrectangle($orig, 0, 0, 3, 3, $red);   // tl
26imagefilledrectangle($orig, 4, 0, 7, 3, $green); // tr
27imagefilledrectangle($orig, 0, 4, 3, 7, $blue);  // bl
28imagefilledrectangle($orig, 4, 4, 7, 7, $green); // br
29
30$cropped = imagecropauto($orig, IMG_CROP_SIDES);
31var_dump(imagesx($cropped));
32
33?>
34--EXPECT--
35int(4)
36int(4)
37