From c02771d16bbc66db7739a831b8e5881382a5356d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 9 Dec 2020 01:36:24 +0100 Subject: [PATCH] goodixmoc: Add async identification test using on-owned deseralized prints This simulates what fprintd does --- tests/goodixmoc/custom.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/goodixmoc/custom.py b/tests/goodixmoc/custom.py index 6cc3b70..57faf6c 100755 --- a/tests/goodixmoc/custom.py +++ b/tests/goodixmoc/custom.py @@ -22,6 +22,13 @@ template = FPrint.Print.new(d) def enroll_progress(*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 print("enrolling") p = d.enroll_sync(template, None, enroll_progress, None) @@ -35,15 +42,27 @@ assert stored[0].equal(p) print("verifying") verify_res, verify_print = d.verify_sync(p) print("verify done") +del p assert verify_res == True -print("identifying") -identify_match, identify_print = d.identify_sync(stored) -print("identify done") -assert identify_match.equal(identify_print) + +identified = False +deserialized_prints = [] +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") d.delete_print_sync(p) print("delete done") + d.close_sync() del d