FloatImg class definition and some basic operations
This commit is contained in:
37
tests/basics.py
Normal file
37
tests/basics.py
Normal file
@@ -0,0 +1,37 @@
|
||||
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
|
||||
Reference in New Issue
Block a user