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

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2015-12-19 14:44:22 +0300
committerAlessandro Ranellucci <aar@cpan.org>2015-12-19 14:44:22 +0300
commita2ea191d8423833641adaf99047b340183d74c66 (patch)
tree1a67a9f70a56cd0a7b8ff85cc920869f3903c81b /t
parentfd7795da59213d4ae262c549fae7f26a3300e1f1 (diff)
Fix regression in lift, includes regression test
Diffstat (limited to 't')
-rw-r--r--t/retraction.t31
1 files changed, 20 insertions, 11 deletions
diff --git a/t/retraction.t b/t/retraction.t
index 05370e672..2e4b177f5 100644
--- a/t/retraction.t
+++ b/t/retraction.t
@@ -1,4 +1,4 @@
-use Test::More tests => 21;
+use Test::More tests => 22;
use strict;
use warnings;
@@ -205,20 +205,29 @@ use Slic3r::Test qw(_eq);
my $config = Slic3r::Config->new_from_defaults;
$config->set('start_gcode', '');
$config->set('retract_lift', [3]);
- $config->set('retract_lift_above', [5]);
- $config->set('retract_lift_below', [15]);
- my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
my @lifted_at = ();
- Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
- my ($self, $cmd, $args, $info) = @_;
+ my $test = sub {
+ my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
+ @lifted_at = ();
+ Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
+ my ($self, $cmd, $args, $info) = @_;
- if ($cmd eq 'G1' && $info->{dist_Z} < 0) {
- push @lifted_at, $info->{new_Z};
- }
- });
+ if ($cmd eq 'G1' && $info->{dist_Z} < 0) {
+ push @lifted_at, $info->{new_Z};
+ }
+ });
+ };
+
+ $config->set('retract_lift_above', [0]);
+ $config->set('retract_lift_below', [0]);
+ $test->();
+ ok !!@lifted_at, 'lift takes place when above/below == 0';
- ok !!@lifted_at, 'lift takes place';
+ $config->set('retract_lift_above', [5]);
+ $config->set('retract_lift_below', [15]);
+ $test->();
+ ok !!@lifted_at, 'lift takes place when above/below != 0';
ok !(any { $_ < $config->get_at('retract_lift_above', 0) } @lifted_at),
'Z is not lifted below the configured value';
ok !(any { $_ > $config->get_at('retract_lift_below', 0) } @lifted_at),