X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLaTeX-TikZ.git;a=blobdiff_plain;f=t%2F20-mod.t;h=a6c44651b6493757a1921df979477eb5d0b9695c;hp=256cbdd58881121400e18118690e1db9d0f26ffb;hb=cb3b916e0590c6a0b70b60f30304921385462faa;hpb=aba26c835113a0332c5480e99f86bfa67111de84 diff --git a/t/20-mod.t b/t/20-mod.t index 256cbdd..a6c4465 100644 --- a/t/20-mod.t +++ b/t/20-mod.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 19 + 2 * 20; +use Test::More tests => 13 + 2 * 17; use LaTeX::TikZ; use LaTeX::TikZ::Formatter; @@ -70,58 +70,21 @@ check $foo, 'one triple modded raw set (with duplicates)', <<'RES'; RES my $bar = Tikz->raw('bar'); -eval { - $foo->add($bar); +$foo = eval { + Tikz->seq( + Tikz->raw('foo'), + $bar + )->mod($red, $width); }; -is $@, '', 'appending to a modded set doesn\'t croak'; +is $@, '', 'setting two mods in a row doesn\'t croak'; -check $foo, 'one triple modded sequence of raw sets (with duplicates)', <<'RES'; +check $foo, 'one triple modded sequence of raw sets', <<'RES'; \begin{scope} [color=red,line width=4.0pt] \draw foo ; \draw bar ; \end{scope} RES -my $set = Tikz->raw('wut'); - -my $set_mod = eval { - $set->mod; -}; -is $@, '', 'calling empty mod out of a set doesn\'t croak'; -is "$set_mod", "$set", 'calling empty mod out of a set returns the set'; - -my $new = eval { - $set->mod(Tikz->raw_mod('raw1')); -}; -is $@, '', - 'creating and applying a raw mod on a set in scalar context doesn\'t croak'; -is ref($new), 'LaTeX::TikZ::Set::Mod', 'new set is of the right kind'; -isnt "$new", "$set", 'new set is different from the old one'; - -check $set, '', <<'RES'; -\draw wut ; -RES - -check $new, '', <<'RES'; -\draw [raw1] wut ; -RES - -eval { - $set->mod(Tikz->raw_mod('raw2')); - (); -}; -is $@, '', - 'creating and applying a raw mod on a set in void context doesn\'t croak'; -is ref($new), 'LaTeX::TikZ::Set::Mod', 'new set is of the right kind'; - -check $set, '', <<'RES'; -\draw [raw2] wut ; -RES - -check $new, '', <<'RES'; -\draw [raw1] wut ; -RES - my $baz = eval { Tikz->raw('baz') ->mod($red); @@ -289,3 +252,21 @@ check $seq, 'mod covering 4', <<'RES'; \draw [raw3] baz ; \end{scope} RES + +eval { + $bar->mod(Tikz->width(50)); +}; +is $@, '', 'creating and adding another width mod doesn\'t croak'; + +check $seq, 'mod covering 4', <<'RES'; +\begin{scope} [color=red,raw2] +\begin{scope} [line width=4.0pt] +\begin{scope} [raw1] +\draw foo ; +\draw [line width=8.0pt] bar ; +\end{scope} +\draw qux ; +\end{scope} +\draw [raw3] baz ; +\end{scope} +RES