New freeze.t test
This commit is contained in:
parent
71057b54a9
commit
f26f084064
1
MANIFEST
1
MANIFEST
@ -71,6 +71,7 @@ t/cooling.t
|
|||||||
t/custom_gcode.t
|
t/custom_gcode.t
|
||||||
t/dynamic.t
|
t/dynamic.t
|
||||||
t/fill.t
|
t/fill.t
|
||||||
|
t/freeze.t
|
||||||
t/gcode.t
|
t/gcode.t
|
||||||
t/geometry.t
|
t/geometry.t
|
||||||
t/layers.t
|
t/layers.t
|
||||||
|
@ -57,9 +57,15 @@ sub model {
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $mesh = Slic3r::TriangleMesh->new(
|
||||||
|
vertices => $vertices,
|
||||||
|
facets => $facets,
|
||||||
|
);
|
||||||
|
$mesh->scale($params{scale}) if $params{scale};
|
||||||
|
|
||||||
my $model = Slic3r::Model->new;
|
my $model = Slic3r::Model->new;
|
||||||
my $object = $model->add_object(vertices => $vertices);
|
my $object = $model->add_object(vertices => $mesh->vertices);
|
||||||
$object->add_volume(facets => $facets);
|
$object->add_volume(facets => $mesh->facets);
|
||||||
$object->add_instance(
|
$object->add_instance(
|
||||||
offset => [0,0],
|
offset => [0,0],
|
||||||
rotation => $params{rotation} // 0,
|
rotation => $params{rotation} // 0,
|
||||||
|
29
t/freeze.t
Normal file
29
t/freeze.t
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
use Test::More tests => 1;
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
use FindBin;
|
||||||
|
use lib "$FindBin::Bin/../lib";
|
||||||
|
}
|
||||||
|
|
||||||
|
use Slic3r;
|
||||||
|
use Slic3r::Test;
|
||||||
|
use Storable qw(nstore retrieve);
|
||||||
|
use Time::HiRes qw(gettimeofday tv_interval);
|
||||||
|
|
||||||
|
{
|
||||||
|
my $t0 = [gettimeofday];
|
||||||
|
my $print = Slic3r::Test::init_print('20mm_cube', scale => 2);
|
||||||
|
my $gcode = Slic3r::Test::gcode($print);
|
||||||
|
diag sprintf 'Slicing took %s seconds', tv_interval($t0);
|
||||||
|
|
||||||
|
my $t1 = [gettimeofday];
|
||||||
|
nstore $print, 'print.dat';
|
||||||
|
$print = retrieve 'print.dat';
|
||||||
|
diag sprintf 'Freezing and retrieving took %s seconds', tv_interval($t1);
|
||||||
|
|
||||||
|
isa_ok $print, 'Slic3r::Print', 'restored Print object';
|
||||||
|
}
|
||||||
|
|
||||||
|
__END__
|
Loading…
Reference in New Issue
Block a user