1--TEST--
2imagedashedline()
3--SKIPIF--
4<?php
5	if (!function_exists('imagedashedline')) die('skip imagedashedline() not available');
6?>
7--FILE--
8<?php
9
10/* Prototype  : bool imagedashedline  ( resource $image  , int $x1  , int $y1  , int $x2  , int $y2  , int $color  )
11 * Description: Draws a dashed line.
12 * This function is deprecated. Use combination of imagesetstyle() and imageline() instead.
13 * Source code: ext/standard/image.c
14 * Alias to functions:
15 */
16
17
18echo "Simple test of imagedashedline() function\n";
19
20$dest = dirname(realpath(__FILE__)) . '/imagedashedline.png';
21
22// create a blank image
23$image = imagecreatetruecolor(250, 250);
24
25// set the background color to black
26$bg = imagecolorallocate($image, 0, 0, 0);
27
28// red dashed lines
29$col_line = imagecolorallocate($image, 255, 0, 0);
30
31// draw a couple of vertical dashed lines
32imagedashedline($image, 100, 20, 100, 230, $col_line );
33imagedashedline($image, 150, 20, 150, 230, $col_line );
34
35// output the picture to a file
36imagepng($image, $dest);
37
38//check color of a point on edge..
39$col1 = imagecolorat($image, 100, 230);
40// ..and a point on background
41$col2 = imagecolorat($image, 5, 5);
42
43$color1 = imagecolorsforindex($image, $col1);
44$color2 = imagecolorsforindex($image, $col2);
45var_dump($color1, $color2);
46
47imagedestroy($image);
48echo "Done\n";
49?>
50--CLEAN--
51<?php
52	$dest = dirname(realpath(__FILE__)) . '/imagedashedline.png';
53	@unlink($dest);
54?>
55--EXPECT--
56Simple test of imagedashedline() function
57array(4) {
58  ["red"]=>
59  int(255)
60  ["green"]=>
61  int(0)
62  ["blue"]=>
63  int(0)
64  ["alpha"]=>
65  int(0)
66}
67array(4) {
68  ["red"]=>
69  int(0)
70  ["green"]=>
71  int(0)
72  ["blue"]=>
73  int(0)
74  ["alpha"]=>
75  int(0)
76}
77Done
78