Merge pull request #2090 from sapir/improve_placeholder_tests

A few improvements to gcode placeholder tests.
This commit is contained in:
Alessandro Ranellucci 2014-06-13 23:54:38 +02:00
commit e88545b966
2 changed files with 7 additions and 6 deletions

View File

@ -53,16 +53,16 @@ use Slic3r::Test;
{
my $config = Slic3r::Config->new_from_defaults;
$config->set('output_filename_format', '[travel_speed]_[layer_height].gcode');
$config->set('output_filename_format', 'ts_[travel_speed]_lh_[layer_height].gcode');
$config->set('start_gcode', "TRAVEL:[travel_speed] HEIGHT:[layer_height]\n");
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
my $output_file = $print->print->expanded_output_filepath;
ok $output_file !~ /\[travel_speed\]/, 'print config options are replaced in output filename';
ok $output_file !~ /\[layer_height\]/, 'region config options are replaced in output filename';
my ($t, $h) = map $config->$_, qw(travel_speed layer_height);
ok $output_file =~ /ts_${t}_/, 'print config options are replaced in output filename';
ok $output_file =~ /lh_$h\./, 'region config options are replaced in output filename';
my $gcode = Slic3r::Test::gcode($print);
my ($t, $h) = map $config->$_, qw(travel_speed layer_height);
ok $gcode =~ /TRAVEL:$t/, 'print config options are replaced in custom G-code';
ok $gcode =~ /HEIGHT:$h/, 'region config options are replaced in custom G-code';
}
@ -100,7 +100,7 @@ use Slic3r::Test;
# being embedded in the G-code
ok $gcode =~ /temp0:200/, 'temperature placeholder for first extruder correctly populated';
ok $gcode =~ /temp1:205/, 'temperature placeholder for second extruder correctly populated';
ok $gcode =~ /temp2:200/, 'tempearture placeholder for unused extruder populated with first value';
ok $gcode =~ /temp2:200/, 'temperature placeholder for unused extruder populated with first value';
}
}

View File

@ -1,4 +1,4 @@
use Test::More tests => 5;
use Test::More tests => 6;
use strict;
use warnings;
@ -40,6 +40,7 @@ use Slic3r::Test;
# user sets a per-region option
$print->print->objects->[0]->model_object->config->set('fill_density', 100);
$print->print->reload_object(0);
is $print->print->regions->[0]->config->fill_density, 100, 'region config inherits model object config';
# user exports G-code, thus the default config is reapplied
$print->print->apply_config($config);