Incomplete work to test multiple extruders in t/retraction.t
This commit is contained in:
parent
1a3497b71d
commit
494a1a84cf
@ -18,42 +18,53 @@ my $test = sub {
|
|||||||
|
|
||||||
my $print = Slic3r::Test::init_print('20mm_cube', config => $conf);
|
my $print = Slic3r::Test::init_print('20mm_cube', config => $conf);
|
||||||
|
|
||||||
my $retracted = 1; # ignore the first travel move from home to first point
|
my $tool = 0;
|
||||||
|
my @retracted = (1); # ignore the first travel move from home to first point
|
||||||
my $lifted = 0;
|
my $lifted = 0;
|
||||||
|
my $changed_tool = 0;
|
||||||
Slic3r::Test::GCodeReader->new(gcode => Slic3r::Test::gcode($print))->parse(sub {
|
Slic3r::Test::GCodeReader->new(gcode => Slic3r::Test::gcode($print))->parse(sub {
|
||||||
my ($self, $cmd, $args, $info) = @_;
|
my ($self, $cmd, $args, $info) = @_;
|
||||||
|
|
||||||
|
if ($cmd =~ /^T(\d+)/) {
|
||||||
|
$tool = $1;
|
||||||
|
$changed_tool = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ($info->{dist_Z}) {
|
if ($info->{dist_Z}) {
|
||||||
# lift move or lift + change layer
|
# lift move or lift + change layer
|
||||||
if (Slic3r::Test::compare($info->{dist_Z}, $conf->retract_lift->[0])
|
if (Slic3r::Test::compare($info->{dist_Z}, $conf->retract_lift->[$tool])
|
||||||
|| (Slic3r::Test::compare($info->{dist_Z}, $conf->layer_height + $conf->retract_lift->[0]) && $conf->retract_lift->[0] > 0)) {
|
|| (Slic3r::Test::compare($info->{dist_Z}, $conf->layer_height + $conf->retract_lift->[$tool]) && $conf->retract_lift->[$tool] > 0)) {
|
||||||
fail 'only lifting while retracted' if !$retracted && !($conf->g0 && $info->{retracting});
|
fail 'only lifting while retracted' if !$retracted[$tool] && !($conf->g0 && $info->{retracting});
|
||||||
$lifted = 1;
|
$lifted = 1;
|
||||||
}
|
}
|
||||||
if ($info->{dist_Z} < 0) {
|
if ($info->{dist_Z} < 0) {
|
||||||
fail 'going down only after lifting' if !$lifted;
|
fail 'going down only after lifting' if !$lifted;
|
||||||
fail 'going down by the same amount of the lift'
|
fail 'going down by the same amount of the lift'
|
||||||
if !Slic3r::Test::compare($info->{dist_Z}, -$conf->retract_lift->[0]);
|
if !Slic3r::Test::compare($info->{dist_Z}, -$conf->retract_lift->[$tool]);
|
||||||
$lifted = 0;
|
$lifted = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($info->{retracting}) {
|
if ($info->{retracting}) {
|
||||||
fail 'retracted by the correct amount'
|
fail 'retracted by the correct amount'
|
||||||
if !Slic3r::Test::compare(-$info->{dist_E}, $conf->retract_length->[0]);
|
if !Slic3r::Test::compare(-$info->{dist_E}, $conf->retract_length->[$tool]);
|
||||||
fail 'combining retraction and travel with G0'
|
fail 'combining retraction and travel with G0'
|
||||||
if $cmd ne 'G0' && $conf->g0 && ($info->{dist_Z} || $info->{dist_XY});
|
if $cmd ne 'G0' && $conf->g0 && ($info->{dist_Z} || $info->{dist_XY});
|
||||||
$retracted = 1;
|
$retracted[$tool] = 1;
|
||||||
}
|
}
|
||||||
if ($info->{extruding}) {
|
if ($info->{extruding}) {
|
||||||
fail 'only extruding while not lifted' if $lifted;
|
fail 'only extruding while not lifted' if $lifted;
|
||||||
if ($retracted) {
|
if ($retracted[$tool]) {
|
||||||
|
my $expected_amount = $conf->retract_length->[$tool] + $conf->retract_restart_extra->[$tool];
|
||||||
|
if ($changed_tool) {
|
||||||
|
$expected_amount = $conf->retract_length_toolchange->[$tool] + $conf->retract_restart_extra_toolchange->[$tool];
|
||||||
|
}
|
||||||
fail 'unretracted by the correct amount'
|
fail 'unretracted by the correct amount'
|
||||||
if !Slic3r::Test::compare($info->{dist_E}, $conf->retract_length->[0] + $conf->retract_restart_extra->[0]);
|
if !Slic3r::Test::compare($info->{dist_E}, $expected_amount);
|
||||||
$retracted = 0;
|
$retracted[$tool] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($info->{travel} && $info->{dist_XY} >= $conf->retract_before_travel->[0]) {
|
if ($info->{travel} && $info->{dist_XY} >= $conf->retract_before_travel->[$tool]) {
|
||||||
fail 'retracted before long travel move' if !$retracted;
|
fail 'retracted before long travel move' if !$retracted[$tool];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -77,9 +88,16 @@ my $retract_tests = sub {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$retract_tests->('');
|
$retract_tests->('');
|
||||||
|
|
||||||
$config->set('duplicate', 2);
|
$config->set('duplicate', 2);
|
||||||
$retract_tests->(' (duplicate)');
|
$retract_tests->(' (duplicate)');
|
||||||
|
|
||||||
$config->set('g0', 1);
|
$config->set('g0', 1);
|
||||||
$retract_tests->(' (G0 and duplicate)');
|
$retract_tests->(' (G0 and duplicate)');
|
||||||
|
|
||||||
|
$config->set('duplicate', 1);
|
||||||
|
$config->set('g0', 0);
|
||||||
|
$config->set('infill_extruder', 2);
|
||||||
|
$retract_tests->(' (dual extruder)');
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
|
Loading…
Reference in New Issue
Block a user