07_extrusionpath.t 872 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Slic3r::XS;
  5. use Test::More tests => 7;
  6. my $points = [
  7. [100, 100],
  8. [200, 100],
  9. [200, 200],
  10. ];
  11. my $path = Slic3r::ExtrusionPath->new(
  12. polyline => Slic3r::Polyline->new(@$points),
  13. role => Slic3r::ExtrusionPath::EXTR_ROLE_EXTERNAL_PERIMETER,
  14. mm3_per_mm => 1,
  15. );
  16. isa_ok $path->polyline, 'Slic3r::Polyline::Ref', 'path polyline';
  17. is_deeply $path->polyline->pp, $points, 'path points roundtrip';
  18. $path->reverse;
  19. is_deeply $path->polyline->pp, [ reverse @$points ], 'reverse path';
  20. $path->append([ 150, 150 ]);
  21. is scalar(@$path), 4, 'append to path';
  22. $path->pop_back;
  23. is scalar(@$path), 3, 'pop_back from path';
  24. ok $path->first_point->coincides_with($path->polyline->[0]), 'first_point';
  25. $path = $path->clone;
  26. is $path->role, Slic3r::ExtrusionPath::EXTR_ROLE_EXTERNAL_PERIMETER, 'role';
  27. __END__