Skip to content

Commit

Permalink
More control tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagocoutinho committed Aug 29, 2024
1 parent a76048c commit a1291a0
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
BufferType,
Capability,
ControlClass,
ControlType,
Device,
InputCapabilities,
Memory,
Expand Down Expand Up @@ -689,7 +690,19 @@ def _():
boolean.value = value
assert boolean.value is expected

# String
# menu
menu = controls.menu
assert menu is controls["menu"]
assert menu.type == ControlType.MENU
assert menu[1] == menu.data[1]

menu.value = 1
assert menu.value == 1

with raises(OSError):
menu.value = 0

# string
assert controls.string is controls["string"]
current_value = controls.string.value
try:
Expand All @@ -709,6 +722,8 @@ def _():
finally:
controls.s32_2_element_array.value = current_value

assert controls.s32_2_element_array.default[:] == [2, 2]

assert "<CompoundControl s32_2_element_array flags=has_payload>" in repr(controls.s32_2_element_array)

# matrix 8x16
Expand All @@ -727,6 +742,9 @@ def _():
assert area.width == width
assert area.height == height

# button
controls.button.push()

# Unknown
with raises(KeyError):
_ = list(controls.with_class("unknown class"))
Expand Down

0 comments on commit a1291a0

Please sign in to comment.