mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2025-12-20 16:10:06 +01:00
test: fix false fail by actually looking for unbound capability mask
The previous implementation of `test_seat_bind_invalid_caps_expect_disconnection` didn't follow the protocol specification and assumed that `0x1` was invalid. Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/354>
This commit is contained in:
parent
500ad0510f
commit
e3e143ea42
1 changed files with 18 additions and 4 deletions
|
|
@ -215,15 +215,15 @@ class Ei:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def seat_cap(seat, mask, intf_name):
|
def seat_cap(seat, mask, intf_name):
|
||||||
seat._interface_masks[intf_name] = mask
|
seat.interface_masks[intf_name] = mask
|
||||||
|
|
||||||
seat._interface_masks = {}
|
seat.interface_masks = {}
|
||||||
seat.connect("Capability", seat_cap)
|
seat.connect("Capability", seat_cap)
|
||||||
|
|
||||||
def bind_mask(interfaces: list[InterfaceName]) -> int:
|
def bind_mask(interfaces: list[InterfaceName]) -> int:
|
||||||
return reduce(
|
return reduce(
|
||||||
lambda mask, v: mask | v,
|
lambda mask, v: mask | v,
|
||||||
[seat._interface_masks[i] for i in interfaces],
|
[seat.interface_masks[i] for i in interfaces],
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -684,7 +684,21 @@ class TestEiProtocol:
|
||||||
connection = ei.connection
|
connection = ei.connection
|
||||||
assert connection is not None
|
assert connection is not None
|
||||||
seat = ei.seats[0]
|
seat = ei.seats[0]
|
||||||
ei.send(seat.Bind(0x1)) # binding to invalid caps should get us disconnected
|
|
||||||
|
first_invalid_mask = None
|
||||||
|
for i in range(64):
|
||||||
|
mask = 1 << i
|
||||||
|
if mask not in seat.interface_masks.values():
|
||||||
|
first_invalid_mask = mask
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
assert False, (
|
||||||
|
"EIS implementation has bound all 64 bits, cannot find unused bitmask"
|
||||||
|
)
|
||||||
|
|
||||||
|
ei.send(
|
||||||
|
seat.Bind(first_invalid_mask)
|
||||||
|
) # binding to invalid caps should get us disconnected
|
||||||
try:
|
try:
|
||||||
ei.dispatch()
|
ei.dispatch()
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue