1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
<?php declare(strict_types=1);
namespace Svg\Tests;
use Exception;
use PHPUnit\Framework\TestCase;
use Svg\Document;
use Svg\Surface\SurfaceCpdf;
use Svg\Tag\Path;
final class PathTest extends TestCase
{
public function commandProvider(): array
{
return [
'parse a relative arc with the shorthand format' => [
'a12.083 12.083 0 01.665 6.479',
[
[
'a',
'12.083',
'12.083',
'0',
'0',
'1',
'.665',
'6.479',
],
],
],
'parse an absolute arc with the shorthand format' => [
'A12.083 12.083 0 01.665 6.479',
[
[
'A',
'12.083',
'12.083',
'0',
'0',
'1',
'.665',
'6.479',
],
],
],
'parse two relative arcs that occur in sequence' => [
'a2.43,2.43,0,0,1,.65-1.57,5.91,5.91,0,0,0,1-2.78',
[
[
'a',
'2.43',
'2.43',
'0',
'0',
'1',
'.65',
'-1.57',
],
[
'a',
'5.91',
'5.91',
'0',
'0',
'0',
'1',
'-2.78',
],
],
],
];
}
/**
* @dataProvider commandProvider
* @param string $commandSequence
* @param array $expected
*/
public function testParseCommands(string $commandSequence, array $expected)
{
$result = Path::parse($commandSequence);
$this->assertSame($expected, $result);
}
}
|