17_boundingbox.t 742 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Slic3r::XS;
  5. use Test::More tests => 5;
  6. {
  7. my @points = (
  8. Slic3r::Point->new(100, 200),
  9. Slic3r::Point->new(500, -600),
  10. );
  11. my $bb = Slic3r::Geometry::BoundingBox->new_from_points(\@points);
  12. isa_ok $bb, 'Slic3r::Geometry::BoundingBox', 'new_from_points';
  13. is_deeply $bb->min_point->pp, [100,-600], 'min_point';
  14. is_deeply $bb->max_point->pp, [500,200], 'max_point';
  15. }
  16. {
  17. my $bb = Slic3r::Geometry::BoundingBox->new;
  18. $bb->merge_point(Slic3r::Point->new(10, 10));
  19. is_deeply $bb->min_point->pp, [10,10], 'min_point equals to the only defined point';
  20. is_deeply $bb->max_point->pp, [10,10], 'max_point equals to the only defined point';
  21. }
  22. __END__