Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2012-12-20 20:01:01 +0400
committerAlessandro Ranellucci <aar@cpan.org>2012-12-20 20:01:01 +0400
commitea304a4803e316fb376f555826f24ada72517be3 (patch)
tree1847c058e1ba931135d7684427d2099ce8c88aea /t/custom_gcode.t
parentb70404bb236173de0e1cb0ea4573cde33e26632c (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.t41
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__