Perl unit tests for perimeters and multi-material were rewritten to C++.

Perl binding was slimmed down, namely Clipper is no more linked by Perl.
This commit is contained in:
Vojtech Bubnik 2022-05-04 15:05:56 +02:00
parent 7380787b3a
commit a627614b58
48 changed files with 1194 additions and 2310 deletions

View file

@ -23,47 +23,6 @@ our $Options = print_config_def();
}
}
# From command line parameters, used by slic3r.pl
sub new_from_cli {
my $class = shift;
my %args = @_;
# Delete hash keys with undefined value.
delete $args{$_} for grep !defined $args{$_}, keys %args;
# Replace the start_gcode, end_gcode ... hash values
# with the content of the files they reference.
for (qw(start end layer toolchange)) {
my $opt_key = "${_}_gcode";
if ($args{$opt_key}) {
if (-e $args{$opt_key}) {
Slic3r::open(\my $fh, "<", $args{$opt_key})
or die "Failed to open $args{$opt_key}\n";
binmode $fh, ':utf8';
$args{$opt_key} = do { local $/; <$fh> };
close $fh;
}
}
}
my $self = $class->new;
foreach my $opt_key (keys %args) {
my $opt_def = $Options->{$opt_key};
# we use set_deserialize() for bool options since GetOpt::Long doesn't handle
# arrays of boolean values
if ($opt_key =~ /^(?:bed_shape|duplicate_grid|extruder_offset)$/ || $opt_def->{type} eq 'bool') {
$self->set_deserialize($opt_key, $args{$opt_key});
} elsif (my $shortcut = $opt_def->{shortcut}) {
$self->set($_, $args{$opt_key}) for @$shortcut;
} else {
$self->set($opt_key, $args{$opt_key});
}
}
return $self;
}
package Slic3r::Config::Static;
use parent 'Slic3r::Config';

View file

@ -4,13 +4,6 @@ use warnings;
# an ExPolygon is a polygon with holes
sub noncollapsing_offset_ex {
my $self = shift;
my ($distance, @params) = @_;
return $self->offset_ex($distance + 1, @params);
}
sub bounding_box {
my $self = shift;
return $self->contour->bounding_box;

View file

@ -1,13 +0,0 @@
package Slic3r::Geometry::Clipper;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(
offset
offset2_ex
diff_ex diff union_ex
union);
1;

View file

@ -31,7 +31,4 @@ sub regions {
return [ map $self->get_region($_), 0..($self->region_count-1) ];
}
package Slic3r::Layer::Support;
our @ISA = qw(Slic3r::Layer);
1;

View file

@ -5,9 +5,4 @@ use warnings;
# a line is a two-points line
use parent 'Slic3r::Polyline';
sub grow {
my $self = shift;
return Slic3r::Polyline->new(@$self)->grow(@_);
}
1;

View file

@ -133,11 +133,4 @@ sub add_instance {
}
}
sub mesh_stats {
my $self = shift;
# TODO: sum values from all volumes
return $self->volumes->[0]->mesh->stats;
}
1;

View file

@ -5,9 +5,4 @@ use warnings;
# a polygon is a closed polyline.
use parent 'Slic3r::Polyline';
sub grow {
my $self = shift;
return $self->split_at_first_point->grow(@_);
}
1;
1;

View file

@ -5,7 +5,6 @@ use warnings;
use List::Util qw(min max sum first);
use Slic3r::Flow ':roles';
use Slic3r::Print::State ':steps';
use Slic3r::Surface ':types';
sub layers {
@ -13,9 +12,4 @@ sub layers {
return [ map $self->get_layer($_), 0..($self->layer_count - 1) ];
}
sub support_layers {
my $self = shift;
return [ map $self->get_support_layer($_), 0..($self->support_layer_count - 1) ];
}
1;

View file

@ -1,12 +0,0 @@
# Wraps C++ enums Slic3r::PrintStep and Slic3r::PrintObjectStep
package Slic3r::Print::State;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(STEP_SLICE STEP_PERIMETERS STEP_PREPARE_INFILL
STEP_INFILL STEP_SUPPORTMATERIAL STEP_SKIRT STEP_BRIM STEP_WIPE_TOWER);
our %EXPORT_TAGS = (steps => \@EXPORT_OK);
1;