xref: /PHP-7.3/ext/gd/tests/imageflip.phpt (revision b746e698)
1--TEST--
2Testing imageflip() of GD library
3--SKIPIF--
4<?php
5if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' );
6?>
7--FILE--
8<?php
9
10$im = imagecreatetruecolor( 99, 99 );
11
12imagesetpixel($im, 0, 0, 0xFF);
13imagesetpixel($im, 0, 98, 0x00FF00);
14imagesetpixel($im, 98, 0, 0xFF0000);
15imagesetpixel($im, 98, 98, 0x0000FF);
16
17imageflip($im, IMG_FLIP_HORIZONTAL);
18imageflip($im, IMG_FLIP_VERTICAL);
19imageflip($im, IMG_FLIP_BOTH);
20
21var_dump(dechex(imagecolorat($im, 0, 0)));
22var_dump(dechex(imagecolorat($im, 0, 98)));
23var_dump(dechex(imagecolorat($im, 98, 0)));
24var_dump(dechex(imagecolorat($im, 98, 98)));
25?>
26--EXPECT--
27string(2) "ff"
28string(4) "ff00"
29string(6) "ff0000"
30string(2) "ff"
31