Skip to content

Commit

Permalink
0.0 -> +0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
crertel committed May 5, 2024
1 parent 32bf72d commit 4f94341
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 29 deletions.
16 changes: 8 additions & 8 deletions test/scenic/color_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ defmodule Scenic.ColorTest do

assert Color.to_hsv(0) == {:color_hsv, {0, 0, 0}}

{:color_hsv, {0.0, 0.0, v}} = Color.to_hsv(128)
{:color_hsv, {+0.0, +0.0, v}} = Color.to_hsv(128)
assert v > 50 && v < 51

{:color_hsv, {0.0, 0.0, v}} = Color.to_hsv({128, 200})
{:color_hsv, {+0.0, +0.0, v}} = Color.to_hsv({128, 200})
assert v > 50 && v < 51

assert Color.to_hsv(:bisque) |> Color.to_rgb() == rgb
Expand All @@ -130,10 +130,10 @@ defmodule Scenic.ColorTest do
hsl = Color.to_hsl(:bisque)
rgb = Color.to_rgb(:bisque)

{:color_hsv, {0.0, 0.0, v}} = Color.to_hsv({:color_g, 128})
{:color_hsv, {+0.0, +0.0, v}} = Color.to_hsv({:color_g, 128})
assert v > 50 && v < 51

{:color_hsv, {0.0, 0.0, v}} = Color.to_hsv({:color_ga, {128, 200}})
{:color_hsv, {+0.0, +0.0, v}} = Color.to_hsv({:color_ga, {128, 200}})
assert v > 50 && v < 51

assert Color.to_hsv(rgb) |> Color.to_rgb() == rgb
Expand All @@ -148,10 +148,10 @@ defmodule Scenic.ColorTest do

assert Color.to_hsl(0) == {:color_hsl, {0, 0, 0}}

{:color_hsl, {0.0, 0.0, l}} = Color.to_hsl(128)
{:color_hsl, {+0.0, +0.0, l}} = Color.to_hsl(128)
assert l > 50 && l < 51

{:color_hsl, {0.0, 0.0, l}} = Color.to_hsl({128, 200})
{:color_hsl, {+0.0, +0.0, l}} = Color.to_hsl({128, 200})
assert l > 50 && l < 51

assert Color.to_hsl(:bisque) |> Color.to_rgb() == rgb
Expand All @@ -164,10 +164,10 @@ defmodule Scenic.ColorTest do
# from bisque
rgb = Color.to_rgb(:bisque)

{:color_hsl, {0.0, 0.0, l}} = Color.to_hsl({:color_g, 128})
{:color_hsl, {+0.0, +0.0, l}} = Color.to_hsl({:color_g, 128})
assert l > 50 && l < 51

{:color_hsl, {0.0, 0.0, l}} = Color.to_hsl({:color_ga, {128, 200}})
{:color_hsl, {+0.0, +0.0, l}} = Color.to_hsl({:color_ga, {128, 200}})
assert l > 50 && l < 51

assert Color.to_hsl({:color_rgb, {0xFF, 0xE4, 0xC4}}) |> Color.to_rgb() == rgb
Expand Down
4 changes: 2 additions & 2 deletions test/scenic/component/button_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ defmodule Scenic.Component.ButtonTest do
Graph.build()
|> Scenic.Components.button("Test Button")

{0.0, 0.0, r, b} = Graph.bounds(graph)
{+0.0, +0.0, r, b} = Graph.bounds(graph)
assert r > 140 && r < 141
assert b > 38 && b < 39
end
Expand All @@ -133,6 +133,6 @@ defmodule Scenic.Component.ButtonTest do
Graph.build()
|> Scenic.Components.button("Test Button", width: 200, height: 100)

assert Graph.bounds(graph) == {0.0, 0.0, 200.0, 100.0}
assert Graph.bounds(graph) == {+0.0, +0.0, 200.0, 100.0}
end
end
2 changes: 1 addition & 1 deletion test/scenic/component/input/checkbox_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ defmodule Scenic.Component.Input.CheckboxTest do
Graph.build()
|> Scenic.Components.checkbox({"Test Checkbox", false})

{0.0, 0.0, r, b} = Graph.bounds(graph)
{+0.0, +0.0, r, b} = Graph.bounds(graph)
assert r > 157 && r < 158
assert b > 23 && b < 24
end
Expand Down
2 changes: 1 addition & 1 deletion test/scenic/component/input/dropdown_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ defmodule Scenic.Component.Input.DropdownTest do
Graph.build()
|> Scenic.Components.dropdown({[{"Option One", 1}, {"Option Two", 2}], 2}, id: :dd)

{0.0, 0.0, r, b} = Graph.bounds(graph)
{+0.0, +0.0, r, b} = Graph.bounds(graph)
assert r > 157 && r < 158
assert b > 38 && b < 39
end
Expand Down
2 changes: 1 addition & 1 deletion test/scenic/component/input/radio_button_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ defmodule Scenic.Component.Input.RadioButtonTest do
Scenic.Graph.build()
|> RadioButton.add_to_graph({"Radio Button", :rb, false}, id: :btn)

{0.0, 0.0, r, b} = Scenic.Graph.bounds(graph)
{+0.0, +0.0, r, b} = Scenic.Graph.bounds(graph)
assert r > 140 && r < 141
assert b > 23 && b < 24
end
Expand Down
2 changes: 1 addition & 1 deletion test/scenic/component/input/radio_group_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ defmodule Scenic.Component.Input.RadioGroupTest do
id: :rg
)

