file import/export
This commit is contained in:
28
tests/files.py
Normal file
28
tests/files.py
Normal file
@@ -0,0 +1,28 @@
|
||||
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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user