]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - t/11-point.t
Coerce points from common types
[perl/modules/LaTeX-TikZ.git] / t / 11-point.t
index c7f53cdf11adceee590bffc31cafd1f7a3ff1134..9e73f15c89b6d47ba2d578eb24525457eff7e721 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1 + 2 * 1;
+use Test::More tests => 5 + 2 * 5;
 
 use Math::Complex;
 
@@ -42,3 +42,39 @@ is $@, '', 'creating a point from a Math::Complex object doesn\'t croak';
 check $p, 'a point from a Math::Complex object', <<'RES';
 \draw (1cm,2cm) ;
 RES
+
+$p = eval {
+ Tikz->point(1-2*i);
+};
+is $@, '', 'creating a point from a Math::Complex constant object doesn\'t croak';
+
+check $p, 'a point from a constant Math::Complex object', <<'RES';
+\draw (1cm,-2cm) ;
+RES
+
+$p = eval {
+ Tikz->point(-7);
+};
+is $@, '', 'creating a point from a numish constant doesn\'t croak';
+
+check $p, 'a point from a numish constant', <<'RES';
+\draw (-7cm,0cm) ;
+RES
+
+$p = eval {
+ Tikz->point(5,-1);
+};
+is $@, '', 'creating a point from two numish constants doesn\'t croak';
+
+check $p, 'a point from two numish constants', <<'RES';
+\draw (5cm,-1cm) ;
+RES
+
+$p = eval {
+ Tikz->point([-3, 2]);
+};
+is $@, '', 'creating a point from an array ref doesn\'t croak';
+
+check $p, 'a point from an array ref', <<'RES';
+\draw (-3cm,2cm) ;
+RES