fp-image-device: Report finger status changes to the device

While the image device has its own finger status tracking, we use a simpler
version as public data information, so let's just report the finger-on/off
and when a finger is expected to the parent class.

Verify that this happens as expected using the virtual-image class
This commit is contained in:
Marco Trevisan (Treviño)
2020-03-26 21:42:35 +01:00
committed by Marco Trevisan
parent 3c382cac7f
commit 893ff9c033
2 changed files with 41 additions and 0 deletions

View File

@@ -172,6 +172,7 @@ class VirtualImage(unittest.TestCase):
def done_cb(dev, res):
print("Enroll done")
fp = dev.enroll_finish(res)
self.assertEqual(self.dev.get_finger_status(), FPrint.FingerStatusFlags.NONE)
self._enrolled = fp
template = FPrint.Print.new(self.dev)
@@ -182,6 +183,7 @@ class VirtualImage(unittest.TestCase):
date = GLib.Date()
date.set_dmy(*datetime.get_ymd()[::-1])
template.props.enroll_date = date
self.assertEqual(self.dev.get_finger_status(), FPrint.FingerStatusFlags.NONE)
self.dev.enroll(template, None, progress_cb, tuple(), done_cb)
# Note: Assumes 5 enroll steps for this device!
@@ -192,25 +194,36 @@ class VirtualImage(unittest.TestCase):
# Test the image-device path where the finger is removed after
# the minutiae scan is completed.
self.send_finger_automatic(False)
self.assertEqual(self.dev.get_finger_status(), FPrint.FingerStatusFlags.NEEDED)
self.send_finger_report(True)
self.assertEqual(self.dev.get_finger_status(),
FPrint.FingerStatusFlags.NEEDED | FPrint.FingerStatusFlags.PRESENT)
self.send_image(image)
while self._step < 2:
ctx.iteration(True)
self.send_finger_report(False)
self.assertEqual(self.dev.get_finger_status(), FPrint.FingerStatusFlags.NEEDED)
self.send_finger_automatic(True)
self.send_image(image)
while self._step < 3:
ctx.iteration(True)
self.assertEqual(self.dev.get_finger_status(), FPrint.FingerStatusFlags.NEEDED)
self.send_image(image)
while self._step < 4:
ctx.iteration(True)
self.assertEqual(self.dev.get_finger_status(), FPrint.FingerStatusFlags.NEEDED)
self.send_image(image)
while self._enrolled is None:
ctx.iteration(True)
self.assertEqual(self.dev.get_finger_status(), FPrint.FingerStatusFlags.NONE)
return self._enrolled
def test_enroll_verify(self):