Satisfy test suite and CLI

This commit is contained in:
Alessandro Ranellucci 2014-01-02 17:24:23 +01:00
parent e2f1040a76
commit 5bf0942f45
20 changed files with 300 additions and 272 deletions

View file

@ -13,10 +13,14 @@ use Slic3r;
use Slic3r::Test;
sub buffer {
my $config = shift || Slic3r::Config->new_from_defaults;
my $config = shift || Slic3r::Config->new;
my $print_config = Slic3r::Config::Print->new;
$print_config->apply_dynamic($config);
my $buffer = Slic3r::GCode::CoolingBuffer->new(
config => $config,
gcodegen => Slic3r::GCode->new(config => $config, layer_count => 10, extruders => []),
config => $print_config,
gcodegen => Slic3r::GCode->new(print_config => $print_config, layer_count => 10, extruders => []),
);
return $buffer;
}

View file

@ -14,9 +14,8 @@ use Slic3r::Test;
{
my $gcodegen = Slic3r::GCode->new(
config => Slic3r::Config->new_from_defaults,
layer_count => 1,
extruders => [],
layer_count => 1,
extruders => [],
);
$gcodegen->set_shift(10, 10);
is_deeply $gcodegen->last_pos->arrayref, [scale -10, scale -10], 'last_pos is shifted correctly';

View file

@ -140,6 +140,9 @@ use Slic3r::Test;
{
my $config = Slic3r::Config->new_from_defaults;
$config->set('perimeters', 1);
$config->set('fill_density', 0);
$config->set('top_solid_layers', 0);
$config->set('spiral_vase', 1);
$config->set('bottom_solid_layers', 0);
$config->set('skirts', 0);

View file

@ -21,16 +21,16 @@ use Slic3r::Test;
my $test = sub {
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
$print->init_extruders;
my $flow = $print->support_material_flow;
my $flow = $print->objects->[0]->support_material_flow;
my $support_z = Slic3r::Print::SupportMaterial
->new(config => $config, flow => $flow)
->new(object_config => $print->objects->[0]->config, print_config => $print->config, flow => $flow)
->support_layers_z(\@contact_z, \@top_z, $config->layer_height);
is $support_z->[0], $config->first_layer_height,
'first layer height is honored';
is scalar(grep { $support_z->[$_]-$support_z->[$_-1] <= 0 } 1..$#$support_z), 0,
'no null or negative support layers';
is scalar(grep { $support_z->[$_]-$support_z->[$_-1] > $flow->nozzle_diameter + epsilon } 1..$#$support_z), 0,
is scalar(grep { $support_z->[$_]-$support_z->[$_-1] > $config->nozzle_diameter->[0] + epsilon } 1..$#$support_z), 0,
'no layers thicker than nozzle diameter';
my $wrong_top_spacing = 0;
@ -40,7 +40,7 @@ use Slic3r::Test;
# check that first support layer above this top surface is spaced with nozzle diameter
$wrong_top_spacing = 1
if ($support_z->[$layer_id+1] - $support_z->[$layer_id]) != $flow->nozzle_diameter;
if ($support_z->[$layer_id+1] - $support_z->[$layer_id]) != $config->nozzle_diameter->[0];
}
ok !$wrong_top_spacing, 'layers above top surfaces are spaced correctly';
};