libfprint/tests/synaptics/custom.py
Benjamin Berg b92e6d6acd tests: Add testing to the synaptics driver
As the driver is not a normal image device, we need to add a custom
script to test it. Note that the ioctl dump must also be manually
modified unfortunately as the state is tracked incorrectly for the
device by umockdev-record.
2019-11-20 13:53:45 +01:00

43 lines
824 B
Python
Executable file

#!/usr/bin/python3
import gi
gi.require_version('FPrint', '2.0')
from gi.repository import FPrint, GLib
ctx = GLib.main_context_default()
c = FPrint.Context()
c.enumerate()
devices = c.get_devices()
d = devices[0]
assert d.get_driver() == "synaptics"
d.open_sync()
template = FPrint.Print.new(d)
def enroll_progress(*args):
print('enroll progress: ' + str(args))
# List, enroll, list, verify, delete, list
print("enrolling")
p = d.enroll_sync(template, None, enroll_progress, None)
print("enroll done")
print("listing")
stored = d.list_prints_sync()
print("listing done")
assert len(stored) == 1
assert stored[0].equal(p)
print("verifying")
verify_res, verify_print = d.verify_sync(p)
print("verify done")
assert verify_res == True
print("deleting")
d.delete_print_sync(p)
print("delete done")
d.close_sync()