Ported ExtrusionPath to XS. Failing test for Surface

This commit is contained in:
Alessandro Ranellucci 2013-07-15 12:14:22 +02:00
parent 8c1e1cc3ea
commit f612d4c64e
24 changed files with 501 additions and 143 deletions

View file

@ -33,7 +33,7 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
}
{
my $expolygon = Slic3r::ExPolygon->new([ scale_points [0,0], [50,0], [50,50], [0,50] ]);
my $expolygon = Slic3r::ExPolygon::XS->new([ scale_points [0,0], [50,0], [50,50], [0,50] ]);
my $filler = Slic3r::Fill::Rectilinear->new(
bounding_box => $expolygon->bounding_box,
);

View file

@ -1,30 +0,0 @@
use Test::More tests => 1;
use strict;
use warnings;
BEGIN {
use FindBin;
use lib "$FindBin::Bin/../lib";
}
use Slic3r;
use Slic3r::Test;
use Storable qw(nstore retrieve);
use Time::HiRes qw(gettimeofday tv_interval);
{
my $t0 = [gettimeofday];
my $print = Slic3r::Test::init_print('20mm_cube', scale => 2);
my $gcode = Slic3r::Test::gcode($print);
###diag sprintf 'Slicing took %s seconds', tv_interval($t0);
my $t1 = [gettimeofday];
nstore $print, 'print.dat';
$print = retrieve 'print.dat';
unlink 'print.dat';
###diag sprintf 'Freezing and retrieving took %s seconds', tv_interval($t1);
isa_ok $print, 'Slic3r::Print', 'restored Print object';
}
__END__

View file

@ -1,4 +1,4 @@
use Test::More tests => 3;
use Test::More tests => 4;
use strict;
use warnings;
@ -15,6 +15,10 @@ use Slic3r::Test;
my $config = Slic3r::Config->new_from_defaults;
$config->set('skirts', 0);
$config->set('perimeters', 0);
$config->set('solid_infill_speed', 99);
$config->set('top_solid_infill_speed', 99);
$config->set('first_layer_speed', '100%');
$config->set('cooling', 0);
my $test = sub {
my ($conf) = @_;
@ -28,20 +32,31 @@ use Slic3r::Test;
if ($self->Z > 0) {
$layers_with_shells{$self->Z} //= 0;
$layers_with_shells{$self->Z} = 1 if $info->{extruding} && $info->{dist_XY} > 0;
$layers_with_shells{$self->Z} = 1
if $info->{extruding}
&& $info->{dist_XY} > 0
&& ($args->{F} // $self->F) == $config->solid_infill_speed*60;
}
});
my @shells = @layers_with_shells{sort { $a <=> $b } keys %layers_with_shells};
fail "wrong number of bottom solid layers"
fail "insufficient number of bottom solid layers"
unless !defined(first { !$_ } @shells[0..$config->bottom_solid_layers-1]);
fail "wrong number of top solid layers"
fail "excessive number of bottom solid layers"
unless scalar(grep $_, @shells[0 .. $#shells/2]) != $config->bottom_solid_layers;
fail "insufficient number of top solid layers"
unless !defined(first { !$_ } @shells[-$config->top_solid_layers..-1]);
fail "excessive number of top solid layers"
unless scalar(grep $_, @shells[($#shells/2)..$#shells]) != $config->top_solid_layers;
1;
};
ok $test->(), "proper number of shells is applied";
$config->set('fill_density', 0);
$config->set('top_solid_layers', 0);
$config->set('bottom_solid_layers', 0);
ok $test->(), "no shells are applied when both top and bottom are set to zero";
$config->set('fill_density', 0);
ok $test->(), "proper number of shells is applied even when fill density is none";
}
@ -55,6 +70,7 @@ use Slic3r::Test;
$config->set('cooling', 0);
$config->set('solid_infill_speed', 99);
$config->set('top_solid_infill_speed', 99);
$config->set('first_layer_speed', '100%');
my $print = Slic3r::Test::init_print('V', config => $config);
my %layers_with_solid_infill = (); # Z => 1