Skip to content

Commit 1be5f72

Browse files
committed
test Rect union, update
1 parent e544dd0 commit 1be5f72

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/geometrytypes.jl

+11
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ end
192192
@test widths(r) == Vec(-Inf, -Inf)
193193
@test area(r) == Inf
194194
@test volume(r) == Inf
195+
# TODO: broken? returns NaN widths
196+
# @test union(r, Rect2f(1,1,2,2)) == Rect2f(1,1,2,2)
197+
# @test union(Rect2f(1,1,2,2), r) == Rect2f(1,1,2,2)
198+
@test update(r, Vec2f(1,1)) == Rect2f(1,1,0,0)
195199

196200
a = Rect(Vec(0, 1), Vec(2, 3))
197201
pt_expa = Point{2,Int}[(0, 1), (2, 1), (2, 4), (0, 4)]
@@ -207,6 +211,9 @@ end
207211
@test widths(a) == Vec(2,3)
208212
@test area(a) == 2*3
209213
@test volume(a) == 2*3
214+
@test union(a, Rect2f(1,1,2,2)) == Rect2f(0,1,3,3)
215+
@test union(Rect2f(1,1,2,2), a) == Rect2f(0,1,3,3)
216+
@test update(a, Vec2f(0,0)) == Rect2f(0,0,2,4)
210217

211218
b = Rect(Vec(1, 2, 3), Vec(4, 5, 6))
212219
pt_expb = Point{3, Int64}[[1, 2, 3], [1, 2, 9], [1, 7, 3], [1, 7, 9],
@@ -221,6 +228,10 @@ end
221228
@test widths(b) == Vec(4,5,6)
222229
@test_throws MethodError area(b)
223230
@test volume(b) == 4*5*6
231+
@test union(b, Rect3f(1,1,1,2,2,2)) == Rect3f(1,1,1, 4,6,8)
232+
@test union(Rect3f(1,1,1,2,2,2), b) == Rect3f(1,1,1, 4,6,8)
233+
@test update(b, Vec3f(0)) == Rect3f(0,0,0,5,7,9)
234+
224235

225236
mesh = normal_mesh(b)
226237
@test faces(mesh) == GLTriangleFace[

0 commit comments

Comments
 (0)