Skip to content

Commit

Permalink
CellArray flatten fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkeller34 committed Sep 29, 2016
1 parent da55aaf commit ec767f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Cells.jl
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ function flatten(c::CellArray)
sgn*c.mag*sin(c.rot) c.mag*cos(c.rot)])
for i in 1:c.row, j in 1:c.col
pt = (i-1) * c.deltarow + (j-1) * c.deltacol
append!(polys, a.(flatten(c.cell)))
append!(polys, a.(flatten(c.cell) .+ pt))
# append!(polys, a.(c.cell.elements .+ pt))
# for r in c.cell.refs
# append!(polys, a.(flatten(r) .+ pt))
Expand Down
9 changes: 8 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ end
@test bounds(c′) (bounds(c) + Point(10.0,10.0))
@test bounds(c2ref′) (bounds(c2ref) + Point(10.,10.))

# Test `flatten!` when encountering a CellReference
flatten!(c)
@test bounds(c) == bounds(c2ref)

# More setup
c = Cell("main")
c2 = Cell("rect")
Expand All @@ -317,7 +321,10 @@ end
# Test bounds with cell arrays
@test bounds(c) == Rectangle(95,95)

# TODO: Tests for `flatten`
# Test `flatten!` when encountering a CellArray
flatten!(c)
@test bounds(c) == Rectangle(95,95)

end

@testset "Paths" begin
Expand Down

0 comments on commit ec767f6

Please sign in to comment.