From e96669208b2b11b570bf7677a00fe779fb3ca080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 13 Oct 2022 19:48:06 +0200 Subject: [PATCH] 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) --- tests/test-fp-context-tod.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test-fp-context-tod.c b/tests/test-fp-context-tod.c index 7137e3dd..912a82e9 100644 --- a/tests/test-fp-context-tod.c +++ b/tests/test-fp-context-tod.c @@ -20,6 +20,7 @@ #define FP_COMPONENT "tod" #include "fpi-log.h" +#include "fpi-device.h" #include static void @@ -77,6 +78,19 @@ test_context_has_fake_device (void) } 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