1--TEST--
2Test ImagickDraw, setStrokeLineCap
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 setStrokeLineCap($strokeColor, $fillColor, $backgroundColor) {
13
14    $draw = new \ImagickDraw();
15    $draw->setStrokeColor($strokeColor);
16    $draw->setFillColor($fillColor);
17    $draw->setStrokeWidth(25);
18
19    $lineTypes = array(\Imagick::LINECAP_BUTT, \Imagick::LINECAP_ROUND, \Imagick::LINECAP_SQUARE,);
20
21    $offset = 0;
22
23    foreach ($lineTypes as $lineType) {
24        $draw->setStrokeLineCap($lineType);
25        $draw->line(50 + $offset, 50, 50 + $offset, 250);
26        $offset += 50;
27    }
28
29    $imagick = new \Imagick();
30    $imagick->newImage(300, 300, $backgroundColor);
31    $imagick->setImageFormat("png");
32    $imagick->drawImage($draw);
33
34    $bytes = $imagick->getImageBlob();
35    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
36}
37
38setStrokeLineCap($strokeColor, $fillColor, $backgroundColor) ;
39echo "Ok";
40?>
41--EXPECTF--
42Ok