diff options
author | Lukas Matena <lukasmatena@seznam.cz> | 2019-05-22 17:43:14 +0300 |
---|---|---|
committer | Lukas Matena <lukasmatena@seznam.cz> | 2019-05-22 17:48:20 +0300 |
commit | 07282eb24d027817b4279f59ebbf0d80bac5f950 (patch) | |
tree | 1096f7eb0a97912139115b9d9c8acbcfdb121bb7 /lib | |
parent | 82740835fbe64af4bba11f0122706f0009a670be (diff) |
Fixed unit tests when run with range checks on std::vector
There was a bug in unit tests that led to generating the wipe tower with non-normalized preset.
This caused out-of-bounds access into max_layer_height vector in fill_wipe_tower_partitions.
The problem surfaced in https://github.com/prusa3d/PrusaSlicer/issues/2288.
I quickly patched additional normalization of the preset to prevent this from happening.
Also, an assert in the same function turned out to trip on one of the tests.
This one was commented out for now and will (hopefully) be looked into later.
Function Print::apply_config was renamed to apply_config_perl_tests_only so everyone
sees its current purpose and does not mistake it for the more important Print::apply.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Slic3r/Print/Simple.pm | 2 | ||||
-rw-r--r-- | lib/Slic3r/Test.pm | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/Slic3r/Print/Simple.pm b/lib/Slic3r/Print/Simple.pm index b5b749f12..2ab68f4d3 100644 --- a/lib/Slic3r/Print/Simple.pm +++ b/lib/Slic3r/Print/Simple.pm @@ -13,7 +13,7 @@ use Slic3r::Geometry qw(X Y); has '_print' => ( is => 'ro', default => sub { Slic3r::Print->new }, - handles => [qw(apply_config extruders output_filepath + handles => [qw(apply_config_perl_tests_only extruders output_filepath total_used_filament total_extruded_volume placeholder_parser process)], ); diff --git a/lib/Slic3r/Test.pm b/lib/Slic3r/Test.pm index b767ca593..d1b99e48c 100644 --- a/lib/Slic3r/Test.pm +++ b/lib/Slic3r/Test.pm @@ -176,7 +176,7 @@ sub init_print { $config->set('gcode_comments', 1) if $ENV{SLIC3R_TESTS_GCODE}; my $print = Slic3r::Print->new; - $print->apply_config($config); + $print->apply_config_perl_tests_only($config); $models = [$models] if ref($models) ne 'ARRAY'; $models = [ map { ref($_) ? $_ : model($_, %params) } @$models ]; @@ -192,8 +192,8 @@ sub init_print { $print->add_model_object($model_object); } } - # Call apply_config one more time, so that the layer height profiles are updated over all PrintObjects. - $print->apply_config($config); + # Call apply_config_perl_tests_only one more time, so that the layer height profiles are updated over all PrintObjects. + $print->apply_config_perl_tests_only($config); $print->validate; # We return a proxy object in order to keep $models alive as required by the Print API. @@ -250,7 +250,7 @@ sub add_facet { package Slic3r::Test::Print; use Moo; -has 'print' => (is => 'ro', required => 1, handles => [qw(process apply_config)]); +has 'print' => (is => 'ro', required => 1, handles => [qw(process apply_config_perl_tests_only)]); has 'models' => (is => 'ro', required => 1); 1; |