]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - t/20-mod.t
Get rid of LaTeX::TikZ::Set::Mod
[perl/modules/LaTeX-TikZ.git] / t / 20-mod.t
index 024a988350b05657420bf41d08d734ae3afbbb71..a6c44651b6493757a1921df979477eb5d0b9695c 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 11 + 2 * 15;
+use Test::More tests => 13 + 2 * 17;
 
 use LaTeX::TikZ;
 use LaTeX::TikZ::Formatter;
@@ -70,12 +70,15 @@ 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 ;
@@ -231,3 +234,39 @@ check $seq, 'mod covering 3', <<'RES';
 \draw baz ;
 \end{scope}
 RES
+
+eval {
+ $baz->mod(Tikz->raw_mod($_)) for qw/raw2 raw3/;
+};
+is $@, '', 'creating and adding another raw 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 bar ;
+\end{scope}
+\draw qux ;
+\end{scope}
+\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