From 09357e58683142b04d2529f536ad36eb96d86428 Mon Sep 17 00:00:00 2001 From: "Y. Sapir" Date: Thu, 15 May 2014 01:42:30 +0300 Subject: [PATCH] A few improvements to gcode placeholder tests. --- t/custom_gcode.t | 10 +++++----- t/print.t | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/t/custom_gcode.t b/t/custom_gcode.t index c693aecb9..6423c394d 100644 --- a/t/custom_gcode.t +++ b/t/custom_gcode.t @@ -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'; } } diff --git a/t/print.t b/t/print.t index 44317c637..d6256c83b 100644 --- a/t/print.t +++ b/t/print.t @@ -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);