6 use Test::More tests => 20 + 2 * 22;
11 use LaTeX::TikZ::TestHelper;
13 using Tikz->formatter(
20 is $@, '', 'creating a color mod doesn\'t croak';
26 is $@, '', 'creating a modded raw set doesn\'t croak';
28 check $foo, 'one modded raw set', <<'RES';
29 \draw [color=red] foo ;
36 is $@, '', 'creating a modded raw set from a string doesn\'t croak';
38 check $foo2, 'one modded raw set from a string', <<'RES';
44 qr/Validation failed for '\Q$tc\E'/;
49 ->mod(Tikz->raw('epic'));
51 like $@, failed_valid('LaTeX::TikZ::Mod'), 'trying to use a non LTM mod croaks';
56 is $@, '', 'creating a width mod doesn\'t croak';
61 is $@, '', 'adding another mod doesn\'t croak';
63 check $foo, 'one double modded raw set', <<'RES';
64 \draw [color=red,line width=4.0pt] foo ;
70 is $@, '', 're-adding an previously set mod doesn\'t croak';
72 check $foo, 'one triple modded raw set (with duplicates)', <<'RES';
73 \draw [color=red,line width=4.0pt] foo ;
76 my $bar = Tikz->raw('bar');
83 is $@, '', 'setting two mods in a row doesn\'t croak';
85 check $foo, 'one triple modded sequence of raw sets', <<'RES';
86 \begin{scope} [color=red,line width=4.0pt]
94 Tikz->seq(Tikz->raw("foo"))
98 is $@, '', 'creating nested modded sequences doesn\'t croak';
100 check $nested, 'nested modded sequences', <<'RES';
101 \draw [line width=4.0pt,color=red] foo ;
108 is $@, '', 'creating another colored raw set doesn\'t croak';
110 check Tikz->seq($foo, $baz), 'mods folding 1', <<'RES';
111 \begin{scope} [color=red]
112 \begin{scope} [line width=4.0pt]
120 check Tikz->seq($baz, $foo), 'mods folding 2', <<'RES';
121 \begin{scope} [color=red]
123 \begin{scope} [line width=4.0pt]
134 is $@, '', 'creating another raw set with modded width doesn\'t croak';
136 check Tikz->seq($foo, $baz, $qux), 'mods folding 3', <<'RES';
137 \begin{scope} [color=red]
138 \begin{scope} [line width=4.0pt]
144 \draw [line width=4.0pt] qux ;
147 check Tikz->seq($foo, $qux, $baz), 'mods folding 4', <<'RES';
148 \begin{scope} [line width=4.0pt]
149 \begin{scope} [color=red]
155 \draw [color=red] baz ;
158 check Tikz->seq($baz, $foo, $qux), 'mods folding 5', <<'RES';
159 \begin{scope} [color=red]
161 \begin{scope} [line width=4.0pt]
166 \draw [line width=4.0pt] qux ;
169 check Tikz->seq($baz, $qux, $foo), 'mods folding 6', <<'RES';
170 \draw [color=red] baz ;
171 \draw [line width=4.0pt] qux ;
172 \begin{scope} [color=red,line width=4.0pt]
178 check Tikz->seq($qux, $foo, $baz), 'mods folding 7', <<'RES';
179 \begin{scope} [line width=4.0pt]
181 \begin{scope} [color=red]
186 \draw [color=red] baz ;
189 check Tikz->seq($qux, $baz, $foo), 'mods folding 8', <<'RES';
190 \draw [line width=4.0pt] qux ;
191 \draw [color=red] baz ;
192 \begin{scope} [color=red,line width=4.0pt]
199 Tikz->seq($foo, $qux, $baz)
202 is $@, '', 'creating a modded sequence set doesn\'t croak';
204 check $seq, 'mod covering 1', <<'RES';
205 \begin{scope} [color=red]
206 \begin{scope} [line width=4.0pt]
216 Tikz->seq($seq, $qux)
217 ->mod(Tikz->color('blue'));
219 is $@, '', 'creating another modded sequence set doesn\'t croak';
221 check $seq2, 'mod covering 2', <<'RES';
222 \begin{scope} [color=blue]
223 \begin{scope} [color=red]
224 \begin{scope} [line width=4.0pt]
231 \draw [line width=4.0pt] qux ;
236 $foo->mod(Tikz->raw_mod('raw1'));
237 $seq->mod(Tikz->raw_mod('raw2'));
239 is $@, '', 'creating and adding raw mods doesn\'t croak';
241 check $seq, 'mod covering 3', <<'RES';
242 \begin{scope} [color=red,raw2]
243 \begin{scope} [line width=4.0pt]
255 $baz->mod(Tikz->raw_mod($_)) for qw<raw2 raw3>;
257 is $@, '', 'creating and adding another raw mod doesn\'t croak';
259 check $seq, 'mod covering 4', <<'RES';
260 \begin{scope} [color=red,raw2]
261 \begin{scope} [line width=4.0pt]
268 \draw [raw2,raw3] baz ;
273 $bar->mod(Tikz->width(50));
275 is $@, '', 'creating and adding another width mod doesn\'t croak';
277 check $seq, 'mod covering 5', <<'RES';
278 \begin{scope} [color=red,raw2]
279 \begin{scope} [line width=4.0pt]
282 \draw [line width=8.0pt] bar ;
286 \draw [raw2,raw3] baz ;
290 my ($fred, $fblue) = eval {
291 map Tikz->fill($_), qw<red blue>;
293 is $@, '', 'creating two fill mods doesn\'t croak';
301 is $@, '', 'creating a structure with two identical fill mods doesn\'t croak';
303 check $seq, 'mod covering 6', <<'RES';
304 \draw [fill=red] foo ;
313 is $@, '', 'creating a structure with two different fill mods doesn\'t croak';
315 check $seq, 'mod covering 7', <<'RES';
316 \draw [fill=red,fill=blue] foo ;
325 is $@, '', 'creating a structure with color and fill mods doesn\'t croak';
327 check $seq, 'mod covering 8', <<'RES';
328 \draw [fill=red,color=red] foo ;