diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2012-12-20 20:01:01 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2012-12-20 20:01:01 +0400 |
commit | ea304a4803e316fb376f555826f24ada72517be3 (patch) | |
tree | 1847c058e1ba931135d7684427d2099ce8c88aea /t/custom_gcode.t | |
parent | b70404bb236173de0e1cb0ea4573cde33e26632c (diff) |
Bugfix: custom layer G-code was applied before Z change, and not after like it was documented. #869
Diffstat (limited to 't/custom_gcode.t')
-rw-r--r-- | t/custom_gcode.t | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/t/custom_gcode.t b/t/custom_gcode.t new file mode 100644 index 000000000..ea36c0cf1 --- /dev/null +++ b/t/custom_gcode.t @@ -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__ |