xref: /PHP-8.2/ext/gd/tests/gh10614.phpt (revision 09957ab9)
1--TEST--
2GH-10614 (imagerotate will turn the picture all black, when rotated 90)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.4', '>=')) die("skip test requires GD 2.3.4 or older");
8if (!(imagetypes() & IMG_PNG)) {
9    die("skip No PNG support");
10}
11?>
12--FILE--
13<?php
14
15$input = imagecreatefrompng(__DIR__ . '/gh10614.png');
16
17for ($angle = 0; $angle <= 270; $angle += 90) {
18    echo "--- Angle $angle ---\n";
19    $output = imagerotate($input, $angle, 0);
20    for ($i = 0; $i < 4; $i++) {
21        for ($j = 0; $j < 4; $j++) {
22            var_dump(dechex(imagecolorat($output, $i, $j)));
23        }
24    }
25}
26
27?>
28--EXPECT--
29--- Angle 0 ---
30string(1) "0"
31string(1) "0"
32string(1) "0"
33string(1) "0"
34string(1) "0"
35string(1) "0"
36string(1) "0"
37string(1) "0"
38string(8) "7f000000"
39string(8) "7f000000"
40string(8) "7f000000"
41string(8) "7f000000"
42string(8) "7f000000"
43string(8) "7f000000"
44string(8) "7f000000"
45string(8) "7f000000"
46--- Angle 90 ---
47string(8) "7f000000"
48string(8) "7f000000"
49string(1) "0"
50string(1) "0"
51string(8) "7f000000"
52string(8) "7f000000"
53string(1) "0"
54string(1) "0"
55string(8) "7f000000"
56string(8) "7f000000"
57string(1) "0"
58string(1) "0"
59string(8) "7f000000"
60string(8) "7f000000"
61string(1) "0"
62string(1) "0"
63--- Angle 180 ---
64string(8) "7f000000"
65string(8) "7f000000"
66string(8) "7f000000"
67string(8) "7f000000"
68string(8) "7f000000"
69string(8) "7f000000"
70string(8) "7f000000"
71string(8) "7f000000"
72string(1) "0"
73string(1) "0"
74string(1) "0"
75string(1) "0"
76string(1) "0"
77string(1) "0"
78string(1) "0"
79string(1) "0"
80--- Angle 270 ---
81string(1) "0"
82string(1) "0"
83string(8) "7f000000"
84string(8) "7f000000"
85string(1) "0"
86string(1) "0"
87string(8) "7f000000"
88string(8) "7f000000"
89string(1) "0"
90string(1) "0"
91string(8) "7f000000"
92string(8) "7f000000"
93string(1) "0"
94string(1) "0"
95string(8) "7f000000"
96string(8) "7f000000"
97