From 28ba6a0de93c8e71fadac1c13e9eb11fae424fd9 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Wed, 9 Dec 2020 11:43:17 +0100 Subject: [PATCH] test-fpi-device: Do deep comparison of gallery The gallery needs to be copied, as such we must do a deep comparison instead of comparing the pointers. We also can't do the comparison afterwards, as the gallery is owned by the operation and that operation is finished already. --- tests/test-fpi-device.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/test-fpi-device.c b/tests/test-fpi-device.c index 1018ae0..57e5cf9 100644 --- a/tests/test-fpi-device.c +++ b/tests/test-fpi-device.c @@ -893,10 +893,11 @@ test_driver_enroll_progress (void) typedef struct { - gboolean called; - FpPrint *match; - FpPrint *print; - GError *error; + gboolean called; + FpPrint *match; + FpPrint *print; + GPtrArray *gallery; + GError *error; } MatchCbData; static void @@ -939,6 +940,14 @@ test_driver_match_cb (FpDevice *device, if (match) g_assert_no_error (error); + + /* Compar gallery if this is an identify operation */ + if (data->gallery) + { + FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device); + g_assert_false (fake_dev->action_data == data->gallery); + assert_equal_galleries (fake_dev->action_data, data->gallery); + } } static void @@ -1314,6 +1323,8 @@ test_driver_identify (void) g_assert_true (fp_device_supports_identify (device)); + match_data->gallery = prints; + fake_dev->ret_print = make_fake_print (device, NULL); g_assert_true (fp_device_identify_sync (device, prints, NULL, test_driver_match_cb, match_data, @@ -1325,7 +1336,6 @@ test_driver_identify (void) g_assert_true (match_data->print == print); g_assert (fake_dev->last_called_function == dev_class->identify); - g_assert (fake_dev->action_data == prints); g_assert_no_error (error); g_assert (print != NULL && print == fake_dev->ret_print);