Remove sporadic duplicate useless lines. #772

This commit is contained in:
Alessandro Ranellucci 2013-02-04 14:27:23 +01:00
parent 3794d51cc7
commit 7d08796b0a
2 changed files with 11 additions and 2 deletions

View File

@ -141,7 +141,7 @@ sub split_at_index {
my $self = shift; my $self = shift;
my ($index) = @_; my ($index) = @_;
return (ref $self)->new( return Slic3r::Polyline->new(
@$self[$index .. $#$self], @$self[$index .. $#$self],
@$self[0 .. $index], @$self[0 .. $index],
); );

View File

@ -2,7 +2,7 @@ use Test::More;
use strict; use strict;
use warnings; use warnings;
plan tests => 21; plan tests => 23;
BEGIN { BEGIN {
use FindBin; use FindBin;
@ -165,3 +165,12 @@ is Slic3r::Geometry::can_connect_points(@$points, $polygons), 0, 'can_connect_po
} }
#========================================================== #==========================================================
{
my $polyline = Slic3r::Polygon->new([0, 0], [10, 0], [5, 5]);
my $result = $polyline->split_at_index(1);
is ref($result), 'Slic3r::Polyline', 'split_at_index returns polyline';
is_deeply $result, [ [10, 0], [5, 5], [0, 0], [10, 0] ], 'split_at_index';
}
#==========================================================