Skip to content

Commit ac36bf3

Browse files
committed
TEST: append and insert on image
related to: Oldes/Rebol-issues#344 related to: Oldes/Rebol-issues#783
1 parent e81f18c commit ac36bf3

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/tests/units/image-test.r3

+35
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,41 @@ FFFFFFDC1616212121212121
314314
--assert image? pos: find img 66
315315
--assert 2 = index? pos
316316

317+
--test-- "APPEND on image"
318+
;@@ https://github.com/Oldes/Rebol-issues/issues/344
319+
img: make image! 2x0
320+
append img 170.170.170
321+
--assert 2x0 = img/size ; size not updated yet as the row is not full
322+
append img 187.187.187
323+
--assert 2x1 = img/size ; size was updated now
324+
--assert #{AAAAAABBBBBB} = img/rgb
325+
append img [1.1.1 2.2.2]
326+
--assert #{AAAAAABBBBBB010101020202} = img/rgb
327+
328+
--test-- "INSERT on image"
329+
img: make image! 2x0
330+
--assert 1 = index? img
331+
--assert 2 = index? insert img 170.170.170
332+
--assert 2 = index? insert img 187.187.187
333+
--assert 3 = index? tail img
334+
--assert #{BBBBBBAAAAAA} = img/rgb
335+
--assert 3 = index? insert img [1.1.1 2.2.2]
336+
--assert #{010101020202BBBBBBAAAAAA} = img/rgb
337+
338+
--test-- "INSERT/tail on image"
339+
;@@ https://github.com/Oldes/Rebol-issues/issues/783
340+
img: make image! 2x0
341+
img: insert tail img 170.170.170
342+
--assert 2x0 = img/size ; size not updated yet as the row is not full
343+
--assert tail? img
344+
--assert empty? img/rgb
345+
img: insert img 187.187.187
346+
--assert 2x1 = img/size ; size was updated now
347+
--assert tail? img
348+
--assert empty? img/rgb
349+
img: head img
350+
--assert #{AAAAAABBBBBB} = img/rgb
351+
317352
===end-group===
318353

319354

0 commit comments

Comments
 (0)