mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-09-10 13:00:08 +00:00
mafpmoc/custom: Improve test script checking for identified match
This commit is contained in:
+13
-7
@@ -40,16 +40,18 @@ def enroll_progress(*args):
|
|||||||
print('enroll progress: ' + str(args))
|
print('enroll progress: ' + str(args))
|
||||||
|
|
||||||
def identify_done(dev, res):
|
def identify_done(dev, res):
|
||||||
global identified
|
global identified, identify_match
|
||||||
|
|
||||||
identified = True
|
identified = True
|
||||||
identify_match, identify_print = dev.identify_finish(res)
|
identify_match, identify_print = dev.identify_finish(res)
|
||||||
print('indentification_done: ', identify_match, identify_print)
|
print('indentification_done. match:', identify_match.get_description(),
|
||||||
|
'print:', identify_print.get_description())
|
||||||
assert identify_match.equal(identify_print)
|
assert identify_match.equal(identify_print)
|
||||||
|
|
||||||
# List, enroll, list, verify, identify, delete
|
# List, enroll, list, verify, identify, delete
|
||||||
print("enrolling")
|
print("enrolling")
|
||||||
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
||||||
p = d.enroll_sync(template, None, enroll_progress, None)
|
enrolled = d.enroll_sync(template, None, enroll_progress, None)
|
||||||
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
||||||
print("enroll done")
|
print("enroll done")
|
||||||
|
|
||||||
@@ -57,13 +59,12 @@ print("listing")
|
|||||||
stored = d.list_prints_sync()
|
stored = d.list_prints_sync()
|
||||||
print("listing done")
|
print("listing done")
|
||||||
assert len(stored) == 1
|
assert len(stored) == 1
|
||||||
assert stored[0].equal(p)
|
assert stored[0].equal(enrolled)
|
||||||
print("verifying")
|
print("verifying")
|
||||||
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
||||||
verify_res, verify_print = d.verify_sync(p)
|
verify_res, verify_print = d.verify_sync(enrolled)
|
||||||
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
||||||
print("verify done")
|
print("verify done")
|
||||||
del p
|
|
||||||
assert verify_res == True
|
assert verify_res == True
|
||||||
|
|
||||||
identified = False
|
identified = False
|
||||||
@@ -74,16 +75,21 @@ for p in stored:
|
|||||||
del stored
|
del stored
|
||||||
|
|
||||||
print('async identifying')
|
print('async identifying')
|
||||||
|
identify_match = None
|
||||||
d.identify(deserialized_prints, callback=identify_done)
|
d.identify(deserialized_prints, callback=identify_done)
|
||||||
del deserialized_prints
|
del deserialized_prints
|
||||||
|
|
||||||
while not identified:
|
while not identified:
|
||||||
ctx.iteration(True)
|
ctx.iteration(True)
|
||||||
|
|
||||||
|
assert identify_match.equal(enrolled)
|
||||||
|
|
||||||
print("deleting")
|
print("deleting")
|
||||||
d.delete_print_sync(p)
|
d.delete_print_sync(enrolled)
|
||||||
print("delete done")
|
print("delete done")
|
||||||
|
|
||||||
|
del enrolled
|
||||||
|
|
||||||
d.close_sync()
|
d.close_sync()
|
||||||
|
|
||||||
del d
|
del d
|
||||||
|
|||||||
Reference in New Issue
Block a user