@@ -70,13 +70,12 @@ defmodule Mudbrick.DrawingTest do
70
70
import Path
71
71
72
72
assert [ ] =
73
- output ( fn ->
73
+ operations ( fn ->
74
74
new ( )
75
75
end )
76
- |> operations ( )
77
76
end
78
77
79
- test "can fill a rectangle" do
78
+ test "can render a rectangle" do
80
79
import Path
81
80
82
81
assert [
@@ -85,11 +84,10 @@ defmodule Mudbrick.DrawingTest do
85
84
"0 0 50 75 re" ,
86
85
"S"
87
86
] =
88
- output ( fn ->
87
+ operations ( fn ->
89
88
new ( )
90
89
|> rectangle ( lower_left: { 0 , 0 } , dimensions: { 50 , 75 } )
91
90
end )
92
- |> operations ( )
93
91
end
94
92
95
93
test "can draw one path" do
@@ -102,11 +100,10 @@ defmodule Mudbrick.DrawingTest do
102
100
"460 750 l" ,
103
101
"S"
104
102
] =
105
- output ( fn ->
103
+ operations ( fn ->
106
104
new ( )
107
105
|> straight_line ( from: { 0 , 650 } , to: { 460 , 750 } )
108
106
end )
109
- |> operations ( )
110
107
end
111
108
112
109
test "can choose line width" do
@@ -119,11 +116,10 @@ defmodule Mudbrick.DrawingTest do
119
116
"460 750 l" ,
120
117
"S"
121
118
] =
122
- output ( fn ->
119
+ operations ( fn ->
123
120
new ( )
124
121
|> straight_line ( from: { 0 , 650 } , to: { 460 , 750 } , line_width: 4.0 )
125
122
end )
126
- |> operations ( )
127
123
end
128
124
129
125
test "can choose colour" do
@@ -136,11 +132,10 @@ defmodule Mudbrick.DrawingTest do
136
132
"460 750 l" ,
137
133
"S"
138
134
] =
139
- output ( fn ->
135
+ operations ( fn ->
140
136
new ( )
141
137
|> straight_line ( from: { 0 , 650 } , to: { 460 , 750 } , colour: { 0 , 1 , 0 } )
142
138
end )
143
- |> operations ( )
144
139
end
145
140
146
141
property "it's an error to set a colour above 1" do
@@ -158,9 +153,9 @@ defmodule Mudbrick.DrawingTest do
158
153
end
159
154
end
160
155
161
- defp output ( f ) , do: output ( fn _ -> f . ( ) end , Mudbrick.Path.Output )
162
-
163
- defp operations ( ops ) do
164
- Enum . map ( ops , & Mudbrick.TestHelper . show / 1 ) |> Enum . reverse ( )
156
+ defp operations ( f ) do
157
+ output ( fn _ -> f . ( ) end , Mudbrick.Path.Output )
158
+ |> Enum . map ( & Mudbrick.TestHelper . show / 1 )
159
+ |> Enum . reverse ( )
165
160
end
166
161
end
0 commit comments