Annotation of embedaddon/php/ext/gd/tests/imagecolorallocate_variation6.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test imagecolorallocate() function : usage variations - passing RED, GREEN, BLUE values more than 255
3: --SKIPIF--
4: <?php
5: if(!extension_loaded('gd')) {
6: die('skip gd extension is not loaded');
7: }
8: if(!function_exists('imagecreatetruecolor')) {
9: die('skip imagecreatetruecolor function is not available');
10: }
11: ?>
12: --FILE--
13: <?php
14: /* Prototype : int imagecolorallocate(resource im, int red, int green, int blue)
15: * Description: Allocate a color for an image
16: * Source code: ext/gd/gd.c
17: */
18: echo "*** Testing imagecolorallocate() : usage variations ***\n";
19:
20: $values = array(
21: //Decimal integera data
22: "Decimal 256" => 256,
23:
24: // octal integer data
25: "Octal 0400" => 0400,
26:
27: // hexa-decimal integer data
28: "Hexa-decimal 0x100" => 0x100
29: );
30:
31: // loop through each element of the array for blue
32: foreach($values as $key => $value) {
33: echo "\n--$key--\n";
34: //Need to be created every time to get expected return value
35: $im_palette = imagecreate(200, 200);
36: $im_true_color = imagecreatetruecolor(200, 200);
37: var_dump( imagecolorallocate($im_palette, $value, $value, $value) );
38: var_dump( imagecolorallocate($im_true_color, $value, $value, $value) );
39: };
40: ?>
41: ===DONE===
42: --EXPECTF--
43: *** Testing imagecolorallocate() : usage variations ***
44:
45: --Decimal 256--
46: int(0)
47: int(16843008)
48:
49: --Octal 0400--
50: int(0)
51: int(16843008)
52:
53: --Hexa-decimal 0x100--
54: int(0)
55: int(16843008)
56: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>