51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
from image_prediction.info import Info
|
|
from image_prediction.stitching.split_mapper import VerticalSplitMapper, HorizontalSplitMapper
|
|
|
|
|
|
def test_split_vertical_mapper(base_patch_metadata):
|
|
sm = VerticalSplitMapper(base_patch_metadata)
|
|
|
|
sm.c1 += 10 + 3
|
|
sm.c2 += 20 + 3
|
|
sm.dim += 20 + 3
|
|
smw = sm.wrapped
|
|
|
|
assert smw[Info.Y1] == sm.c1 == base_patch_metadata[Info.Y1] + 10 + 3
|
|
assert smw[Info.Y2] == sm.c2 == base_patch_metadata[Info.Y2] + 20 + 3
|
|
assert smw[Info.HEIGHT] == sm.dim == base_patch_metadata[Info.HEIGHT] + 20 + 3
|
|
|
|
sm = VerticalSplitMapper(base_patch_metadata)
|
|
|
|
sm.c1 = 10 + 3
|
|
sm.c2 = 20 + 3
|
|
sm.dim = 20 + 3
|
|
smw = sm.wrapped
|
|
|
|
assert smw[Info.Y1] == sm.c1 == 10 + 3
|
|
assert smw[Info.Y2] == sm.c2 == 20 + 3
|
|
assert smw[Info.HEIGHT] == sm.dim == 20 + 3
|
|
|
|
|
|
def test_split_horizontal_mapper(base_patch_metadata):
|
|
sm = HorizontalSplitMapper(base_patch_metadata)
|
|
|
|
sm.c1 += 10 + 3
|
|
sm.c2 += 20 + 3
|
|
sm.dim += 20 + 3
|
|
smw = sm.wrapped
|
|
|
|
assert smw[Info.X1] == sm.c1 == base_patch_metadata[Info.X1] + 10 + 3
|
|
assert smw[Info.X2] == sm.c2 == base_patch_metadata[Info.X2] + 20 + 3
|
|
assert smw[Info.WIDTH] == sm.dim == base_patch_metadata[Info.WIDTH] + 20 + 3
|
|
|
|
sm = HorizontalSplitMapper(base_patch_metadata)
|
|
|
|
sm.c1 = 10 + 3
|
|
sm.c2 = 20 + 3
|
|
sm.dim = 20 + 3
|
|
smw = sm.wrapped
|
|
|
|
assert smw[Info.X1] == sm.c1 == 10 + 3
|
|
assert smw[Info.X2] == sm.c2 == 20 + 3
|
|
assert smw[Info.WIDTH] == sm.dim == 20 + 3
|