From: Vincent Pit Date: Thu, 22 Jul 2010 19:58:45 +0000 (+0200) Subject: Test labeled points X-Git-Tag: v0.01~9 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=e9f5b8b4bfbd4f60f4041a954fa35a802b5e8d80;p=perl%2Fmodules%2FLaTeX-TikZ.git Test labeled points --- diff --git a/lib/LaTeX/TikZ/Formatter.pm b/lib/LaTeX/TikZ/Formatter.pm index 899b4b0..718c3eb 100644 --- a/lib/LaTeX/TikZ/Formatter.pm +++ b/lib/LaTeX/TikZ/Formatter.pm @@ -205,7 +205,7 @@ sub label { my $scale = sprintf '%0.2f', $tikz->scale / 5; - "node[scale=$scale,$pos] {\$$name\$}"; + "node[scale=$scale,$pos] {$name}"; } sub thickness { diff --git a/t/11-point.t b/t/11-point.t index 7bd64d6..0ceee6c 100644 --- a/t/11-point.t +++ b/t/11-point.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 6 + 2 * 6; +use Test::More tests => 8 + 2 * 8; use Math::Complex; @@ -87,3 +87,29 @@ is $@, '', 'creating a point from an array ref doesn\'t croak'; check $p, 'a point from an array ref', <<'RES'; \draw (-3cm,2cm) ; RES + +$p = eval { + Tikz->point( + [1,-1], + label => 'foo', + ); +}; +is $@, '', 'creating a labeled point from an array ref doesn\'t croak'; + +check $p, 'a labeled point', <<'RES'; +\draw (1cm,-1cm) [fill] circle (0.4pt) node[scale=0.20,above] {foo} ; +RES + +$p = eval { + Tikz->point( + [2,-2], + label => 'bar', + pos => 'below right', + ); +}; +is $@, '', + 'creating a labeled positioned point from an array ref doesn\'t croak'; + +check $p, 'a labeled positioned point', <<'RES'; +\draw (2cm,-2cm) [fill] circle (0.4pt) node[scale=0.20,below right] {bar} ; +RES