Skip to content

Commit 0f32524

Browse files
committed
clean up quad expand tests
1 parent d358a7e commit 0f32524

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

test/scenic/primitive/quad_test.exs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,18 @@ defmodule Scenic.Primitive.QuadTest do
8282
assert Quad.contains_point?(@convex, {100, 520}) == false
8383
end
8484

85-
8685
# ============================================================================
8786
# expand
8887

8988
# only works if it is square...
90-
defp quad_square_area({{x0,y0}, {x1,y1}, {x2,y2}, {x3,y3}}) do
89+
defp quad_square_area({{x0, y0}, {x1, _}, {_, y2}, _}) do
9190
w = abs(x1 - x0) * 1.0
9291
h = abs(y2 - y0) * 1.0
9392
w * h
9493
end
9594

9695
test "expand clockwise works" do
97-
quad = {{10,10}, {20,10}, {20,20}, {10,20}}
96+
quad = {{10, 10}, {20, 10}, {20, 20}, {10, 20}}
9897
expanded = Quad.expand(quad, 2)
9998
shrunk = Quad.expand(quad, -2)
10099

@@ -103,13 +102,11 @@ defmodule Scenic.Primitive.QuadTest do
103102
end
104103

105104
test "expand counter-clockwise works" do
106-
quad = {{10,20}, {20,20}, {20,10}, {10,10}}
105+
quad = {{10, 20}, {20, 20}, {20, 10}, {10, 10}}
107106
expanded = Quad.expand(quad, 2)
108107
shrunk = Quad.expand(quad, -2)
109108

110109
assert quad_square_area(expanded) > quad_square_area(quad)
111110
assert quad_square_area(shrunk) < quad_square_area(quad)
112111
end
113-
114-
115112
end

0 commit comments

Comments
 (0)