python-FloatImg/tests/basics.py

38 lines
954 B
Python

from floatimg import FloatImg
def test_create():
width = 640
height = 480
img = FloatImg.create(width, height, FloatImg.RGB)
assert img.width == width
assert img.height == height
assert img.type_id == FloatImg.RGB
img = FloatImg.create_rgb(width, height)
assert img.type_id == FloatImg.RGB
# TODO inspect RVB
def test_clone():
width = 640
height = 480
img = FloatImg.create(width, height, FloatImg.RGB)
img2 = img.clone()
assert img.width == img2.width
assert img.height == img2.height
assert img.type_id == img2.type_id
# TODO inspect RVB and do pixel per pixel comparison
def test_rgb_constant():
width = 5
height = 5
color = [127.0, 127.0, 127.0]
img = FloatImg.create_rgb(width, height)
img.rgb_constant(*color)
for y in range(height):
for x in range(width):
assert img.get_rgb(x, y) == color