test-fp-context-tod: Try to open/close a device from the public library

We need to skip this for devices with no close vfunc (like the SSM one)
This commit is contained in:
Marco Trevisan (Treviño)
2022-10-13 19:48:06 +02:00
parent f2816024e0
commit e96669208b
+14
View File
@@ -20,6 +20,7 @@
#define FP_COMPONENT "tod" #define FP_COMPONENT "tod"
#include "fpi-log.h" #include "fpi-log.h"
#include "fpi-device.h"
#include <libfprint/fprint.h> #include <libfprint/fprint.h>
static void static void
@@ -77,6 +78,19 @@ test_context_has_fake_device (void)
} }
g_assert_true (FP_IS_DEVICE (fake_device)); g_assert_true (FP_IS_DEVICE (fake_device));
if (FP_DEVICE_GET_CLASS (fake_device)->open)
{
GCancellable *cancellable;
g_assert_true (fp_device_open_sync (fake_device, NULL, NULL));
g_assert_false (fp_device_open_sync (fake_device, NULL, NULL));
g_assert_true (fp_device_close_sync (fake_device, NULL, NULL));
cancellable = g_cancellable_new ();
g_cancellable_cancel (cancellable);
g_assert_false (fp_device_open_sync (fake_device, cancellable, NULL));
g_clear_object (&cancellable);
}
} }
static void static void