1--TEST--
2Test ImagickDraw, getTextDirection
3--SKIPIF--
4<?php
5require_once(dirname(__FILE__) . '/skipif.inc');
6checkClassMethods('ImagickDraw', array('getTextDirection', 'setTextDirection'));
7?>
8--FILE--
9<?php
10
11require_once(dirname(__FILE__) . '/functions.inc');
12
13$backgroundColor = 'rgb(225, 225, 225)';
14$strokeColor = 'rgb(0, 0, 0)';
15$fillColor = 'DodgerBlue2';
16
17
18
19$draw = new \ImagickDraw();
20setFontForImagickDraw($draw);
21
22$draw->setStrokeColor($strokeColor);
23$draw->setFillColor($fillColor);
24
25$draw->setStrokeWidth(2);
26$draw->setFontSize(56);
27
28$directions = array(
29	\Imagick::DIRECTION_LEFT_TO_RIGHT,
30	\Imagick::DIRECTION_RIGHT_TO_LEFT,
31	\Imagick::DIRECTION_LEFT_TO_RIGHT,
32);
33
34$i = 0;
35foreach ($directions as $directionToSet) {
36	$draw->setTextDirection($directionToSet);
37	$directionReturned = $draw->getTextDirection();
38
39	if ($directionReturned != $directionToSet) {
40		echo "Direction error for $i \n";
41	}
42
43	$position = 36;
44	if ($directionToSet == \Imagick::DIRECTION_RIGHT_TO_LEFT) {
45		$position = 500 - 36;
46	}
47
48	$draw->annotation($position, (72 * $i) + 64, "Lorem Ipsum!");
49
50	$i++;
51}
52
53$imagick = new \Imagick();
54$imagick->newImage(500, 500, $backgroundColor);
55$imagick->setImageFormat("png");
56$imagick->drawImage($draw);
57
58$bytes = $imagick->getImageBlob();
59if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
60
61$imagick->writeImage('./directionTest.png');
62
63echo "Ok";
64?>
65--EXPECTF--
66Ok