mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 05:14:45 +00:00
Add array_to_pixels() to test_utils.lua
This commit is contained in:
parent
4f33bd8e14
commit
6c0523f150
@ -16,6 +16,10 @@ end
|
||||
function expect_img(image, expectedPixels)
|
||||
local w = image.width
|
||||
local h = image.height
|
||||
if w*h ~= #expectedPixels then
|
||||
print(debug.traceback())
|
||||
assert(w*h == #expectedPixels)
|
||||
end
|
||||
for y=0,h-1 do
|
||||
for x=0,w-1 do
|
||||
local value = image:getPixel(x, y)
|
||||
@ -63,3 +67,16 @@ function expect_img(image, expectedPixels)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function array_to_pixels(array, image)
|
||||
local w = image.width
|
||||
local h = image.height
|
||||
assert(w*h == #array)
|
||||
local i = 1
|
||||
for y=0,h-1 do
|
||||
for x=0,w-1 do
|
||||
image:drawPixel(x, y, array[i])
|
||||
i = i+1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user