mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
device: Gracefully handle identify on devices with no support
We were crashing as trying to still call the identify vfunc, so check if identification is supported and if not return a relative error. Added test as well
This commit is contained in:
@@ -849,6 +849,15 @@ class VirtualDevice(VirtualDeviceBase):
|
||||
|
||||
self.assertEqual(close_res.code, int(FPrint.DeviceError.BUSY))
|
||||
|
||||
def test_identify_unsupported(self):
|
||||
if self.dev.supports_identify():
|
||||
self.skipTest('Device supports identification')
|
||||
|
||||
with self.assertRaises(GLib.Error) as error:
|
||||
self.dev.identify_sync([FPrint.Print.new(self.dev)])
|
||||
self.assertTrue(error.exception.matches(FPrint.DeviceError.quark(),
|
||||
FPrint.DeviceError.NOT_SUPPORTED))
|
||||
|
||||
|
||||
class VirtualDeviceClosed(VirtualDeviceBase):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user