diff --git a/src/Cells.jl b/src/Cells.jl index de5ed57..d015a08 100644 --- a/src/Cells.jl +++ b/src/Cells.jl @@ -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)) diff --git a/test/runtests.jl b/test/runtests.jl index 2eb729d..bd71fc5 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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") @@ -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