mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Fixed support unit tests and reduced dependency on $object
This commit is contained in:
		
							parent
							
								
									bdf825d078
								
							
						
					
					
						commit
						c08d4cc798
					
				
					 3 changed files with 57 additions and 58 deletions
				
			
		
							
								
								
									
										16
									
								
								t/support.t
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								t/support.t
									
										
									
									
									
								
							|  | @ -21,25 +21,25 @@ use Slic3r::Test; | |||
|         my $print = Slic3r::Test::init_print('20mm_cube', config => $config); | ||||
|         $print->init_extruders; | ||||
|         my $flow = $print->support_material_flow; | ||||
|         my @support_layers = Slic3r::Print::SupportMaterial | ||||
|             ->new(object => $print->objects->[0]) | ||||
|             ->_compute_support_layers(\@contact_z, \@top_z); | ||||
|         my $support_z = Slic3r::Print::SupportMaterial | ||||
|             ->new(config => $config, flow => $flow) | ||||
|             ->support_layers_z(\@contact_z, \@top_z, $config->layer_height); | ||||
|          | ||||
|         is $support_layers[0], $config->first_layer_height, | ||||
|         is $support_z->[0], $config->first_layer_height, | ||||
|             'first layer height is honored'; | ||||
|         is scalar(grep { $support_layers[$_]-$support_layers[$_-1] <= 0 } 1..$#support_layers), 0, | ||||
|         is scalar(grep { $support_z->[$_]-$support_z->[$_-1] <= 0 } 1..$#$support_z), 0, | ||||
|             'no null or negative support layers'; | ||||
|         is scalar(grep { $support_layers[$_]-$support_layers[$_-1] > $flow->nozzle_diameter + epsilon } 1..$#support_layers), 0, | ||||
|         is scalar(grep { $support_z->[$_]-$support_z->[$_-1] > $flow->nozzle_diameter + epsilon } 1..$#$support_z), 0, | ||||
|             'no layers thicker than nozzle diameter'; | ||||
|          | ||||
|         my $wrong_top_spacing = 0; | ||||
|         foreach my $top_z (@top_z) { | ||||
|             # find layer index of this top surface | ||||
|             my $layer_id = first { abs($support_layers[$_] - $top_z) < epsilon } 0..$#support_layers; | ||||
|             my $layer_id = first { abs($support_z->[$_] - $top_z) < epsilon } 0..$#$support_z; | ||||
|              | ||||
|             # check that first support layer above this top surface is spaced with nozzle diameter | ||||
|             $wrong_top_spacing = 1 | ||||
|                 if ($support_layers[$layer_id+1] - $support_layers[$layer_id]) != $flow->nozzle_diameter; | ||||
|                 if ($support_z->[$layer_id+1] - $support_z->[$layer_id]) != $flow->nozzle_diameter; | ||||
|         } | ||||
|         ok !$wrong_top_spacing, 'layers above top surfaces are spaced correctly'; | ||||
|     }; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci