]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - t/11-point.t
Really allow coercing a string into a mod object
[perl/modules/LaTeX-TikZ.git] / t / 11-point.t
index c7f53cdf11adceee590bffc31cafd1f7a3ff1134..7bd64d6568312043ad9aa15fe5beea22d07a40f0 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1 + 2 * 1;
+use Test::More tests => 6 + 2 * 6;
 
 use Math::Complex;
 
@@ -42,3 +42,48 @@ 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;
+};
+is $@, '', 'creating a point from nothing doesn\'t croak';
+
+check $p, 'a point from nothing', <<'RES';
+\draw (0cm,0cm) ;
+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