Failing test for broken command line scaling. #1889
This commit is contained in:
parent
fc4ac5ded4
commit
e9e23119fc
2 changed files with 53 additions and 35 deletions
|
@ -98,7 +98,6 @@ sub mesh {
|
||||||
$mesh->ReadFromPerl($vertices, $facets);
|
$mesh->ReadFromPerl($vertices, $facets);
|
||||||
$mesh->repair;
|
$mesh->repair;
|
||||||
$mesh->scale_xyz($params{scale_xyz}) if $params{scale_xyz};
|
$mesh->scale_xyz($params{scale_xyz}) if $params{scale_xyz};
|
||||||
$mesh->scale($params{scale}) if $params{scale};
|
|
||||||
$mesh->translate(@{$params{translate}}) if $params{translate};
|
$mesh->translate(@{$params{translate}}) if $params{translate};
|
||||||
return $mesh;
|
return $mesh;
|
||||||
}
|
}
|
||||||
|
@ -113,6 +112,7 @@ sub model {
|
||||||
$object->add_instance(
|
$object->add_instance(
|
||||||
offset => [0,0],
|
offset => [0,0],
|
||||||
rotation => $params{rotation} // 0,
|
rotation => $params{rotation} // 0,
|
||||||
|
scaling_factor => $params{scale} // 1,
|
||||||
);
|
);
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
20
t/layers.t
20
t/layers.t
|
@ -1,4 +1,4 @@
|
||||||
use Test::More tests => 4;
|
use Test::More tests => 5;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ use List::Util qw(first);
|
||||||
use Slic3r;
|
use Slic3r;
|
||||||
use Slic3r::Test qw(_eq);
|
use Slic3r::Test qw(_eq);
|
||||||
|
|
||||||
|
{
|
||||||
my $config = Slic3r::Config->new_from_defaults;
|
my $config = Slic3r::Config->new_from_defaults;
|
||||||
|
|
||||||
my $test = sub {
|
my $test = sub {
|
||||||
|
@ -55,5 +56,22 @@ ok $test->(), "positive Z offset";
|
||||||
|
|
||||||
$config->set('z_offset', -0.8);
|
$config->set('z_offset', -0.8);
|
||||||
ok $test->(), "negative Z offset";
|
ok $test->(), "negative Z offset";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
my $config = Slic3r::Config->new;
|
||||||
|
$config->set('fill_density', 0); # just for making the test faster
|
||||||
|
my $print = Slic3r::Test::init_print('20mm_cube', config => $config, scale => 2);
|
||||||
|
|
||||||
|
my @z = ();
|
||||||
|
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
||||||
|
my ($self, $cmd, $args, $info) = @_;
|
||||||
|
|
||||||
|
if ($info->{dist_Z}) {
|
||||||
|
push @z, 1*$args->{Z};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ok $z[-1] > 20*1.8 && $z[-1] < 20*2.2, 'resulting G-code has reasonable height';
|
||||||
|
}
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
|
|
Loading…
Add table
Reference in a new issue