07_extrusionpath.t 891 B

12345678910111213141516171819202122232425262728293031323334353637
  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. );
  15. isa_ok $path->polyline, 'Slic3r::Polyline', 'path polyline';
  16. is_deeply $path->polyline->pp, $points, 'path points roundtrip';
  17. $path->reverse;
  18. is_deeply $path->polyline->pp, [ reverse @$points ], 'reverse path';
  19. $path->append([ 150, 150 ]);
  20. is scalar(@$path), 4, 'append to path';
  21. $path->pop_back;
  22. is scalar(@$path), 3, 'pop_back from path';
  23. $path = $path->clone;
  24. is $path->role, Slic3r::ExtrusionPath::EXTR_ROLE_EXTERNAL_PERIMETER, 'role';
  25. $path->role(Slic3r::ExtrusionPath::EXTR_ROLE_FILL);
  26. is $path->role, Slic3r::ExtrusionPath::EXTR_ROLE_FILL, 'modify role';
  27. __END__