{0.0, 0.0, r, 72.0} = Scenic.Graph.bounds(graph)
{+0.0, +0.0, r, 72.0} = Scenic.Graph.bounds(graph)
assert r > 94 && r < 95
end
end
4 changes: 2 additions & 2 deletions test/scenic/component/input/slider_list_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ defmodule Scenic.Component.Input.SliderListTest do
Scenic.Graph.build()
|> Scenic.Components.slider({[:a, :b, :c, :d, :e], :b}, id: :sl)

{0.0, 0.0, 300.0, 18.0} = Scenic.Graph.bounds(graph)
{+0.0, +0.0, 300.0, 18.0} = Scenic.Graph.bounds(graph)
end

test "bounds works with overrides" do
graph =
Graph.build()
|> Scenic.Components.slider({[:a, :b, :c, :d, :e], :b}, id: :sl, width: 400)

assert Graph.bounds(graph) == {0.0, 0.0, 400.0, 18.0}
assert Graph.bounds(graph) == {+0.0, +0.0, 400.0, 18.0}
end
end
4 changes: 2 additions & 2 deletions test/scenic/component/input/slider_numeric_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ defmodule Scenic.Component.Input.SliderNumericTest do
Scenic.Graph.build()
|> Scenic.Components.slider({{0, 100}, 20}, id: :sn)

{0.0, 0.0, 300.0, 18.0} = Scenic.Graph.bounds(graph)
{+0.0, +0.0, 300.0, 18.0} = Scenic.Graph.bounds(graph)
end

test "bounds works with overrides" do
graph =
Graph.build()
|> Scenic.Components.slider({{0, 100}, 20}, id: :sn, width: 400)

assert Graph.bounds(graph) == {0.0, 0.0, 400.0, 18.0}
assert Graph.bounds(graph) == {+0.0, +0.0, 400.0, 18.0}
end
end
4 changes: 2 additions & 2 deletions test/scenic/component/input/text_field_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,14 @@ defmodule Scenic.Component.Input.TextFieldTest do
Graph.build()
|> Scenic.Components.text_field("Test Field")

{0.0, 0.0, 288.0, 30.0} = Graph.bounds(graph)
{+0.0, +0.0, 288.0, 30.0} = Graph.bounds(graph)
end

test "bounds works with overrides" do
graph =
Graph.build()
|> Scenic.Components.text_field("Test Field", width: 300, height: 40)

{0.0, 0.0, 300.0, 40.0} = Graph.bounds(graph)
{+0.0, +0.0, 300.0, 40.0} = Graph.bounds(graph)
end
end
2 changes: 1 addition & 1 deletion test/scenic/component/input/toggle_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ defmodule Scenic.Component.Input.ToggleTest do
Graph.build()
|> Scenic.Components.toggle(true)

{0.0, 0.0, 40.0, 24.0} = Graph.bounds(graph)
{+0.0, +0.0, 40.0, 24.0} = Graph.bounds(graph)
end
end
10 changes: 4 additions & 6 deletions test/scenic/graph/bounds_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ defmodule Scenic.Graph.BoundsTest do

alias Scenic.Graph

# import IEx

import Scenic.Primitives

defmodule ComponentBounds do
Expand All @@ -28,7 +26,7 @@ defmodule Scenic.Graph.BoundsTest do

test "finds the natural bounds of an arc" do
graph = Graph.build() |> arc({100, 1.2})
{l, 0.0, 100.0, b} = Graph.bounds(graph)
{l, +0.0, 100.0, b} = Graph.bounds(graph)
assert l > 36 && l < 37
assert b > 93 && b < 94
end
Expand Down Expand Up @@ -150,7 +148,7 @@ defmodule Scenic.Graph.BoundsTest do

test "finds the natural bounds of a sector" do
graph = Graph.build() |> sector({100, 1.2})
{0.0, 0.0, 100.0, b} = Graph.bounds(graph)
{+0.0, +0.0, 100.0, b} = Graph.bounds(graph)
assert b > 93 && b < 94
end

Expand Down Expand Up @@ -183,7 +181,7 @@ defmodule Scenic.Graph.BoundsTest do
)
|> text("This is a test")

{0.0, 0.0, w, h} = Graph.bounds(graph)
{+0.0, +0.0, w, h} = Graph.bounds(graph)
assert w > 168 && w < 169
assert h > 26 && h < 27
end
Expand All @@ -199,7 +197,7 @@ defmodule Scenic.Graph.BoundsTest do
)
|> text("This is a test\nMulti line")

{0.0, 0.0, w, h} = Graph.bounds(graph)
{+0.0, +0.0, w, h} = Graph.bounds(graph)

assert w > 168 && w < 169
assert h > 58 && h < 59
Expand Down
4 changes: 2 additions & 2 deletions test/scenic/graph/compiler_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,12 @@ defmodule Scenic.Graph.CompilerTest do
assert [
{:fill_color, {:color_rgba, {255, 255, 0, 255}}},
:push_state,
{:transform, {7.0, 0.0, 0.0, 8.0, -20.0, -50.0}},
{:transform, {7.0, +0.0, +0.0, 8.0, -20.0, -50.0}},
{:stroke_width, 3},
{:stroke_color, {:color_rgba, {128, 0, 128, 255}}},
{:draw_rect, {10, 20, :fill_stroke}},
:pop_push_state,
{:transform, {7.0, 0.0, 0.0, 8.0, -50.0, -50.0}},
{:transform, {7.0, +0.0, +0.0, 8.0, -50.0, -50.0}},
{:stroke_width, 3},
{:stroke_color, {:color_rgba, {128, 0, 128, 255}}},
{:draw_circle, {10, :fill_stroke}},
Expand Down

0 comments on commit 4f94341

Please sign in to comment.