From 4f0b0fa52685bab3565049e2a603461103b3eb61 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Thu, 14 May 2020 10:56:05 +0200 Subject: [PATCH] tests: Ensure FpDevice checks enrolled prints for completeness Enrolled prints need to have their type set. FpDevice should ensure that is the case when a driver returns a print back. --- tests/test-fpi-device.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test-fpi-device.c b/tests/test-fpi-device.c index f78517f..d415258 100644 --- a/tests/test-fpi-device.c +++ b/tests/test-fpi-device.c @@ -541,6 +541,24 @@ test_driver_enroll_error_no_print (void) g_assert_true (error == g_steal_pointer (&fake_dev->ret_error)); g_assert_null (out_print); g_assert_null (fake_dev->ret_print); + g_clear_error (&error); + + g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, + "*Driver did not set the type on the returned print*"); + + fake_dev->ret_error = NULL; + fake_dev->ret_print = fp_print_new (device); /* Type not set. */ + g_object_add_weak_pointer (G_OBJECT (fake_dev->ret_print), + (gpointer) (&fake_dev->ret_print)); + out_print = + fp_device_enroll_sync (device, fp_print_new (device), NULL, NULL, NULL, &error); + + g_test_assert_expected_messages (); + g_assert (fake_dev->last_called_function == dev_class->enroll); + g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL); + g_assert_null (out_print); + g_assert_null (fake_dev->ret_print); + g_clear_error (&error); } typedef struct