def test_view_descriptor_incorrect_input(): desc = ann.SplitterDescriptor(2, 3) with pytest.raises(RuntimeError) as err: desc.SetViewOriginCoord(1000, 100, 1000) assert "Failed to set view origin coordinates." in str(err.value) with pytest.raises(RuntimeError) as err: desc.SetViewSize(1000, 100, 1000) assert "Failed to set view size." in str(err.value)
def test_view_descriptor_ctor(): desc = ann.SplitterDescriptor(2, 3) value_size = 1 value_orig_coord = 5 for i in range(desc.GetNumViews()): for j in range(desc.GetNumDimensions()): desc.SetViewOriginCoord(i, j, value_orig_coord+i) desc.SetViewSize(i, j, value_size+i) assert 2 == desc.GetNumViews() assert 3 == desc.GetNumDimensions() assert [5, 5] == desc.GetViewOrigin(0) assert [6, 6] == desc.GetViewOrigin(1) assert [1, 1] == desc.GetViewSizes(0) assert [2, 2] == desc.GetViewSizes(1)
def test_view_descriptor_default_values(): desc = ann.SplitterDescriptor() assert 0 == desc.GetNumViews() assert 0 == desc.GetNumDimensions()