Make test happy

This commit is contained in:
Alessandro Ranellucci 2015-12-02 19:39:16 +01:00
parent 4f8a18bbad
commit 1bebe6097b
3 changed files with 4 additions and 5 deletions

View File

@ -175,7 +175,7 @@ arrange(size_t total_parts, Pointf part, coordf_t dist, const BoundingBoxf* bb)
part.y += dist; part.y += dist;
Pointf area; Pointf area;
if (bb != NULL) { if (bb != NULL && bb->defined) {
area = bb->size(); area = bb->size();
} else { } else {
// bogus area size, large enough not to trigger the error below // bogus area size, large enough not to trigger the error below
@ -278,7 +278,7 @@ arrange(size_t total_parts, Pointf part, coordf_t dist, const BoundingBoxf* bb)
positions.push_back(Pointf(cx * part.x, cy * part.y)); positions.push_back(Pointf(cx * part.x, cy * part.y));
} }
if (bb != NULL) { if (bb != NULL && bb->defined) {
for (Pointfs::iterator p = positions.begin(); p != positions.end(); ++p) { for (Pointfs::iterator p = positions.begin(); p != positions.end(); ++p) {
p->x += bb->min.x; p->x += bb->min.x;
p->y += bb->min.y; p->y += bb->min.y;

View File

@ -33,8 +33,7 @@ use constant PI => 4 * atan2(1, 1);
} }
{ {
my $positions = Slic3r::Geometry::arrange(4, Slic3r::Pointf->new(20, 20), my $positions = Slic3r::Geometry::arrange(4, Slic3r::Pointf->new(20, 20), 5);
5, Slic3r::Geometry::BoundingBoxf->new);
is scalar(@$positions), 4, 'arrange() returns expected number of positions'; is scalar(@$positions), 4, 'arrange() returns expected number of positions';
} }

View File

@ -8,7 +8,7 @@
%package{Slic3r::Geometry}; %package{Slic3r::Geometry};
Pointfs arrange(size_t total_parts, Pointf* part, coordf_t dist, BoundingBoxf* bb) Pointfs arrange(size_t total_parts, Pointf* part, coordf_t dist, BoundingBoxf* bb = NULL)
%code{% RETVAL = Slic3r::Geometry::arrange(total_parts, *part, dist, bb); %}; %code{% RETVAL = Slic3r::Geometry::arrange(total_parts, *part, dist, bb); %};
%{ %{