29 lines
656 B
Python
29 lines
656 B
Python
import os
|
|
|
|
import floatimg
|
|
|
|
def create_img():
|
|
width, height = 5, 5
|
|
img = floatimg.create_rgb(width, height)
|
|
img.fill((255.0, 0.0, 0.0))
|
|
return img
|
|
|
|
def test_png():
|
|
width, height = 5, 5
|
|
path = "test.png"
|
|
img = create_img()
|
|
img.export(path)
|
|
assert os.path.getsize(path) == 74
|
|
img2 = floatimg.create_from_png(path)
|
|
for y in range(height):
|
|
for x in range(width):
|
|
assert img.get(x, y) == img2.get(x, y)
|
|
|
|
img3 = img2.clone(False)
|
|
img3.load_png(path)
|
|
for y in range(height):
|
|
for x in range(width):
|
|
assert img.get(x, y) == img3.get(x, y)
|
|
|
|
|