test: fix string encoding in the python test bindings

The protocol encoding is the string including the null byte. The test
wrappers sent the right string length but only encoded strlen() bytes so
where we had a string that's a multiple of 4 long we ended up claiming
it's a byte longer than was on the wire.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/314>
This commit is contained in:
Peter Hutterer 2024-12-03 13:05:43 +10:00
parent 076e8bc670
commit 327dd4f8b1

View file

@ -174,7 +174,7 @@ class Interface:
elif sig in ["s"]:
encoding.append("I")
arguments.append(len(arg) + 1)
slen = ((len(arg) + 3) // 4) * 4
slen = ((len(arg) + 1 + 3) // 4) * 4
encoding.append(f"{slen}s")
arg = arg.encode("utf8")
elif sig in ["h"]: