mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 14:25:57 +08:00
Added tests to check the functionality of has_heatbed option.
This commit is contained in:
parent
c5c1cab4f9
commit
7f2c1478eb
45
t/gcode.t
45
t/gcode.t
@ -1,4 +1,4 @@
|
||||
use Test::More tests => 23;
|
||||
use Test::More tests => 25;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
@ -215,4 +215,47 @@ use Slic3r::Test;
|
||||
ok !$spiral, 'spiral vase is correctly disabled on layers with multiple loops';
|
||||
}
|
||||
|
||||
{
|
||||
# Test verifies that if has_heatbed is false, M190/M140 gcodes are not
|
||||
# generated by default even if a bed temperature is set.
|
||||
my $config = Slic3r::Config->new_from_defaults;
|
||||
$config->set('has_heatbed', 0);
|
||||
$config->set('first_layer_bed_temperature', 100);
|
||||
$config->set('bed_temperature', 60);
|
||||
|
||||
my $had_gcode = 0;
|
||||
my $print = Slic3r::Test::init_print('cube_with_hole', config => $config);
|
||||
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
||||
my ($self, $cmd, $args, $info) = @_;
|
||||
|
||||
if (($cmd eq 'M140' && exists $args->{S}) ||
|
||||
($cmd eq 'M190' && exists $args->{S})) {
|
||||
$had_gcode = 1;
|
||||
}
|
||||
});
|
||||
|
||||
ok !$had_gcode, 'M190/M140 codes are not generated if has_heatbed = 0';
|
||||
}
|
||||
|
||||
{
|
||||
# Test verifies that if has_heatbed is true, M190/M140 gcodes are
|
||||
# generated by default if a bed temperature is set.
|
||||
my $config = Slic3r::Config->new_from_defaults;
|
||||
$config->set('has_heatbed', 1);
|
||||
$config->set('first_layer_bed_temperature', 100);
|
||||
$config->set('bed_temperature', 60);
|
||||
|
||||
my $had_gcode = 0;
|
||||
my $print = Slic3r::Test::init_print('cube_with_hole', config => $config);
|
||||
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
||||
my ($self, $cmd, $args, $info) = @_;
|
||||
|
||||
if (($cmd eq 'M140' && exists $args->{S}) ||
|
||||
($cmd eq 'M190' && exists $args->{S})) {
|
||||
$had_gcode = 1;
|
||||
}
|
||||
});
|
||||
|
||||
ok $had_gcode, 'M190/M140 codes are generated if has_heatbed = 1';
|
||||
}
|
||||
__END__
|
||||
|
Loading…
x
Reference in New Issue
Block a user