@@ -17,6 +17,14 @@ defmodule Scenic.PrimitivesTest do
17
17
# import IEx
18
18
19
19
# ============================================================================
20
+ test "arc adds to a graph - default opts" do
21
+ g = Primitives . arc ( @ graph , { 0 , 1 , 20 } )
22
+ p = g . primitives [ 1 ]
23
+
24
+ assert p . module == Scenic.Primitive.Arc
25
+ assert p . data == { 0 , 1 , 20 }
26
+ end
27
+
20
28
test "arc adds to a graph" do
21
29
p =
22
30
Primitives . arc ( @ graph , { 0 , 1 , 20 } , id: :arc )
@@ -38,6 +46,14 @@ defmodule Scenic.PrimitivesTest do
38
46
end
39
47
40
48
# ============================================================================
49
+ test "circle adds to a graph - default opts" do
50
+ g = Primitives . circle ( @ graph , 20 )
51
+ p = g . primitives [ 1 ]
52
+
53
+ assert p . module == Scenic.Primitive.Circle
54
+ assert p . data == 20
55
+ end
56
+
41
57
test "circle adds to a graph" do
42
58
p =
43
59
Primitives . circle ( @ graph , 20 , id: :circle )
@@ -59,6 +75,14 @@ defmodule Scenic.PrimitivesTest do
59
75
end
60
76
61
77
# ============================================================================
78
+ test "ellipse adds to a graph - default opts" do
79
+ g = Primitives . ellipse ( @ graph , { 20 , 30 } )
80
+ p = g . primitives [ 1 ]
81
+
82
+ assert p . module == Scenic.Primitive.Ellipse
83
+ assert p . data == { 20 , 30 }
84
+ end
85
+
62
86
test "ellipse adds to a graph" do
63
87
p =
64
88
Primitives . ellipse ( @ graph , { 20 , 30 } , id: :ellipse )
@@ -80,6 +104,14 @@ defmodule Scenic.PrimitivesTest do
80
104
end
81
105
82
106
# ============================================================================
107
+ test "group adds to a graph - default opts" do
108
+ g = Primitives . group ( @ graph , fn g -> g end )
109
+ p = g . primitives [ 1 ]
110
+
111
+ assert p . module == Scenic.Primitive.Group
112
+ assert p . data == [ ]
113
+ end
114
+
83
115
test "group adds to a graph" do
84
116
p =
85
117
Primitives . group ( @ graph , fn g -> g end , id: :group )
@@ -102,6 +134,14 @@ defmodule Scenic.PrimitivesTest do
102
134
# end
103
135
104
136
# ============================================================================
137
+ test "line adds to a graph - default opts" do
138
+ g = Primitives . line ( @ graph , { { 0 , 0 } , { 10 , 100 } } )
139
+ p = g . primitives [ 1 ]
140
+
141
+ assert p . module == Scenic.Primitive.Line
142
+ assert p . data == { { 0 , 0 } , { 10 , 100 } }
143
+ end
144
+
105
145
test "line adds to a graph" do
106
146
p =
107
147
Primitives . line ( @ graph , { { 0 , 0 } , { 10 , 100 } } , id: :line )
@@ -123,6 +163,14 @@ defmodule Scenic.PrimitivesTest do
123
163
end
124
164
125
165
# ============================================================================
166
+ test "path adds to a graph - default opts" do
167
+ g = Primitives . path ( @ graph , [ ] )
168
+ p = g . primitives [ 1 ]
169
+
170
+ assert p . module == Scenic.Primitive.Path
171
+ assert p . data == [ ]
172
+ end
173
+
126
174
test "path adds empty list to the graph" do
127
175
actions = [ ]
128
176
@@ -175,6 +223,14 @@ defmodule Scenic.PrimitivesTest do
175
223
end
176
224
177
225
# ============================================================================
226
+ test "quad adds to a graph - default opts" do
227
+ g = Primitives . quad ( @ graph , { { 1 , 2 } , { 3 , 4 } , { 3 , 10 } , { 2 , 8 } } )
228
+ p = g . primitives [ 1 ]
229
+
230
+ assert p . module == Scenic.Primitive.Quad
231
+ assert p . data == { { 1 , 2 } , { 3 , 4 } , { 3 , 10 } , { 2 , 8 } }
232
+ end
233
+
178
234
test "quad adds to a graph" do
179
235
p =
180
236
Primitives . quad ( @ graph , { { 1 , 2 } , { 3 , 4 } , { 3 , 10 } , { 2 , 8 } } , id: :quad )
@@ -196,6 +252,14 @@ defmodule Scenic.PrimitivesTest do
196
252
end
197
253
198
254
# ============================================================================
255
+ test "rect adds to a graph - default opts" do
256
+ g = Primitives . rect ( @ graph , { 200 , 100 } )
257
+ p = g . primitives [ 1 ]
258
+
259
+ assert p . module == Scenic.Primitive.Rectangle
260
+ assert p . data == { 200 , 100 }
261
+ end
262
+
199
263
test "rect adds to a graph" do
200
264
p =
201
265
Primitives . rect ( @ graph , { 200 , 100 } , id: :rect )
@@ -217,6 +281,14 @@ defmodule Scenic.PrimitivesTest do
217
281
end
218
282
219
283
# ============================================================================
284
+ test "rectangle adds to a graph - default opts" do
285
+ g = Primitives . rectangle ( @ graph , { 200 , 100 } )
286
+ p = g . primitives [ 1 ]
287
+
288
+ assert p . module == Scenic.Primitive.Rectangle
289
+ assert p . data == { 200 , 100 }
290
+ end
291
+
220
292
test "rectangle adds to a graph" do
221
293
p =
222
294
Primitives . rectangle ( @ graph , { 200 , 100 } , id: :rectangle )
@@ -238,6 +310,14 @@ defmodule Scenic.PrimitivesTest do
238
310
end
239
311
240
312
# ============================================================================
313
+ test "rrect adds to a graph - default opts" do
314
+ g = Primitives . rrect ( @ graph , { 200 , 100 , 5 } )
315
+ p = g . primitives [ 1 ]
316
+
317
+ assert p . module == Scenic.Primitive.RoundedRectangle
318
+ assert p . data == { 200 , 100 , 5 }
319
+ end
320
+
241
321
test "rrect adds to a graph" do
242
322
p =
243
323
Primitives . rrect ( @ graph , { 200 , 100 , 5 } , id: :rrect )
@@ -259,6 +339,14 @@ defmodule Scenic.PrimitivesTest do
259
339
end
260
340
261
341
# ============================================================================
342
+ test "rounded_rectangle adds to a graph - default opts" do
343
+ g = Primitives . rounded_rectangle ( @ graph , { 200 , 100 , 5 } )
344
+ p = g . primitives [ 1 ]
345
+
346
+ assert p . module == Scenic.Primitive.RoundedRectangle
347
+ assert p . data == { 200 , 100 , 5 }
348
+ end
349
+
262
350
test "rounded_rectangle adds to a graph" do
263
351
p =
264
352
Primitives . rounded_rectangle ( @ graph , { 200 , 100 , 5 } , id: :rounded_rectangle )
@@ -280,6 +368,16 @@ defmodule Scenic.PrimitivesTest do
280
368
end
281
369
282
370
# ============================================================================
371
+ test "scene_ref adds to a graph - default opts" do
372
+ key = { :graph , make_ref ( ) , 123 }
373
+
374
+ g = Primitives . scene_ref ( @ graph , key )
375
+ p = g . primitives [ 1 ]
376
+
377
+ assert p . module == Scenic.Primitive.SceneRef
378
+ assert p . data == key
379
+ end
380
+
283
381
test "scene_ref adds graph key reference to a graph" do
284
382
key = { :graph , make_ref ( ) , 123 }
285
383
@@ -353,6 +451,14 @@ defmodule Scenic.PrimitivesTest do
353
451
end
354
452
355
453
# ============================================================================
454
+ test "sector adds to a graph - default opts" do
455
+ g = Primitives . sector ( @ graph , { 0 , 1 , 20 } )
456
+ p = g . primitives [ 1 ]
457
+
458
+ assert p . module == Scenic.Primitive.Sector
459
+ assert p . data == { 0 , 1 , 20 }
460
+ end
461
+
356
462
test "sector adds to a graph" do
357
463
p =
358
464
Primitives . sector ( @ graph , { 0 , 1 , 20 } , id: :sector )
@@ -374,6 +480,14 @@ defmodule Scenic.PrimitivesTest do
374
480
end
375
481
376
482
# ============================================================================
483
+ test "text adds to a graph - default opts" do
484
+ g = Primitives . text ( @ graph , "test text" )
485
+ p = g . primitives [ 1 ]
486
+
487
+ assert p . module == Scenic.Primitive.Text
488
+ assert p . data == "test text"
489
+ end
490
+
377
491
test "text adds default to a graph" do
378
492
p =
379
493
Primitives . text ( @ graph , "test text" , id: :text )
@@ -395,6 +509,14 @@ defmodule Scenic.PrimitivesTest do
395
509
end
396
510
397
511
# ============================================================================
512
+ test "triangle adds to a graph - default opts" do
513
+ g = Primitives . triangle ( @ graph , { { 0 , 0 } , { 10 , 100 } , { 100 , 40 } } )
514
+ p = g . primitives [ 1 ]
515
+
516
+ assert p . module == Scenic.Primitive.Triangle
517
+ assert p . data == { { 0 , 0 } , { 10 , 100 } , { 100 , 40 } }
518
+ end
519
+
398
520
test "triangle adds to a graph" do
399
521
p =
400
522
Primitives . triangle ( @ graph , { { 0 , 0 } , { 10 , 100 } , { 100 , 40 } } , id: :triangle )
0 commit comments