1--TEST--
2Test ImagickDraw, popDefs
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 popDefs($strokeColor, $fillColor, $backgroundColor) {
13
14    $draw = new \ImagickDraw();
15
16    $draw->setStrokeColor($strokeColor);
17    $draw->setFillColor($fillColor);
18    $draw->setstrokeOpacity(1);
19    $draw->setStrokeWidth(2);
20    $draw->setFontSize(72);
21    $draw->pushDefs();
22    $draw->setStrokeColor('white');
23    $draw->rectangle(50, 50, 200, 200);
24    $draw->popDefs();
25
26    $draw->rectangle(300, 50, 450, 200);
27
28    $imagick = new \Imagick();
29    $imagick->newImage(500, 500, $backgroundColor);
30    $imagick->setImageFormat("png");
31
32    $imagick->drawImage($draw);
33
34    $bytes = $imagick->getImageBlob();
35    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
36}
37
38popDefs($strokeColor, $fillColor, $backgroundColor) ;
39echo "Ok";
40?>
41--EXPECTF--
42Ok