@@ -255,21 +255,25 @@ defmodule Scenic.Utilities.TextureTest do
255255 tex = Texture . clear! ( tex , 4 )
256256 assert Texture . get ( tex , 1 , 1 ) == 4
257257 assert Texture . get ( tex , 1 , 2 ) == 4
258+ assert Texture . get ( tex , 10 , 12 ) == 4
258259 end
259260
260261 test "clear! works with g textures uses black by default" do
261262 tex =
262263 Texture . build! ( :g , @ width , @ height )
263264 |> Texture . put! ( 1 , 1 , 7 )
264265 |> Texture . put! ( 1 , 2 , 9 )
266+ |> Texture . put! ( 10 , 12 , 11 )
265267
266268 assert Texture . get ( tex , 1 , 1 ) == 7
267269 assert Texture . get ( tex , 1 , 2 ) == 9
270+ assert Texture . get ( tex , 10 , 12 ) == 11
268271 assert Texture . get ( tex , 1 , 3 ) == 0
269272
270273 tex = Texture . clear! ( tex )
271274 assert Texture . get ( tex , 1 , 1 ) == 0
272275 assert Texture . get ( tex , 1 , 2 ) == 0
276+ assert Texture . get ( tex , 10 , 12 ) == 0
273277 assert Texture . get ( tex , 1 , 3 ) == 0
274278 end
275279
@@ -278,80 +282,96 @@ defmodule Scenic.Utilities.TextureTest do
278282 Texture . build! ( :g , @ width , @ height , clear: :dark_khaki )
279283 |> Texture . put! ( 1 , 1 , 7 )
280284 |> Texture . put! ( 1 , 2 , 9 )
285+ |> Texture . put! ( 10 , 12 , 11 )
281286
282287 assert Texture . get ( tex , 1 , 1 ) == 7
283288 assert Texture . get ( tex , 1 , 2 ) == 9
289+ assert Texture . get ( tex , 10 , 12 ) == 11
284290 assert Texture . get ( tex , 1 , 3 ) == 159
285291
286292 tex = Texture . clear! ( tex )
287293 assert Texture . get ( tex , 1 , 1 ) == 159
288294 assert Texture . get ( tex , 1 , 2 ) == 159
295+ assert Texture . get ( tex , 10 , 12 ) == 159
289296 assert Texture . get ( tex , 1 , 3 ) == 159
290297 end
291298
292299 test "clear! works with ga textures" do
293300 { :ok , tex } = Texture . build ( :ga , @ width , @ height , clear: { 3 , 7 } )
294301 assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 }
295302 assert Texture . get ( tex , 1 , 2 ) == { 3 , 7 }
303+ assert Texture . get ( tex , 10 , 12 ) == { 3 , 7 }
296304
297305 tex = Texture . clear! ( tex , { 4 , 8 } )
298306 assert Texture . get ( tex , 1 , 1 ) == { 4 , 8 }
299307 assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 }
308+ assert Texture . get ( tex , 10 , 12 ) == { 4 , 8 }
300309 end
301310
302311 test "clear! works with ga textures uses black by default" do
303312 tex =
304313 Texture . build! ( :ga , @ width , @ height )
305314 |> Texture . put! ( 1 , 1 , { 3 , 7 } )
306315 |> Texture . put! ( 1 , 2 , { 4 , 8 } )
316+ |> Texture . put! ( 10 , 12 , { 6 , 9 } )
307317
308318 assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 }
309319 assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 }
320+ assert Texture . get ( tex , 10 , 12 ) == { 6 , 9 }
310321 assert Texture . get ( tex , 1 , 3 ) == { 0 , 0xFF }
311322
312323 tex = Texture . clear! ( tex )
313324 assert Texture . get ( tex , 1 , 1 ) == { 0 , 0xFF }
314325 assert Texture . get ( tex , 1 , 2 ) == { 0 , 0xFF }
326+ assert Texture . get ( tex , 10 , 12 ) == { 0 , 0xFF }
315327 end
316328
317329 test "clear! works with ga textures uses texture clear by default" do
318330 tex =
319331 Texture . build! ( :ga , @ width , @ height , clear: :dark_khaki )
320332 |> Texture . put! ( 1 , 1 , { 3 , 7 } )
321333 |> Texture . put! ( 1 , 2 , { 4 , 8 } )
334+ |> Texture . put! ( 10 , 12 , { 6 , 9 } )
322335
323336 assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 }
324337 assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 }
338+ assert Texture . get ( tex , 10 , 12 ) == { 6 , 9 }
325339 assert Texture . get ( tex , 1 , 3 ) == { 159 , 0xFF }
326340
327341 tex = Texture . clear! ( tex )
328342 assert Texture . get ( tex , 1 , 1 ) == { 159 , 0xFF }
329343 assert Texture . get ( tex , 1 , 2 ) == { 159 , 0xFF }
344+ assert Texture . get ( tex , 10 , 12 ) == { 159 , 0xFF }
330345 end
331346
332347 test "clear! works with rgb textures" do
333348 { :ok , tex } = Texture . build ( :rgb , @ width , @ height , clear: { 3 , 7 , 11 } )
334349 assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 , 11 }
335350 assert Texture . get ( tex , 1 , 2 ) == { 3 , 7 , 11 }
351+ assert Texture . get ( tex , 10 , 12 ) == { 3 , 7 , 11 }
336352
337353 tex = Texture . clear! ( tex , { 4 , 8 , 12 } )
338354 assert Texture . get ( tex , 1 , 1 ) == { 4 , 8 , 12 }
339355 assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 , 12 }
356+ assert Texture . get ( tex , 10 , 12 ) == { 4 , 8 , 12 }
340357 end
341358
342359 test "clear! works with rgb textures uses black by default" do
343360 tex =
344361 Texture . build! ( :rgb , @ width , @ height )
345362 |> Texture . put! ( 1 , 1 , { 3 , 7 , 11 } )
346363 |> Texture . put! ( 1 , 2 , { 4 , 8 , 12 } )
364+ |> Texture . put! ( 10 , 12 , { 6 , 9 , 11 } )
347365
348366 assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 , 11 }
349367 assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 , 12 }
368+ assert Texture . get ( tex , 10 , 12 ) == { 6 , 9 , 11 }
350369 assert Texture . get ( tex , 1 , 3 ) == { 0 , 0 , 0 }
351370
352371 tex = Texture . clear! ( tex )
353372 assert Texture . get ( tex , 1 , 1 ) == { 0 , 0 , 0 }
354373 assert Texture . get ( tex , 1 , 2 ) == { 0 , 0 , 0 }
374+ assert Texture . get ( tex , 10 , 12 ) == { 0 , 0 , 0 }
355375 assert Texture . get ( tex , 1 , 3 ) == { 0 , 0 , 0 }
356376 end
357377
@@ -360,40 +380,48 @@ defmodule Scenic.Utilities.TextureTest do
360380 Texture . build! ( :rgb , @ width , @ height , clear: :dark_khaki )
361381 |> Texture . put! ( 1 , 1 , { 3 , 7 , 11 } )
362382 |> Texture . put! ( 1 , 2 , { 4 , 8 , 12 } )
383+ |> Texture . put! ( 10 , 12 , { 6 , 9 , 11 } )
363384
364385 assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 , 11 }
365386 assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 , 12 }
387+ assert Texture . get ( tex , 10 , 12 ) == { 6 , 9 , 11 }
366388 assert Texture . get ( tex , 1 , 3 ) == { 189 , 183 , 107 }
367389
368390 tex = Texture . clear! ( tex )
369391 assert Texture . get ( tex , 1 , 1 ) == { 189 , 183 , 107 }
370392 assert Texture . get ( tex , 1 , 2 ) == { 189 , 183 , 107 }
393+ assert Texture . get ( tex , 10 , 12 ) == { 189 , 183 , 107 }
371394 assert Texture . get ( tex , 1 , 3 ) == { 189 , 183 , 107 }
372395 end
373396
374397 test "clear! works with rgba textures" do
375398 { :ok , tex } = Texture . build ( :rgba , @ width , @ height , clear: { 3 , 7 , 11 , 13 } )
376399 assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 , 11 , 13 }
377400 assert Texture . get ( tex , 1 , 2 ) == { 3 , 7 , 11 , 13 }
401+ assert Texture . get ( tex , 10 , 12 ) == { 3 , 7 , 11 , 13 }
378402
379403 tex = Texture . clear! ( tex , { 4 , 8 , 12 , 14 } )
380404 assert Texture . get ( tex , 1 , 1 ) == { 4 , 8 , 12 , 14 }
381405 assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 , 12 , 14 }
406+ assert Texture . get ( tex , 10 , 12 ) == { 4 , 8 , 12 , 14 }
382407 end
383408
384409 test "clear! works with rgba textures uses black by default" do
385410 tex =
386411 Texture . build! ( :rgba , @ width , @ height )
387412 |> Texture . put! ( 1 , 1 , { 3 , 7 , 11 , 13 } )
388413 |> Texture . put! ( 1 , 2 , { 4 , 8 , 12 , 14 } )
414+ |> Texture . put! ( 10 , 12 , { 6 , 9 , 11 , 13 } )
389415
390416 assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 , 11 , 13 }
391417 assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 , 12 , 14 }
418+ assert Texture . get ( tex , 10 , 12 ) == { 6 , 9 , 11 , 13 }
392419 assert Texture . get ( tex , 1 , 3 ) == { 0 , 0 , 0 , 0xFF }
393420
394421 tex = Texture . clear! ( tex )
395422 assert Texture . get ( tex , 1 , 1 ) == { 0 , 0 , 0 , 0xFF }
396423 assert Texture . get ( tex , 1 , 2 ) == { 0 , 0 , 0 , 0xFF }
424+ assert Texture . get ( tex , 10 , 12 ) == { 0 , 0 , 0 , 0xFF }
397425 assert Texture . get ( tex , 1 , 3 ) == { 0 , 0 , 0 , 0xFF }
398426 end
399427
@@ -402,14 +430,17 @@ defmodule Scenic.Utilities.TextureTest do
402430 Texture . build! ( :rgba , @ width , @ height , clear: :dark_khaki )
403431 |> Texture . put! ( 1 , 1 , { 3 , 7 , 11 , 13 } )
404432 |> Texture . put! ( 1 , 2 , { 4 , 8 , 12 , 14 } )
433+ |> Texture . put! ( 10 , 12 , { 6 , 9 , 11 , 13 } )
405434
406435 assert Texture . get ( tex , 1 , 1 ) == { 3 , 7 , 11 , 13 }
407436 assert Texture . get ( tex , 1 , 2 ) == { 4 , 8 , 12 , 14 }
437+ assert Texture . get ( tex , 10 , 12 ) == { 6 , 9 , 11 , 13 }
408438 assert Texture . get ( tex , 1 , 3 ) == { 189 , 183 , 107 , 255 }
409439
410440 tex = Texture . clear! ( tex )
411441 assert Texture . get ( tex , 1 , 1 ) == { 189 , 183 , 107 , 255 }
412442 assert Texture . get ( tex , 1 , 2 ) == { 189 , 183 , 107 , 255 }
443+ assert Texture . get ( tex , 10 , 12 ) == { 189 , 183 , 107 , 255 }
413444 assert Texture . get ( tex , 1 , 3 ) == { 189 , 183 , 107 , 255 }
414445 end
415446
0 commit comments