Skip to content

Commit 69ca223

Browse files
committed
add missing tests
1 parent 252c404 commit 69ca223

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

test/scenic/graph_test.exs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ defmodule Scenic.GraphTest do
1414
alias Scenic.Primitive.Rectangle
1515
alias Scenic.Primitive.Line
1616

17-
# import IEx
17+
import IEx
1818

1919
@root_uid 0
2020

@@ -441,6 +441,25 @@ defmodule Scenic.GraphTest do
441441
# # assert Map.get(merged, :input) == [:key, :char, :cursor_down]
442442
# end
443443

444+
# ============================================================================
445+
# add
446+
447+
test "add a pre-built primitive to a graph" do
448+
p = Primitive.Line.build({{0, 0}, {2, 2}}, id: :added)
449+
graph = Graph.add(@graph_find, p)
450+
Graph.get!(graph, :added)
451+
end
452+
453+
test "add a new primitive to a graph" do
454+
count = Graph.count(@graph_find)
455+
456+
post_add_count =
457+
Graph.add(@graph_find, Primitive.Line, {{0, 0}, {2, 2}})
458+
|> Graph.count()
459+
460+
assert post_add_count > count
461+
end
462+
444463
# ============================================================================
445464
# def modify( graph, uid, action )
446465

@@ -639,4 +658,8 @@ defmodule Scenic.GraphTest do
639658
assert Map.get(graph.primitives[t1], :transforms) == @transform
640659
assert Map.get(graph.primitives[other], :transforms) == nil
641660
end
661+
662+
test "style_stack returns an empty map for invalid uid" do
663+
assert Graph.style_stack(@graph_find, 1234) == %{}
664+
end
642665
end

0 commit comments

Comments
 (0)