Skip to content

Commit a0884bc

Browse files
committed
Test: Ensure that you can import base64 without prefix
1 parent feb9e8d commit a0884bc

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Tests.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ Base64
1818
O> bitmap:copy-to-pcolors image true
1919
pcolors = map [ p -> [pcolor] of p ] (sort patches) => true
2020

21+
Base64NoPrefix
22+
extensions [ bitmap ]
23+
globals [ base64 image pcolors ]
24+
O> set image bitmap:import "extensions/bitmap/test-images/BitmapTest.jpg"
25+
O> set image bitmap:scaled image 64 48
26+
O> bitmap:copy-to-pcolors image true
27+
O> set pcolors map [ p -> [pcolor] of p ] (sort patches)
28+
O> set base64 bitmap:to-base64 image
29+
substring base64 0 49 => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEA"
30+
O> set image bitmap:from-base64 (substring base64 22 (length base64)) ; Strip the prefix
31+
O> bitmap:copy-to-pcolors image true
32+
pcolors = map [ p -> [pcolor] of p ] (sort patches) => true
33+
2134
AverageColor
2235
extensions [ bitmap ]
2336
globals [ image ]

0 commit comments

Comments
 (0)