Bugfix: custom layer G-code was applied before Z change, and not after like it was documented. #869
This commit is contained in:
parent
b70404bb23
commit
ea304a4803
4 changed files with 51 additions and 2 deletions
41
t/custom_gcode.t
Normal file
41
t/custom_gcode.t
Normal file
|
@ -0,0 +1,41 @@
|
|||
use Test::More tests => 1;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
BEGIN {
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
}
|
||||
|
||||
use Slic3r;
|
||||
use Slic3r::Test;
|
||||
|
||||
my $config = Slic3r::Config->new_from_defaults;
|
||||
|
||||
my $test = sub {
|
||||
my ($conf) = @_;
|
||||
$conf ||= $config;
|
||||
|
||||
my $print = Slic3r::Test::init_print('2x20x10', config => $conf);
|
||||
|
||||
my $last_move_was_z_change = 0;
|
||||
Slic3r::Test::GCodeReader->new(gcode => Slic3r::Test::gcode($print))->parse(sub {
|
||||
my ($self, $cmd, $args, $info) = @_;
|
||||
|
||||
if ($last_move_was_z_change && $cmd ne $config->layer_gcode) {
|
||||
fail 'custom layer G-code was not applied after Z change';
|
||||
}
|
||||
if (!$last_move_was_z_change && $cmd eq $config->layer_gcode) {
|
||||
fail 'custom layer G-code was not applied after Z change';
|
||||
}
|
||||
|
||||
$last_move_was_z_change = (defined $info->{dist_Z} && $info->{dist_Z} > 0);
|
||||
});
|
||||
|
||||
1;
|
||||
};
|
||||
|
||||
$config->set('layer_gcode', '_MY_CUSTOM_GCODE_');
|
||||
ok $test->(), "custom layer G-code is applied after Z move and before other moves";
|
||||
|
||||
__END__
|
Loading…
Add table
Add a link
Reference in a new issue