Skip to content
Browse files

Add start of SVGPad class.

  • Loading branch information...
1 parent b364122 commit eb84dba2c285ef18f5e55398c10540a33a72c6fd SF committed
Showing with 42 additions and 0 deletions.
  1. +25 −0 lib/SVGPad.pm
  2. +17 −0 t/07-pad.t
View
25 lib/SVGPad.pm
@@ -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 })
+ {
+
+
+ }
+}
View
17 t/07-pad.t
@@ -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.
Something went wrong with that request. Please try again.