Skip to content

Commit 8bfa249

Browse files
committed
run formatter
1 parent fd76e6b commit 8bfa249

File tree

1 file changed

+38
-19
lines changed

1 file changed

+38
-19
lines changed

test/scenic/component/button_test.exs

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,72 +54,91 @@ defmodule Scenic.Component.ButtonTest do
5454

5555
test "init works with various alignments" do
5656
{:ok, state} = Button.init("Button", [])
57-
%Primitive{styles: %{text_align: :center}} = Graph.get!( state.graph, :title )
57+
%Primitive{styles: %{text_align: :center}} = Graph.get!(state.graph, :title)
5858

5959
{:ok, state} = Button.init("Button", styles: %{alignment: :left}, id: :button_id)
60-
%Primitive{styles: %{text_align: :left}} = Graph.get!( state.graph, :title )
60+
%Primitive{styles: %{text_align: :left}} = Graph.get!(state.graph, :title)
6161

6262
{:ok, state} = Button.init("Button", styles: %{alignment: :center}, id: :button_id)
63-
%Primitive{styles: %{text_align: :center}} = Graph.get!( state.graph, :title )
63+
%Primitive{styles: %{text_align: :center}} = Graph.get!(state.graph, :title)
6464

6565
{:ok, state} = Button.init("Button", styles: %{alignment: :right}, id: :button_id)
66-
%Primitive{styles: %{text_align: :right}} = Graph.get!( state.graph, :title )
66+
%Primitive{styles: %{text_align: :right}} = Graph.get!(state.graph, :title)
6767
end
6868

6969
# ============================================================================
7070
# handle_input
7171

7272
test "handle_input {:cursor_enter, _uid} sets contained" do
73-
{:noreply, state} = Button.handle_input( {:cursor_enter, 1}, %{}, %{@state | pressed: true} )
73+
{:noreply, state} = Button.handle_input({:cursor_enter, 1}, %{}, %{@state | pressed: true})
7474
assert state.contained
7575
# confirm the graph was pushed
76-
assert_receive( {:"$gen_cast", {:push_graph, _, _, _}} )
76+
assert_receive({:"$gen_cast", {:push_graph, _, _, _}})
7777
end
7878

7979
test "handle_input {:cursor_exit, _uid} clears contained" do
80-
{:noreply, state} = Button.handle_input( {:cursor_exit, 1}, %{}, %{@state | pressed: true} )
80+
{:noreply, state} = Button.handle_input({:cursor_exit, 1}, %{}, %{@state | pressed: true})
8181
refute state.contained
8282
# confirm the graph was pushed
83-
assert_receive( {:"$gen_cast", {:push_graph, _, _, _}} )
83+
assert_receive({:"$gen_cast", {:push_graph, _, _, _}})
8484
end
8585

8686
test "handle_input {:cursor_button, :press" do
8787
context = %ViewPort.Context{viewport: self()}
88-
{:noreply, state} = Button.handle_input( {:cursor_button, {:left, :press, nil, nil}}, context, %{@state | pressed: false, contained: true} )
88+
89+
{:noreply, state} =
90+
Button.handle_input({:cursor_button, {:left, :press, nil, nil}}, context, %{
91+
@state
92+
| pressed: false,
93+
contained: true
94+
})
95+
8996
assert state.pressed
9097

9198
# confirm the input was captured
92-
assert_receive( {:"$gen_cast", {:capture_input, ^context, [:cursor_button, :cursor_pos]}} )
99+
assert_receive({:"$gen_cast", {:capture_input, ^context, [:cursor_button, :cursor_pos]}})
93100
# confirm the graph was pushed
94-
assert_receive( {:"$gen_cast", {:push_graph, _, _, _}} )
101+
assert_receive({:"$gen_cast", {:push_graph, _, _, _}})
95102
end
96103

97104
test "handle_input {:cursor_button, :release" do
98105
context = %ViewPort.Context{viewport: self()}
99-
{:noreply, state} = Button.handle_input( {:cursor_button, {:left, :release, nil, nil}}, context, %{@state | pressed: true, contained: true} )
106+
107+
{:noreply, state} =
108+
Button.handle_input({:cursor_button, {:left, :release, nil, nil}}, context, %{
109+
@state
110+
| pressed: true,
111+
contained: true
112+
})
113+
100114
refute state.pressed
101115

102116
# confirm the input was released
103-
assert_receive( {:"$gen_cast", {:release_input, [:cursor_button, :cursor_pos]}} )
117+
assert_receive({:"$gen_cast", {:release_input, [:cursor_button, :cursor_pos]}})
104118

105119
# confirm the graph was pushed
106-
assert_receive( {:"$gen_cast", {:push_graph, _, _, _}} )
120+
assert_receive({:"$gen_cast", {:push_graph, _, _, _}})
107121
end
108122

109-
110123
test "handle_input {:cursor_button, :release sends a message if contained" do
111124
self = self()
112125
Process.put(:parent_pid, self)
113126
context = %ViewPort.Context{viewport: self()}
114-
{:noreply, _} = Button.handle_input( {:cursor_button, {:left, :release, nil, nil}}, context, %{@state | pressed: true, contained: true} )
127+
128+
{:noreply, _} =
129+
Button.handle_input({:cursor_button, {:left, :release, nil, nil}}, context, %{
130+
@state
131+
| pressed: true,
132+
contained: true
133+
})
115134

116135
# confirm the graph was pushed
117-
assert_receive( {:"$gen_cast", {:event, {:click, :test_id}, ^self}} )
136+
assert_receive({:"$gen_cast", {:event, {:click, :test_id}, ^self}})
118137
end
119138

120139
test "handle_input does nothing on unknown input" do
121140
context = %ViewPort.Context{viewport: self()}
122-
{:noreply, state} = Button.handle_input( :unknown, context, @state )
141+
{:noreply, state} = Button.handle_input(:unknown, context, @state)
123142
assert state == @state
124143
end
125-
end
144+
end

0 commit comments

Comments
 (0)