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