Skip to content

Commit 65f2f36

Browse files
author
Fabien Servant
committed
Add tests for vec2 values
1 parent 9acf580 commit 65f2f36

File tree

4 files changed

+18
-28
lines changed

4 files changed

+18
-28
lines changed

pyTests/camera/test_equidistant.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pytest
66

77
from pyalicevision import camera as av
8+
from pyalicevision import numeric as avnum
89

910
##################
1011
### List of functions:
@@ -163,12 +164,10 @@ def test_equidistant_default_constructor():
163164
assert intrinsic.h() == 1, "The Equidistant intrinsic's default height should be 1"
164165

165166
scale = intrinsic.getScale()
166-
# TODO: uncomment check on the scale when Vec2 is binded
167-
# assert scale[0] == 1.0 and scale[1] == 1.0
167+
assert avnum.getX(scale) == 1.0 and avnum.getY(scale) == 1.0
168168

169169
offset = intrinsic.getOffset()
170-
# TODO: uncomment check on the offset when Vec2 is binded
171-
# assert offset[0] == 0.0 and offset[1] == 0.0
170+
assert avnum.getX(offset) == 0.0 and avnum.getY(offset) == 0.0
172171

173172
assert intrinsic.sensorWidth() == 36.0
174173
assert intrinsic.sensorHeight() == 24.0
@@ -200,12 +199,10 @@ def test_equidistant_constructors():
200199
assert intrinsic1.h() == height, "The Equidistant intrinsic's height has not been correctly set"
201200

202201
scale = intrinsic1.getScale()
203-
# TODO: uncomment check on the scale when Vec2 is binded
204-
# assert scale[0] == focal and scale[1] == focal
202+
assert avnum.getX(scale) == focal and avnum.getY(scale) == focal
205203

206204
offset = intrinsic1.getOffset()
207-
# TODO: uncomment check on the offset when Vec2 is binded
208-
# assert offset[0] == offset_x and offset[1] == offset_y
205+
assert avnum.getX(offset) == offset_x and avnum.getY(offset) == offset_y
209206

210207
assert intrinsic1.sensorWidth() == 36.0
211208
assert intrinsic1.sensorHeight() == 24.0
@@ -225,12 +222,10 @@ def test_equidistant_constructors():
225222
assert intrinsic2.h() == height, "The Equidistant intrinsic's height has not been correctly set"
226223

227224
scale = intrinsic2.getScale()
228-
# TODO: uncomment check on the scale when Vec2 is binded
229-
# assert scale[0] == focal and scale[1] == focal
225+
assert avnum.getX(scale) == focal and avnum.getY(scale) == focal
230226

231227
offset = intrinsic2.getOffset()
232-
# TODO: uncomment check on the offset when Vec2 is binded
233-
# assert offset[0] == offset_x and offset[1] == offset_y
228+
assert avnum.getX(offset) == offset_x and avnum.getY(offset) == offset_y
234229

235230
assert intrinsic2.sensorWidth() == 36.0
236231
assert intrinsic2.sensorHeight() == 24.0
@@ -335,8 +330,7 @@ def test_equidistant_get_set_circle():
335330
assert intrinsic.getCircleCenterY() == center_y
336331

337332
center = intrinsic.getCircleCenter()
338-
# TODO: uncomment when Vec2 is binded
339-
# assert center[0] == center_x and center[1] == center_y
333+
assert avnum.getX(center) == center_x and avnum.getY(center) == center_y
340334

341335

342336
def test_equidistant_ratio_lock_unlock():

pyTests/camera/test_pinhole.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pytest
66

77
from pyalicevision import camera as av
8+
from pyalicevision import numeric as avnum
89

910
##################
1011
### List of functions:
@@ -157,8 +158,7 @@ def test_pinhole_default_constructor():
157158
"The Pinhole intrinsic's focal length in Y should be 1.0"
158159

159160
offset = intrinsic.getOffset()
160-
# TODO: uncomment check on the offset when Vec2 is binded
161-
# assert offset[0] == 0.0 and offset[1] == 0.0
161+
assert avnum.getX(offset) == 0.0 and avnum.getY(offset) == 0.0
162162

163163
assert intrinsic.sensorWidth() == 36.0
164164
assert intrinsic.sensorHeight() == 24.0

pyTests/camera/test_undistortion_3de.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pytest
66

77
from pyalicevision import camera as av
8+
from pyalicevision import numeric as avnum
89

910
##################
1011
### List of functions:
@@ -46,8 +47,7 @@ def test_undistortion_3de_constructor():
4647
undistortion = av.Undistortion3DEAnamorphic4(WIDTH, HEIGHT)
4748

4849
size = undistortion.getSize()
49-
# TODO: uncomment when Vec2 is binded
50-
# assert size[0] == WIDTH and size[1] == HEIGHT
50+
assert avnum.getX(size) == WIDTH and avnum.getY(size) == HEIGHT
5151

5252
assert undistortion.getType() == av.UNDISTORTION_3DEANAMORPHIC4
5353

@@ -117,14 +117,12 @@ def test_undistortion_3de_get_set_size():
117117
size. """
118118
undistortion = av.Undistortion3DEAnamorphic4(WIDTH, HEIGHT)
119119
size = undistortion.getSize()
120-
# TODO: uncomment when Vec2 is binded
121-
# assert size[0] == WIDTH and size[1] == HEIGHT
120+
assert avnum.getX(size) == WIDTH and avnum.getY(size) == HEIGHT
122121

123122
undistortion.setSize(HEIGHT, WIDTH)
124123
assert size != undistortion.getSize()
125124
size = undistortion.getSize()
126-
# TODO: uncomment when Vec2 is binded
127-
# assert size[0] == HEIGHT and size[1] == WIDTH
125+
assert avnum.getX(size) == HEIGHT and avnum.getY(size) == WIDTH
128126

129127

130128
@pytest.mark.skip(reason="Vec2 not binded")

pyTests/camera/test_undistortion_radial.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pytest
66

77
from pyalicevision import camera as av
8+
from pyalicevision import numeric as avnum
89

910
##################
1011
### List of functions:
@@ -46,8 +47,7 @@ def test_undistortion_radial_constructor():
4647
undistortion = av.UndistortionRadialK3(WIDTH, HEIGHT)
4748

4849
size = undistortion.getSize()
49-
# TODO: uncomment when Vec2 is binded
50-
# assert size[0] == WIDTH and size[1] == HEIGHT
50+
assert avnum.getX(size) == WIDTH and avnum.getY(size) == HEIGHT
5151

5252
assert undistortion.getType() == av.UNDISTORTION_RADIALK3
5353

@@ -117,14 +117,12 @@ def test_undistortion_radial_get_set_size():
117117
size. """
118118
undistortion = av.UndistortionRadialK3(WIDTH, HEIGHT)
119119
size = undistortion.getSize()
120-
# TODO: uncomment when Vec2 is binded
121-
# assert size[0] == WIDTH and size[1] == HEIGHT
120+
assert avnum.getX(size) == WIDTH and avnum.getY(size) == HEIGHT
122121

123122
undistortion.setSize(HEIGHT, WIDTH)
124123
assert size != undistortion.getSize()
125124
size = undistortion.getSize()
126-
# TODO: uncomment when Vec2 is binded
127-
# assert size[0] == HEIGHT and size[1] == WIDTH
125+
assert avnum.getX(size) == HEIGHT and avnum.getY(size) == WIDTH
128126

129127

130128
@pytest.mark.skip(reason="Vec2 not binded")

0 commit comments

Comments
 (0)