From: Vincent Pit Date: Sun, 18 Jul 2010 10:30:15 +0000 (+0200) Subject: Test mod foldings X-Git-Tag: v0.01~53 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=e0a78fcfb70f3e83bafc4a7ca16731229d6e3e7c;p=perl%2Fmodules%2FLaTeX-TikZ.git Test mod foldings --- diff --git a/t/20-mod.t b/t/20-mod.t index d840710..724fbe9 100644 --- a/t/20-mod.t +++ b/t/20-mod.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 6 + 2 * 4; +use Test::More tests => 8 + 2 * 12; use LaTeX::TikZ; use LaTeX::TikZ::Formatter; @@ -81,3 +81,97 @@ check $foo, 'one triple modded sequence of raw sets (with duplicates)', <<'RES'; \draw bar ; \end{scope} RES + +my $baz = eval { + Tikz->raw('baz') + ->mod($red); +}; +is $@, '', 'creating another colored raw set doesn\'t croak'; + +check [ $foo, $baz ], 'mods folding 1', <<'RES'; +\begin{scope} [color=red] +\begin{scope} [line width=4.0pt] +\draw foo ; +\draw bar ; +\end{scope} +\draw baz ; +\end{scope} +RES + +check [ $baz, $foo ], 'mods folding 2', <<'RES'; +\begin{scope} [color=red] +\draw baz ; +\begin{scope} [line width=4.0pt] +\draw foo ; +\draw bar ; +\end{scope} +\end{scope} +RES + +my $qux = eval { + Tikz->raw('qux') + ->mod($width); +}; +is $@, '', 'creating another raw set with modded width doesn\'t croak'; + +check [ $foo, $baz, $qux ], 'mods folding 3', <<'RES'; +\begin{scope} [color=red] +\begin{scope} [line width=4.0pt] +\draw foo ; +\draw bar ; +\end{scope} +\draw baz ; +\end{scope} +\draw [line width=4.0pt] qux ; +RES + +check [ $foo, $qux, $baz ], 'mods folding 4', <<'RES'; +\begin{scope} [line width=4.0pt] +\begin{scope} [color=red] +\draw foo ; +\draw bar ; +\end{scope} +\draw qux ; +\end{scope} +\draw [color=red] baz ; +RES + +check [ $baz, $foo, $qux ], 'mods folding 5', <<'RES'; +\begin{scope} [color=red] +\draw baz ; +\begin{scope} [line width=4.0pt] +\draw foo ; +\draw bar ; +\end{scope} +\end{scope} +\draw [line width=4.0pt] qux ; +RES + +check [ $baz, $qux, $foo ], 'mods folding 6', <<'RES'; +\draw [color=red] baz ; +\draw [line width=4.0pt] qux ; +\begin{scope} [color=red,line width=4.0pt] +\draw foo ; +\draw bar ; +\end{scope} +RES + +check [ $qux, $foo, $baz ], 'mods folding 7', <<'RES'; +\begin{scope} [line width=4.0pt] +\draw qux ; +\begin{scope} [color=red] +\draw foo ; +\draw bar ; +\end{scope} +\end{scope} +\draw [color=red] baz ; +RES + +check [ $qux, $baz, $foo ], 'mods folding 8', <<'RES'; +\draw [line width=4.0pt] qux ; +\draw [color=red] baz ; +\begin{scope} [color=red,line width=4.0pt] +\draw foo ; +\draw bar ; +\end{scope} +RES