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