Fix t/support.t after changing contact distance on top surfaces

This commit is contained in:
Alessandro Ranellucci 2014-12-24 12:11:30 +01:00
parent 19548fe301
commit 33f7b08c80

View file

@ -22,15 +22,15 @@ use Slic3r::Test;
my $print = Slic3r::Test::init_print('20mm_cube', config => $config); my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
$print->print->init_extruders; $print->print->init_extruders;
my $flow = $print->print->objects->[0]->support_material_flow; my $flow = $print->print->objects->[0]->support_material_flow;
my $support_z = Slic3r::Print::SupportMaterial my $support = Slic3r::Print::SupportMaterial->new(
->new( object_config => $print->print->objects->[0]->config,
object_config => $print->print->objects->[0]->config, print_config => $print->print->config,
print_config => $print->print->config, flow => $flow,
flow => $flow, interface_flow => $flow,
interface_flow => $flow, first_layer_flow => $flow,
first_layer_flow => $flow, );
) my $support_z = $support->support_layers_z(\@contact_z, \@top_z, $config->layer_height);
->support_layers_z(\@contact_z, \@top_z, $config->layer_height); my $expected_top_spacing = Slic3r::Print::SupportMaterial::contact_distance($config->nozzle_diameter->[0]);
is $support_z->[0], $config->first_layer_height, is $support_z->[0], $config->first_layer_height,
'first layer height is honored'; 'first layer height is honored';
@ -44,9 +44,10 @@ use Slic3r::Test;
# find layer index of this top surface # find layer index of this top surface
my $layer_id = first { abs($support_z->[$_] - $top_z) < epsilon } 0..$#$support_z; my $layer_id = first { abs($support_z->[$_] - $top_z) < epsilon } 0..$#$support_z;
# check that first support layer above this top surface is spaced with nozzle diameter # check that first support layer above this top surface (or the next one) is spaced with nozzle diameter
$wrong_top_spacing = 1 $wrong_top_spacing = 1
if ($support_z->[$layer_id+1] - $support_z->[$layer_id]) != $config->nozzle_diameter->[0]; if ($support_z->[$layer_id+1] - $support_z->[$layer_id]) != $expected_top_spacing
&& ($support_z->[$layer_id+2] - $support_z->[$layer_id]) != $expected_top_spacing;
} }
ok !$wrong_top_spacing, 'layers above top surfaces are spaced correctly'; ok !$wrong_top_spacing, 'layers above top surfaces are spaced correctly';
}; };