]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - t/lib/LaTeX/TikZ/TestHelper.pm
Introduce the ->begin and ->end path methods
[perl/modules/LaTeX-TikZ.git] / t / lib / LaTeX / TikZ / TestHelper.pm
index deb1dff21cfe4978d8a1733c9f25b9e4980013c6..040fe824a33c0fc2fcd70bf11f2aeb0ffc42be88 100644 (file)
@@ -8,7 +8,7 @@ use Test::More ();
 use Any::Moose 'Exporter';
 
 any_moose('Exporter')->setup_import_methods(
- as_is => [ qw<using check> ],
+ as_is => [ qw<using check is_point_ok> ],
 );
 
 my $tikz;
@@ -40,4 +40,16 @@ sub check {
  return $head, $decl, $body;
 }
 
+sub is_point_ok {
+ my ($p, $x, $y, $desc) = @_;
+
+ my $ok = Test::More::isa_ok($p, 'LaTeX::TikZ::Point', "$desc isa point");
+ if ($ok) {
+  Test::More::cmp_ok($p->x, '==', $x, "$desc x coordinate is right");
+  Test::More::cmp_ok($p->y, '==', $y, "$desc y coordinate is right");
+ } else {
+  Test::More::fail("$desc placeholder $_") for 1, 2;
+ }
+}
+
 1;