Browse Source

Regression test for top solid surfaces in V-shaped object. #1161

Alessandro Ranellucci 11 years ago
parent
commit
8b2c13cc6f
2 changed files with 31 additions and 1 deletions
  1. 7 0
      lib/Slic3r/Test.pm
  2. 24 1
      t/shells.t

+ 7 - 0
lib/Slic3r/Test.pm

@@ -27,6 +27,13 @@ sub model {
         $facets = [
             [0,1,2], [0,2,3], [4,5,6], [4,6,7], [0,4,7], [0,7,1], [1,7,6], [1,6,2], [2,6,5], [2,5,3], [4,0,3], [4,3,5],
         ],
+    } elsif ($model_name eq 'V') {
+        $vertices = [
+            [-14,0,20],[-14,15,20],[0,0,0],[0,15,0],[-4,0,20],[-4,15,20],[5,0,7.14286],[10,0,0],[24,0,20],[14,0,20],[10,15,0],[5,15,7.14286],[14,15,20],[24,15,20]
+        ];
+        $facets = [
+            [0,1,2],[2,1,3],[1,0,4],[5,1,4],[4,0,2],[6,4,2],[7,6,2],[8,9,7],[9,6,7],[2,3,7],[7,3,10],[1,5,3],[3,5,11],[11,12,13],[11,13,3],[3,13,10],[5,4,6],[11,5,6],[6,9,11],[11,9,12],[12,9,8],[13,12,8],[8,7,10],[13,8,10]
+        ],
     }
     
     my $model = Slic3r::Model->new;

+ 24 - 1
t/shells.t

@@ -1,4 +1,4 @@
-use Test::More tests => 2;
+use Test::More tests => 3;
 use strict;
 use warnings;
 
@@ -45,4 +45,27 @@ use Slic3r::Test;
     ok $test->(), "proper number of shells is applied even when fill density is none";
 }
 
+# issue #1161
+{
+    my $config = Slic3r::Config->new_from_defaults;
+    $config->set('layer_height', 0.3);
+    $config->set('first_layer_height', '100%');
+    $config->set('bottom_solid_layers', 0);
+    $config->set('top_solid_layers', 3);
+    $config->set('cooling', 0);
+    $config->set('solid_infill_speed', 99);
+    $config->set('top_solid_infill_speed', 99);
+    
+    my $print = Slic3r::Test::init_print('V', config => $config);
+    my %layers_with_solid_infill = ();  # Z => 1
+    Slic3r::GCode::Reader->new(gcode => Slic3r::Test::gcode($print))->parse(sub {
+        my ($self, $cmd, $args, $info) = @_;
+        
+        $layers_with_solid_infill{$self->Z} = 1
+            if $info->{extruding} && ($args->{F} // $self->F) == $config->solid_infill_speed*60;
+    });
+    is scalar(map $layers_with_solid_infill{$_}, grep $_ <= 7.2, keys %layers_with_solid_infill), 3,
+        "correct number of top solid shells is generated in V-shaped object";
+}
+
 __END__