1--TEST--
2Test ImagickDraw, setStrokeDashArray
3--SKIPIF--
4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
5--FILE--
6<?php
7
8$backgroundColor = 'rgb(225, 225, 225)';
9$strokeColor = 'rgb(0, 0, 0)';
10$fillColor = 'DodgerBlue2';
11
12function setStrokeDashArray($strokeColor, $fillColor, $backgroundColor) {
13
14    $draw = new \ImagickDraw();
15
16    $draw->setStrokeColor($strokeColor);
17    $draw->setFillColor($fillColor);
18    $draw->setStrokeWidth(4);
19
20    $draw->setStrokeDashArray(array(10, 10));
21    $draw->rectangle(100, 50, 225, 175);
22
23    $draw->setStrokeDashArray(array(20, 5, 20, 5, 5, 5,));
24    $draw->rectangle(275, 50, 400, 175);
25
26    $draw->setStrokeDashArray(array(20, 5, 20, 5, 5));
27    $draw->rectangle(100, 200, 225, 350);
28
29    $draw->setStrokeDashArray(array(1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 8, 8, 13, 13, 21, 21, 34, 34, 55, 55, 89, 89, 144, 144, 233, 233, 377, 377, 610, 610, 987, 987, 1597, 1597, 2584, 2584, 4181, 4181,));
30
31    $draw->rectangle(275, 200, 400, 350);
32
33    $image = new \Imagick();
34    $image->newImage(500, 400, $backgroundColor);
35    $image->setImageFormat("png");
36    $image->drawImage($draw);
37
38    $bytes = $image->getImageBlob();
39    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
40}
41
42setStrokeDashArray($strokeColor, $fillColor, $backgroundColor) ;
43echo "Ok";
44?>
45--EXPECTF--
46Ok