2013-07-15 10:14:22 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use Slic3r::XS;
|
2017-04-07 15:37:30 +00:00
|
|
|
use Test::More tests => 7;
|
2013-07-15 10:14:22 +00:00
|
|
|
|
|
|
|
my $points = [
|
|
|
|
[100, 100],
|
|
|
|
[200, 100],
|
|
|
|
[200, 200],
|
|
|
|
];
|
|
|
|
|
|
|
|
my $path = Slic3r::ExtrusionPath->new(
|
2013-07-15 20:57:22 +00:00
|
|
|
polyline => Slic3r::Polyline->new(@$points),
|
2013-07-15 10:14:22 +00:00
|
|
|
role => Slic3r::ExtrusionPath::EXTR_ROLE_EXTERNAL_PERIMETER,
|
2014-01-03 17:27:46 +00:00
|
|
|
mm3_per_mm => 1,
|
2013-07-15 10:14:22 +00:00
|
|
|
);
|
2013-08-30 22:50:03 +00:00
|
|
|
isa_ok $path->polyline, 'Slic3r::Polyline::Ref', 'path polyline';
|
2013-07-16 07:49:34 +00:00
|
|
|
is_deeply $path->polyline->pp, $points, 'path points roundtrip';
|
2013-07-15 10:14:22 +00:00
|
|
|
|
|
|
|
$path->reverse;
|
2013-07-16 07:49:34 +00:00
|
|
|
is_deeply $path->polyline->pp, [ reverse @$points ], 'reverse path';
|
2013-07-15 10:14:22 +00:00
|
|
|
|
|
|
|
$path->append([ 150, 150 ]);
|
2013-07-15 20:57:22 +00:00
|
|
|
is scalar(@$path), 4, 'append to path';
|
2013-07-15 10:14:22 +00:00
|
|
|
|
|
|
|
$path->pop_back;
|
2013-07-15 20:57:22 +00:00
|
|
|
is scalar(@$path), 3, 'pop_back from path';
|
2013-07-15 10:14:22 +00:00
|
|
|
|
2013-08-26 21:42:00 +00:00
|
|
|
ok $path->first_point->coincides_with($path->polyline->[0]), 'first_point';
|
|
|
|
|
2013-07-15 10:14:22 +00:00
|
|
|
$path = $path->clone;
|
|
|
|
|
|
|
|
is $path->role, Slic3r::ExtrusionPath::EXTR_ROLE_EXTERNAL_PERIMETER, 'role';
|
|
|
|
|
|
|
|
__END__
|