2013-07-15 21:23:35 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use Slic3r::XS;
|
2013-08-28 23:36:42 +00:00
|
|
|
use Test::More tests => 5;
|
2013-07-15 21:23:35 +00:00
|
|
|
|
|
|
|
my $points = [
|
|
|
|
[100, 100],
|
|
|
|
[200, 100],
|
|
|
|
[200, 200],
|
|
|
|
];
|
|
|
|
|
|
|
|
my $polyline = Slic3r::Polyline->new(@$points);
|
|
|
|
is_deeply $polyline->pp, $points, 'polyline roundtrip';
|
|
|
|
|
|
|
|
is ref($polyline->arrayref), 'ARRAY', 'polyline arrayref is unblessed';
|
2013-09-02 18:22:20 +00:00
|
|
|
isa_ok $polyline->[0], 'Slic3r::Point::Ref', 'polyline point is blessed';
|
2013-07-15 21:23:35 +00:00
|
|
|
|
|
|
|
my $lines = $polyline->lines;
|
|
|
|
is_deeply [ map $_->pp, @$lines ], [
|
|
|
|
[ [100, 100], [200, 100] ],
|
|
|
|
[ [200, 100], [200, 200] ],
|
|
|
|
], 'polyline lines';
|
|
|
|
|
2013-08-28 23:36:42 +00:00
|
|
|
$polyline->append_polyline($polyline->clone);
|
|
|
|
is_deeply $polyline->pp, [ @$points, @$points ], 'append_polyline';
|
|
|
|
|
2013-07-15 21:23:35 +00:00
|
|
|
__END__
|