Skip to content

Commit

Permalink
Add start of SVGPad class.
Browse files Browse the repository at this point in the history
  • Loading branch information
SF committed Nov 2, 2009
1 parent b364122 commit eb84dba
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/SVGPad.pm
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,25 @@
use v6;

use Vector;

class SVGPad
{
has Vector $.xy_min;
has Vector $.xy_max;
has Vector $.mn_min;
has Vector $.mn_max;

multi method new(Vector $xy_min where { $xy_min.Dim == 2 },
Vector $xy_max where { $xy_max.Dim == 2 },
Vector $mn_min where { $mn_min.Dim == 2 },
Vector $mn_max where { $mn_max.Dim == 2 })
{
self.bless(*, xy_min => $xy_min, xy_max => $xy_max, mn_min => $mn_min, mn_max => $mn_max);
}

multi method xy2mn(Vector $xy where { $xy.Dim == 2 })
{


}
}
17 changes: 17 additions & 0 deletions t/07-pad.t
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,17 @@
use v6;

use Test;
use Vector;
use SVGPad;

plan *;

my $pad = SVGPad.new(Vector.new(-1, 0), Vector.new(1, 3), Vector.new(0, 0), Vector.new(200, 300));
isa_ok($pad, SVGPad, "Variable is of type SVGPad");
is_approx($pad.xy_min, Vector.new(-1, 0), "xy_min is correct");
is_approx($pad.xy_max, Vector.new(1, 3), "xy_max is correct");
is_approx($pad.mn_min, Vector.new(0, 0), "mn_min is correct");
is_approx($pad.mn_max, Vector.new(200, 300), "mn_max is correct");


done_testing;

0 comments on commit eb84dba

Please sign in to comment.