@@ -255,21 +255,25 @@ defmodule Scenic.Utilities.TextureTest do
255
255
tex = Texture . clear! ( tex , 4 )
256
256
assert Texture . get ( tex , 1 , 1 ) == 4
257
257
assert Texture . get ( tex , 1 , 2 ) == 4
258
+ assert Texture . get ( tex , 10 , 12 ) == 4
258
259
end
259
260
260
261
test "clear! works with g textures uses black by default" do
261
262
tex =
262
263
Texture . build! ( :g , @ width , @ height )
263
264
|> Texture . put! ( 1 , 1 , 7 )
264
265
|> Texture . put! ( 1 , 2 , 9 )
266
+ |> Texture . put! ( 10 , 12 , 11 )
265
267
266
268
assert Texture . get ( tex , 1 , 1 ) == 7
267
269
assert Texture . get ( tex , 1 , 2 ) == 9
270
+ assert Texture . get ( tex , 10 , 12 ) == 11
268
271
assert Texture . get ( tex , 1 , 3 ) == 0
269
272
270
273
tex = Texture . clear! ( tex )
271
274
assert Texture . get ( tex , 1 , 1 ) == 0
272
275
assert Texture . get ( tex , 1 , 2 ) == 0
276
+ assert Texture . get ( tex , 10 , 12 ) == 0
273
277
assert Texture . get ( tex , 1 , 3 ) == 0
274
278
end
275
279
@@ -278,80 +282,96 @@ defmodule Scenic.Utilities.TextureTest do
278
282
Texture . build! ( :g , @ width , @ height , clear: :dark_khaki )
279
283
|> Texture . put! ( 1 , 1 , 7 )
280
284
|> Texture . put! ( 1 , 2 , 9 )
285
+ |> Texture . put! ( 10 , 12 , 11 )
281
286
282
287
assert Texture . get ( tex , 1 , 1 ) == 7
283
288
assert Texture . get ( tex , 1 , 2 ) == 9
289
+ assert Texture . get ( tex , 10 , 12 ) == 11
284
290
assert Texture . get ( tex , 1 , 3 ) == 159
285
291
286
292
tex = Texture . clear! ( tex )
287
293
assert Texture . get ( tex , 1 , 1 ) == 159
288
294
assert Texture . get ( tex , 1 , 2 ) == 159
295
+ assert Texture . get ( tex , 10 , 12 ) == 159
289
296
assert Texture . get ( tex , 1 , 3 ) == 159
290
297
end
291
298
292
299
test "clear! works with ga textures" do
293
300
{ :ok , tex } = Texture . build ( :ga , @ width , @ height , clear: { 3 , 7 } )
294
301
assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 }
295
302
assert Texture . get ( tex , 1 , 2 ) == { 3 , 7 }
303
+ assert Texture . get ( tex , 10 , 12 ) == { 3 , 7 }
296
304
297
305
tex = Texture . clear! ( tex , { 4 , 8 } )
298
306
assert Texture . get ( tex , 1 , 1 ) == { 4 , 8 }
299
307
assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 }
308
+ assert Texture . get ( tex , 10 , 12 ) == { 4 , 8 }
300
309
end
301
310
302
311
test "clear! works with ga textures uses black by default" do
303
312
tex =
304
313
Texture . build! ( :ga , @ width , @ height )
305
314
|> Texture . put! ( 1 , 1 , { 3 , 7 } )
306
315
|> Texture . put! ( 1 , 2 , { 4 , 8 } )
316
+ |> Texture . put! ( 10 , 12 , { 6 , 9 } )
307
317
308
318
assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 }
309
319
assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 }
320
+ assert Texture . get ( tex , 10 , 12 ) == { 6 , 9 }
310
321
assert Texture . get ( tex , 1 , 3 ) == { 0 , 0xFF }
311
322
312
323
tex = Texture . clear! ( tex )
313
324
assert Texture . get ( tex , 1 , 1 ) == { 0 , 0xFF }
314
325
assert Texture . get ( tex , 1 , 2 ) == { 0 , 0xFF }
326
+ assert Texture . get ( tex , 10 , 12 ) == { 0 , 0xFF }
315
327
end
316
328
317
329
test "clear! works with ga textures uses texture clear by default" do
318
330
tex =
319
331
Texture . build! ( :ga , @ width , @ height , clear: :dark_khaki )
320
332
|> Texture . put! ( 1 , 1 , { 3 , 7 } )
321
333
|> Texture . put! ( 1 , 2 , { 4 , 8 } )
334
+ |> Texture . put! ( 10 , 12 , { 6 , 9 } )
322
335
323
336
assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 }
324
337
assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 }
338
+ assert Texture . get ( tex , 10 , 12 ) == { 6 , 9 }
325
339
assert Texture . get ( tex , 1 , 3 ) == { 159 , 0xFF }
326
340
327
341
tex = Texture . clear! ( tex )
328
342
assert Texture . get ( tex , 1 , 1 ) == { 159 , 0xFF }
329
343
assert Texture . get ( tex , 1 , 2 ) == { 159 , 0xFF }
344
+ assert Texture . get ( tex , 10 , 12 ) == { 159 , 0xFF }
330
345
end
331
346
332
347
test "clear! works with rgb textures" do
333
348
{ :ok , tex } = Texture . build ( :rgb , @ width , @ height , clear: { 3 , 7 , 11 } )
334
349
assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 , 11 }
335
350
assert Texture . get ( tex , 1 , 2 ) == { 3 , 7 , 11 }
351
+ assert Texture . get ( tex , 10 , 12 ) == { 3 , 7 , 11 }
336
352
337
353
tex = Texture . clear! ( tex , { 4 , 8 , 12 } )
338
354
assert Texture . get ( tex , 1 , 1 ) == { 4 , 8 , 12 }
339
355
assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 , 12 }
356
+ assert Texture . get ( tex , 10 , 12 ) == { 4 , 8 , 12 }
340
357
end
341
358
342
359
test "clear! works with rgb textures uses black by default" do
343
360
tex =
344
361
Texture . build! ( :rgb , @ width , @ height )
345
362
|> Texture . put! ( 1 , 1 , { 3 , 7 , 11 } )
346
363
|> Texture . put! ( 1 , 2 , { 4 , 8 , 12 } )
364
+ |> Texture . put! ( 10 , 12 , { 6 , 9 , 11 } )
347
365
348
366
assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 , 11 }
349
367
assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 , 12 }
368
+ assert Texture . get ( tex , 10 , 12 ) == { 6 , 9 , 11 }
350
369
assert Texture . get ( tex , 1 , 3 ) == { 0 , 0 , 0 }
351
370
352
371
tex = Texture . clear! ( tex )
353
372
assert Texture . get ( tex , 1 , 1 ) == { 0 , 0 , 0 }
354
373
assert Texture . get ( tex , 1 , 2 ) == { 0 , 0 , 0 }
374
+ assert Texture . get ( tex , 10 , 12 ) == { 0 , 0 , 0 }
355
375
assert Texture . get ( tex , 1 , 3 ) == { 0 , 0 , 0 }
356
376
end
357
377
@@ -360,40 +380,48 @@ defmodule Scenic.Utilities.TextureTest do
360
380
Texture . build! ( :rgb , @ width , @ height , clear: :dark_khaki )
361
381
|> Texture . put! ( 1 , 1 , { 3 , 7 , 11 } )
362
382
|> Texture . put! ( 1 , 2 , { 4 , 8 , 12 } )
383
+ |> Texture . put! ( 10 , 12 , { 6 , 9 , 11 } )
363
384
364
385
assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 , 11 }
365
386
assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 , 12 }
387
+ assert Texture . get ( tex , 10 , 12 ) == { 6 , 9 , 11 }
366
388
assert Texture . get ( tex , 1 , 3 ) == { 189 , 183 , 107 }
367
389
368
390
tex = Texture . clear! ( tex )
369
391
assert Texture . get ( tex , 1 , 1 ) == { 189 , 183 , 107 }
370
392
assert Texture . get ( tex , 1 , 2 ) == { 189 , 183 , 107 }
393
+ assert Texture . get ( tex , 10 , 12 ) == { 189 , 183 , 107 }
371
394
assert Texture . get ( tex , 1 , 3 ) == { 189 , 183 , 107 }
372
395
end
373
396
374
397
test "clear! works with rgba textures" do
375
398
{ :ok , tex } = Texture . build ( :rgba , @ width , @ height , clear: { 3 , 7 , 11 , 13 } )
376
399
assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 , 11 , 13 }
377
400
assert Texture . get ( tex , 1 , 2 ) == { 3 , 7 , 11 , 13 }
401
+ assert Texture . get ( tex , 10 , 12 ) == { 3 , 7 , 11 , 13 }
378
402
379
403
tex = Texture . clear! ( tex , { 4 , 8 , 12 , 14 } )
380
404
assert Texture . get ( tex , 1 , 1 ) == { 4 , 8 , 12 , 14 }
381
405
assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 , 12 , 14 }
406
+ assert Texture . get ( tex , 10 , 12 ) == { 4 , 8 , 12 , 14 }
382
407
end
383
408
384
409
test "clear! works with rgba textures uses black by default" do
385
410
tex =
386
411
Texture . build! ( :rgba , @ width , @ height )
387
412
|> Texture . put! ( 1 , 1 , { 3 , 7 , 11 , 13 } )
388
413
|> Texture . put! ( 1 , 2 , { 4 , 8 , 12 , 14 } )
414
+ |> Texture . put! ( 10 , 12 , { 6 , 9 , 11 , 13 } )
389
415
390
416
assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 , 11 , 13 }
391
417
assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 , 12 , 14 }
418
+ assert Texture . get ( tex , 10 , 12 ) == { 6 , 9 , 11 , 13 }
392
419
assert Texture . get ( tex , 1 , 3 ) == { 0 , 0 , 0 , 0xFF }
393
420
394
421
tex = Texture . clear! ( tex )
395
422
assert Texture . get ( tex , 1 , 1 ) == { 0 , 0 , 0 , 0xFF }
396
423
assert Texture . get ( tex , 1 , 2 ) == { 0 , 0 , 0 , 0xFF }
424
+ assert Texture . get ( tex , 10 , 12 ) == { 0 , 0 , 0 , 0xFF }
397
425
assert Texture . get ( tex , 1 , 3 ) == { 0 , 0 , 0 , 0xFF }
398
426
end
399
427
@@ -402,14 +430,17 @@ defmodule Scenic.Utilities.TextureTest do
402
430
Texture . build! ( :rgba , @ width , @ height , clear: :dark_khaki )
403
431
|> Texture . put! ( 1 , 1 , { 3 , 7 , 11 , 13 } )
404
432
|> Texture . put! ( 1 , 2 , { 4 , 8 , 12 , 14 } )
433
+ |> Texture . put! ( 10 , 12 , { 6 , 9 , 11 , 13 } )
405
434
406
435
assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 , 11 , 13 }
407
436
assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 , 12 , 14 }
437
+ assert Texture . get ( tex , 10 , 12 ) == { 6 , 9 , 11 , 13 }
408
438
assert Texture . get ( tex , 1 , 3 ) == { 189 , 183 , 107 , 255 }
409
439
410
440
tex = Texture . clear! ( tex )
411
441
assert Texture . get ( tex , 1 , 1 ) == { 189 , 183 , 107 , 255 }
412
442
assert Texture . get ( tex , 1 , 2 ) == { 189 , 183 , 107 , 255 }
443
+ assert Texture . get ( tex , 10 , 12 ) == { 189 , 183 , 107 , 255 }
413
444
assert Texture . get ( tex , 1 , 3 ) == { 189 , 183 , 107 , 255 }
414
445
end
415
446
0 commit comments