Skip to content

Commit 51ef12f

Browse files
committed
filling in missing tests
1 parent 0f32524 commit 51ef12f

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

test/scenic/primitive/sector_test.exs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,21 @@ defmodule Scenic.Primitive.SectorTest do
5454

5555
# ============================================================================
5656
# point containment
57-
test "contains_point? always returns false" do
57+
test "contains_point? works (clockwise)" do
5858
assert Sector.contains_point?(@data, {20, 32}) == true
5959
assert Sector.contains_point?(@data, {-20, 32}) == false
6060
assert Sector.contains_point?(@data, {30, 60}) == true
6161
assert Sector.contains_point?(@data, {130, 280}) == false
6262
end
6363

64+
test "contains_point? works (counter-clockwise)" do
65+
data = {100, 1.4, 0.0}
66+
assert Sector.contains_point?(data, {20, 32}) == true
67+
assert Sector.contains_point?(data, {-20, 32}) == false
68+
assert Sector.contains_point?(data, {30, 60}) == true
69+
assert Sector.contains_point?(data, {130, 280}) == false
70+
end
71+
6472
test "contains_point? straight up and down" do
6573
# make it big enough to catch the straight down case
6674
data = {100, 0.0, 2}

test/scenic/primitive/style/paint/color_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
defmodule Scenic.Primitive.Style.Paint.ColorTest do
2-
@moduledoc false
32
use ExUnit.Case, async: true
43

54
import Scenic.Primitive.Style.Paint.Color
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
defmodule Scenic.Primitive.Style.Paint.ImageTest do
2+
use ExUnit.Case, async: true
3+
4+
alias Scenic.Primitive.Style.Paint.Image
5+
6+
test "normalize works with just a hash_key to the image" do
7+
assert Image.normalize("hash_string") == {"hash_string", 0, 0, 0, 0, 0, 0xFF}
8+
end
9+
10+
test "normalize works with just a hash_key and alpha" do
11+
assert Image.normalize({"hash_string", 128}) == {"hash_string", 0, 0, 0, 0, 0, 128}
12+
end
13+
14+
test "normalize works with everything set" do
15+
assert Image.normalize({"hash_string", 1, 2, 3, 4, 5, 6}) ==
16+
{"hash_string", 1, 2, 3, 4, 5, 6}
17+
end
18+
19+
end

test/scenic/primitive/transform_test.exs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ defmodule Scenic.Primitive.TransformTest do
2929
matrix: @mx
3030
}
3131

32+
# ============================================================================
33+
# verify!
34+
35+
test "verify! works" do
36+
assert Transform.verify!(:pin, {1,1})
37+
end
38+
39+
test "verify! rejects invalid transform types" do
40+
assert_raise Scenic.Primitive.Transform.FormatError, fn ->
41+
assert Transform.verify!(:invalid, {1,1})
42+
end
43+
end
44+
3245
# ============================================================================
3346
# calculate the local matrix
3447

0 commit comments

Comments
 (0)