~ubuntu-branches/ubuntu/utopic/slic3r/utopic

« back to all changes in this revision

Viewing changes to xs/t/07_extrusionpath.t

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2014-06-17 01:27:26 UTC
  • Revision ID: package-import@ubuntu.com-20140617012726-2wrs4zdo251nr4vg
Tags: upstream-1.1.4+dfsg
ImportĀ upstreamĀ versionĀ 1.1.4+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
use strict;
 
4
use warnings;
 
5
 
 
6
use Slic3r::XS;
 
7
use Test::More tests => 8;
 
8
 
 
9
my $points = [
 
10
    [100, 100],
 
11
    [200, 100],
 
12
    [200, 200],
 
13
];
 
14
 
 
15
my $path = Slic3r::ExtrusionPath->new(
 
16
    polyline => Slic3r::Polyline->new(@$points),
 
17
    role     => Slic3r::ExtrusionPath::EXTR_ROLE_EXTERNAL_PERIMETER,
 
18
    mm3_per_mm => 1,
 
19
);
 
20
isa_ok $path->polyline, 'Slic3r::Polyline::Ref', 'path polyline';
 
21
is_deeply $path->polyline->pp, $points, 'path points roundtrip';
 
22
 
 
23
$path->reverse;
 
24
is_deeply $path->polyline->pp, [ reverse @$points ], 'reverse path';
 
25
 
 
26
$path->append([ 150, 150 ]);
 
27
is scalar(@$path), 4, 'append to path';
 
28
 
 
29
$path->pop_back;
 
30
is scalar(@$path), 3, 'pop_back from path';
 
31
 
 
32
ok $path->first_point->coincides_with($path->polyline->[0]), 'first_point';
 
33
 
 
34
$path = $path->clone;
 
35
 
 
36
is $path->role, Slic3r::ExtrusionPath::EXTR_ROLE_EXTERNAL_PERIMETER, 'role';
 
37
$path->role(Slic3r::ExtrusionPath::EXTR_ROLE_FILL);
 
38
is $path->role, Slic3r::ExtrusionPath::EXTR_ROLE_FILL, 'modify role';
 
39
 
 
40
__END__