]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - t/30-functor.t
Also define a default functor rule for the new Polyline
[perl/modules/LaTeX-TikZ.git] / t / 30-functor.t
index e455a9d6e1a59bdd73168c6e15257afa0d52097f..74ff18d727f489e771a7181ebdf784e03eb34204 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 10 + 2 * 7;
+use Test::More tests => 11 + 2 * 8;
 
 use LaTeX::TikZ;
 
@@ -78,6 +78,19 @@ check $seq2, 'the translated sequence', <<'RES';
 \end{scope}
 RES
 
+my $poly = Tikz->closed_polyline(
+ [ 0, 0 ], [ 1, 0 ], [ 1, 1 ], [ 0, 1 ]
+);
+
+my $poly2 = eval {
+ $poly->$translate(Tikz->point(-1, 1));
+};
+is $@, '', 'translating a polyline doesn\'t croak';
+
+check $poly2, 'the translated polyline', <<'RES';
+\draw (-1cm,1cm) -- (0cm,1cm) -- (0cm,2cm) -- (-1cm,2cm) -- cycle ;
+RES
+
 my $strip = eval {
  Tikz->functor(
   '+LaTeX::TikZ::Mod' => sub { return },