X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLaTeX-TikZ.git;a=blobdiff_plain;f=t%2F12-geo.t;h=afbc1e703717d51dbf22f0d551f4889b97f638b9;hp=3a7eef7e65a32dd702f49ac12b476d19915158f9;hb=1918fdf5100058cd6a4281bc8b04ec8977841e5e;hpb=d823d115ca3d3718e078dbb986d2c7eb5750df24 diff --git a/t/12-geo.t b/t/12-geo.t index 3a7eef7..afbc1e7 100644 --- a/t/12-geo.t +++ b/t/12-geo.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => (11 + 2 * 5) + 2 * (10 + 2 * 3); +use Test::More tests => (14 + 2 * 5) + 2 * (11 + 2 * 3); use Math::Complex; @@ -188,3 +188,33 @@ eval { }; like $@, qr/isn't a non-negative real number/, 'creating a circle with a negative radius croaks'; + +# Arc + +$tikz = Tikz->formatter( + format => "%.03f" +); + +my $arc = eval { + Tikz->arc(1, i, $o); +}; +is $@, '', 'creating a simple arc doesn\'t croak'; + +check $arc, 'simple arc', <<'RES'; +\begin{scope} +\clip (0.969cm,0.000cm) -- (1.085cm,0.000cm) -- (1.032cm,0.335cm) -- (0.878cm,0.638cm) -- (0.638cm,0.878cm) -- (0.335cm,1.032cm) -- (0.000cm,1.085cm) -- (0.000cm,0.969cm) -- cycle ; +\draw (0.000cm,0.000cm) circle (1.000cm) ; +\end{scope} +RES + +eval { + Tikz->arc(0, 1); +}; +my $err = quotemeta 'Tikz->arc($first_point, $second_point, $center)'; +like $@, qr/^$err/, 'creating an arc from only two points croaks'; + +eval { + Tikz->arc(0, 1, i); +}; +like $@, qr/The two first points aren't on a circle of center the last/, + 'creating an arc with two points not on a circle of center c croaks';