Bugfix: ambiguous semantics of the layers_count() method caused M73 to go beyond 100%. #1670

Conflicts:

	lib/Slic3r/GCode.pm
	lib/Slic3r/Print.pm
	lib/Slic3r/Print/Object.pm
This commit is contained in:
Alessandro Ranellucci 2014-01-11 17:40:09 +01:00
parent c0a74780cb
commit ea173cf815
4 changed files with 64 additions and 40 deletions

View file

@ -1,4 +1,4 @@
use Test::More tests => 7;
use Test::More tests => 8;
use strict;
use warnings;
@ -81,4 +81,21 @@ use Slic3r::Test;
ok $print->total_used_filament > 0, 'final retraction is not considered in total used filament';
}
{
my $config = Slic3r::Config->new_from_defaults;
$config->set('gcode_flavor', 'sailfish');
$config->set('raft_layers', 3);
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
my @percent = ();
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
my ($self, $cmd, $args, $info) = @_;
if ($cmd eq 'M73') {
push @percent, $args->{P};
}
});
# the extruder heater is turned off when M73 P100 is reached
ok !(defined first { $_ > 100 } @percent), 'M73 is never given more than 100%';
}
__END__