goodixmoc: Add async identification test using on-owned deseralized prints
This simulates what fprintd does
This commit is contained in:
parent
989d498eb9
commit
c02771d16b
1 changed files with 23 additions and 4 deletions
|
@ -22,6 +22,13 @@ template = FPrint.Print.new(d)
|
||||||
def enroll_progress(*args):
|
def enroll_progress(*args):
|
||||||
print('enroll progress: ' + str(args))
|
print('enroll progress: ' + str(args))
|
||||||
|
|
||||||
|
def identify_done(dev, res):
|
||||||
|
global identified
|
||||||
|
identified = True
|
||||||
|
identify_match, identify_print = dev.identify_finish(res)
|
||||||
|
print('indentification_done: ', identify_match, identify_print)
|
||||||
|
assert identify_match.equal(identify_print)
|
||||||
|
|
||||||
# List, enroll, list, verify, identify, delete
|
# List, enroll, list, verify, identify, delete
|
||||||
print("enrolling")
|
print("enrolling")
|
||||||
p = d.enroll_sync(template, None, enroll_progress, None)
|
p = d.enroll_sync(template, None, enroll_progress, None)
|
||||||
|
@ -35,15 +42,27 @@ assert stored[0].equal(p)
|
||||||
print("verifying")
|
print("verifying")
|
||||||
verify_res, verify_print = d.verify_sync(p)
|
verify_res, verify_print = d.verify_sync(p)
|
||||||
print("verify done")
|
print("verify done")
|
||||||
|
del p
|
||||||
assert verify_res == True
|
assert verify_res == True
|
||||||
print("identifying")
|
|
||||||
identify_match, identify_print = d.identify_sync(stored)
|
identified = False
|
||||||
print("identify done")
|
deserialized_prints = []
|
||||||
assert identify_match.equal(identify_print)
|
for p in stored:
|
||||||
|
deserialized_prints.append(FPrint.Print.deserialize(p.serialize()))
|
||||||
|
assert deserialized_prints[-1].equal(p)
|
||||||
|
del stored
|
||||||
|
|
||||||
|
print('async identifying')
|
||||||
|
d.identify(deserialized_prints, callback=identify_done)
|
||||||
|
del deserialized_prints
|
||||||
|
|
||||||
|
while not identified:
|
||||||
|
ctx.iteration(True)
|
||||||
|
|
||||||
print("deleting")
|
print("deleting")
|
||||||
d.delete_print_sync(p)
|
d.delete_print_sync(p)
|
||||||
print("delete done")
|
print("delete done")
|
||||||
|
|
||||||
d.close_sync()
|
d.close_sync()
|
||||||
|
|
||||||
del d
|
del d
|
||||||
|
|
Loading…
Reference in a new issue