1--TEST--
2Test ImagickDraw, setStrokeLineJoin
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 setStrokeLineJoin($strokeColor, $fillColor, $backgroundColor) {
13
14    $draw = new \ImagickDraw();
15    $draw->setStrokeWidth(1);
16    $draw->setStrokeColor($strokeColor);
17    $draw->setFillColor($fillColor);
18
19    $draw->setStrokeWidth(20);
20
21    $offset = 220;
22
23    $lineJoinStyle = array(\Imagick::LINEJOIN_MITER, \Imagick::LINEJOIN_ROUND, \Imagick::LINEJOIN_BEVEL,);
24
25    for ($x = 0; $x < count($lineJoinStyle); $x++) {
26        $draw->setStrokeLineJoin($lineJoinStyle[$x]);
27        $points = array(
28            array('x' => 40 * 5, 'y' => 10 * 5 + $x * $offset),
29            array('x' => 20 * 5, 'y' => 20 * 5 + $x * $offset),
30            array('x' => 70 * 5, 'y' => 50 * 5 + $x * $offset),
31            array('x' => 40 * 5, 'y' => 10 * 5 + $x * $offset),
32        );
33
34        $draw->polyline($points);
35    }
36
37    $image = new \Imagick();
38    $image->newImage(500, 700, $backgroundColor);
39    $image->setImageFormat("png");
40
41    $image->drawImage($draw);
42
43    $bytes = $image->getImageBlob();
44    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
45}
46
47setStrokeLineJoin($strokeColor, $fillColor, $backgroundColor) ;
48echo "Ok";
49?>
50--EXPECTF--
51Ok