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.
This commit is contained in:
Benjamin Berg 2020-12-09 11:43:17 +01:00
parent faade91c39
commit 28ba6a0de9

View file

@ -896,6 +896,7 @@ typedef struct
gboolean called; gboolean called;
FpPrint *match; FpPrint *match;
FpPrint *print; FpPrint *print;
GPtrArray *gallery;
GError *error; GError *error;
} MatchCbData; } MatchCbData;
@ -939,6 +940,14 @@ test_driver_match_cb (FpDevice *device,
if (match) if (match)
g_assert_no_error (error); 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 static void
@ -1314,6 +1323,8 @@ test_driver_identify (void)
g_assert_true (fp_device_supports_identify (device)); g_assert_true (fp_device_supports_identify (device));
match_data->gallery = prints;
fake_dev->ret_print = make_fake_print (device, NULL); fake_dev->ret_print = make_fake_print (device, NULL);
g_assert_true (fp_device_identify_sync (device, prints, NULL, g_assert_true (fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data, test_driver_match_cb, match_data,
@ -1325,7 +1336,6 @@ test_driver_identify (void)
g_assert_true (match_data->print == print); g_assert_true (match_data->print == print);
g_assert (fake_dev->last_called_function == dev_class->identify); g_assert (fake_dev->last_called_function == dev_class->identify);
g_assert (fake_dev->action_data == prints);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (print != NULL && print == fake_dev->ret_print); g_assert (print != NULL && print == fake_dev->ret_print);