imagedashedline_basic.phpt [plain text]
--TEST--
imagedashedline()
--SKIPIF--
<?php
if (!function_exists('imagedashedline')) die('skip imagedashedline() not available');
if (!(imagetype() & IMG_PNG)) die('skip PNG Support is not enabled');
?>
--FILE--
<?php
echo "Simple test of imagedashedline() function\n";
$dest = dirname(realpath(__FILE__)) . '/imagedashedline.png';
$image = imagecreatetruecolor(250, 250);
$bg = imagecolorallocate($image, 0, 0, 0);
$col_line = imagecolorallocate($image, 255, 0, 0);
imagedashedline($image, 100, 20, 100, 230, $col_line );
imagedashedline($image, 150, 20, 150, 230, $col_line );
imagepng($image, $dest);
$col1 = imagecolorat($image, 100, 230);
$col2 = imagecolorat($image, 5, 5);
$color1 = imagecolorsforindex($image, $col1);
$color2 = imagecolorsforindex($image, $col2);
var_dump($color1, $color2);
imagedestroy($image);
echo "Done\n";
?>
--CLEAN--
<?php
$dest = dirname(realpath(__FILE__)) . '/imagedashedline.png';
@unlink($dest);
?>
--EXPECT--
Simple test of imagedashedline() function
array(4) {
["red"]=>
int(255)
["green"]=>
int(0)
["blue"]=>
int(0)
["alpha"]=>
int(0)
}
array(4) {
["red"]=>
int(0)
["green"]=>
int(0)
["blue"]=>
int(0)
["alpha"]=>
int(0)
}
Done