Test retract lift
This commit is contained in:
parent
ac6dc67e6a
commit
2564317fb4
@ -1,4 +1,4 @@
|
|||||||
use Test::More tests => 2;
|
use Test::More tests => 3;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
@ -16,15 +16,31 @@ my $test = sub {
|
|||||||
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
||||||
|
|
||||||
my $retracted = 1; # ignore the first travel move from home to first point
|
my $retracted = 1; # ignore the first travel move from home to first point
|
||||||
|
my $lifted = 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 ($info->{dist_Z}) {
|
||||||
|
# lift move or lift + change layer
|
||||||
|
if (Slic3r::Test::compare($info->{dist_Z}, $config->retract_lift->[0])
|
||||||
|
|| (Slic3r::Test::compare($info->{dist_Z}, $config->layer_height + $config->retract_lift->[0]) && $config->retract_lift->[0] > 0)) {
|
||||||
|
fail 'only lifting while retracted' if !$retracted;
|
||||||
|
$lifted = 1;
|
||||||
|
}
|
||||||
|
if ($info->{dist_Z} < 0) {
|
||||||
|
fail 'going down only after lifting' if !$lifted;
|
||||||
|
fail 'going down by the same amount of the lift'
|
||||||
|
if !Slic3r::Test::compare($info->{dist_Z}, -$config->retract_lift->[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}, $config->retract_length->[0]);
|
if !Slic3r::Test::compare(-$info->{dist_E}, $config->retract_length->[0]);
|
||||||
$retracted = 1;
|
$retracted = 1;
|
||||||
}
|
}
|
||||||
if ($info->{extruding}) {
|
if ($info->{extruding}) {
|
||||||
|
fail 'only extruding while not lifted' if $lifted;
|
||||||
if ($retracted) {
|
if ($retracted) {
|
||||||
fail 'unretracted by the correct amount'
|
fail 'unretracted by the correct amount'
|
||||||
if !Slic3r::Test::compare($info->{dist_E}, $config->retract_length->[0] + $config->retract_restart_extra->[0]);
|
if !Slic3r::Test::compare($info->{dist_E}, $config->retract_length->[0] + $config->retract_restart_extra->[0]);
|
||||||
@ -46,4 +62,7 @@ ok $test->(), 'retraction';
|
|||||||
$config->set('retract_restart_extra', [1]);
|
$config->set('retract_restart_extra', [1]);
|
||||||
ok $test->(), 'restart extra length';
|
ok $test->(), 'restart extra length';
|
||||||
|
|
||||||
|
$config->set('retract_lift', [1]);
|
||||||
|
ok $test->(), 'lift';
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
|
Loading…
Reference in New Issue
Block a user