From: Vincent Pit Date: Sun, 18 Jul 2010 12:13:26 +0000 (+0200) Subject: Test mod covering X-Git-Tag: v0.01~52 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=9eaa7c633f6b14fe72e7a6b479bd198c93c7d8ff;p=perl%2Fmodules%2FLaTeX-TikZ.git Test mod covering --- diff --git a/t/20-mod.t b/t/20-mod.t index 724fbe9..024a988 100644 --- a/t/20-mod.t +++ b/t/20-mod.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 8 + 2 * 12; +use Test::More tests => 11 + 2 * 15; use LaTeX::TikZ; use LaTeX::TikZ::Formatter; @@ -175,3 +175,59 @@ check [ $qux, $baz, $foo ], 'mods folding 8', <<'RES'; \draw bar ; \end{scope} RES + +my $seq = eval { + Tikz->seq($foo, $qux, $baz) + ->mod($red); +}; +is $@, '', 'creating a modded sequence set doesn\'t croak'; + +check $seq, 'mod covering 1', <<'RES'; +\begin{scope} [color=red] +\begin{scope} [line width=4.0pt] +\draw foo ; +\draw bar ; +\draw qux ; +\end{scope} +\draw baz ; +\end{scope} +RES + +my $seq2 = eval { + Tikz->seq($seq, $qux) + ->mod(Tikz->color('blue')); +}; +is $@, '', 'creating another modded sequence set doesn\'t croak'; + +check $seq2, 'mod covering 2', <<'RES'; +\begin{scope} [color=blue] +\begin{scope} [color=red] +\begin{scope} [line width=4.0pt] +\draw foo ; +\draw bar ; +\draw qux ; +\end{scope} +\draw baz ; +\end{scope} +\draw [line width=4.0pt] qux ; +\end{scope} +RES + +eval { + $foo->mod(Tikz->raw_mod('raw1')); + $seq->mod(Tikz->raw_mod('raw2')); +}; +is $@, '', 'creating and adding raw mods doesn\'t croak'; + +check $seq, 'mod covering 3', <<'RES'; +\begin{scope} [color=red,raw2] +\begin{scope} [line width=4.0pt] +\begin{scope} [raw1] +\draw foo ; +\draw bar ; +\end{scope} +\draw qux ; +\end{scope} +\draw baz ; +\end{scope} +RES