|
|
|
|
@@ -89,6 +89,29 @@ auto_reset_device_class_cleanup (FpAutoResetClass *dev_class)
|
|
|
|
|
}
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FpAutoResetClass, auto_reset_device_class_cleanup)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
assert_equal_galleries (GPtrArray *g1,
|
|
|
|
|
GPtrArray *g2)
|
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
|
|
g_assert ((g1 && g2) || (!g1 || !g1));
|
|
|
|
|
|
|
|
|
|
if (g1 == g2)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
g_assert_cmpuint (g1->len, ==, g2->len);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < g1->len; i++)
|
|
|
|
|
{
|
|
|
|
|
FpPrint *print = g_ptr_array_index (g1, i);
|
|
|
|
|
|
|
|
|
|
g_assert_true (g_ptr_array_find_with_equal_func (g2, print, (GEqualFunc)
|
|
|
|
|
fp_print_equal, NULL));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
on_device_notify (FpDevice *device, GParamSpec *spec, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
@@ -98,6 +121,43 @@ on_device_notify (FpDevice *device, GParamSpec *spec, gpointer user_data)
|
|
|
|
|
fake_dev->user_data = g_param_spec_ref (spec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static FpPrint *
|
|
|
|
|
make_fake_print (FpDevice *device,
|
|
|
|
|
GVariant *print_data)
|
|
|
|
|
{
|
|
|
|
|
FpPrint *enrolled_print = fp_print_new (device);
|
|
|
|
|
|
|
|
|
|
fpi_print_set_type (enrolled_print, FPI_PRINT_RAW);
|
|
|
|
|
|
|
|
|
|
if (!print_data)
|
|
|
|
|
print_data = g_variant_new_string ("Test print private data");
|
|
|
|
|
g_object_set (G_OBJECT (enrolled_print), "fpi-data", print_data, NULL);
|
|
|
|
|
|
|
|
|
|
return enrolled_print;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static FpPrint *
|
|
|
|
|
make_fake_print_reffed (FpDevice *device,
|
|
|
|
|
GVariant *print_data)
|
|
|
|
|
{
|
|
|
|
|
return g_object_ref_sink (make_fake_print (device, print_data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GPtrArray *
|
|
|
|
|
make_fake_prints_gallery (FpDevice *device,
|
|
|
|
|
size_t size)
|
|
|
|
|
{
|
|
|
|
|
GPtrArray *array;
|
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
|
|
array = g_ptr_array_new_full (size, g_object_unref);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < size; i++)
|
|
|
|
|
g_ptr_array_add (array, make_fake_print_reffed (device, g_variant_new_uint64 (i)));
|
|
|
|
|
|
|
|
|
|
return array;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Tests */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
@@ -205,11 +265,16 @@ test_driver_finger_status_inactive (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FpDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
FpFingerStatusFlags finger_status;
|
|
|
|
|
|
|
|
|
|
g_signal_connect (device, "notify::finger-status", G_CALLBACK (on_device_notify), NULL);
|
|
|
|
|
|
|
|
|
|
g_assert_false (fpi_device_report_finger_status (device, FP_FINGER_STATUS_NONE));
|
|
|
|
|
g_assert_cmpuint (fp_device_get_finger_status (device), ==, FP_FINGER_STATUS_NONE);
|
|
|
|
|
|
|
|
|
|
g_object_get (fake_dev, "finger-status", &finger_status, NULL);
|
|
|
|
|
g_assert_cmpuint (finger_status, ==, FP_FINGER_STATUS_NONE);
|
|
|
|
|
|
|
|
|
|
g_assert (fake_dev->last_called_function != on_device_notify);
|
|
|
|
|
g_assert_null (g_steal_pointer (&fake_dev->user_data));
|
|
|
|
|
}
|
|
|
|
|
@@ -220,12 +285,16 @@ test_driver_finger_status_needed (void)
|
|
|
|
|
g_autoptr(FpDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
|
|
|
|
|
g_autoptr(GParamSpec) pspec = NULL;
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
FpFingerStatusFlags finger_status;
|
|
|
|
|
|
|
|
|
|
g_signal_connect (device, "notify::finger-status", G_CALLBACK (on_device_notify), NULL);
|
|
|
|
|
|
|
|
|
|
g_assert_true (fpi_device_report_finger_status (device, FP_FINGER_STATUS_NEEDED));
|
|
|
|
|
g_assert_cmpuint (fp_device_get_finger_status (device), ==, FP_FINGER_STATUS_NEEDED);
|
|
|
|
|
|
|
|
|
|
g_object_get (fake_dev, "finger-status", &finger_status, NULL);
|
|
|
|
|
g_assert_cmpuint (finger_status, ==, FP_FINGER_STATUS_NEEDED);
|
|
|
|
|
|
|
|
|
|
g_assert (fake_dev->last_called_function == on_device_notify);
|
|
|
|
|
pspec = g_steal_pointer (&fake_dev->user_data);
|
|
|
|
|
g_assert_cmpstr (pspec->name, ==, "finger-status");
|
|
|
|
|
@@ -242,12 +311,16 @@ test_driver_finger_status_present (void)
|
|
|
|
|
g_autoptr(FpDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
|
|
|
|
|
g_autoptr(GParamSpec) pspec = NULL;
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
FpFingerStatusFlags finger_status;
|
|
|
|
|
|
|
|
|
|
g_signal_connect (device, "notify::finger-status", G_CALLBACK (on_device_notify), NULL);
|
|
|
|
|
|
|
|
|
|
g_assert_true (fpi_device_report_finger_status (device, FP_FINGER_STATUS_PRESENT));
|
|
|
|
|
g_assert_cmpuint (fp_device_get_finger_status (device), ==, FP_FINGER_STATUS_PRESENT);
|
|
|
|
|
|
|
|
|
|
g_object_get (fake_dev, "finger-status", &finger_status, NULL);
|
|
|
|
|
g_assert_cmpuint (finger_status, ==, FP_FINGER_STATUS_PRESENT);
|
|
|
|
|
|
|
|
|
|
g_assert (fake_dev->last_called_function == on_device_notify);
|
|
|
|
|
pspec = g_steal_pointer (&fake_dev->user_data);
|
|
|
|
|
g_assert_cmpstr (pspec->name, ==, "finger-status");
|
|
|
|
|
@@ -534,12 +607,12 @@ test_driver_open (void)
|
|
|
|
|
|
|
|
|
|
g_assert (fake_dev->last_called_function != dev_class->probe);
|
|
|
|
|
|
|
|
|
|
fp_device_open_sync (device, NULL, &error);
|
|
|
|
|
g_assert_true (fp_device_open_sync (device, NULL, &error));
|
|
|
|
|
g_assert (fake_dev->last_called_function == dev_class->open);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert_true (fp_device_is_open (device));
|
|
|
|
|
|
|
|
|
|
fp_device_close_sync (FP_DEVICE (device), NULL, &error);
|
|
|
|
|
g_assert_true (fp_device_close_sync (FP_DEVICE (device), NULL, &error));
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -552,7 +625,7 @@ test_driver_open_error (void)
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_GENERAL);
|
|
|
|
|
fp_device_open_sync (device, NULL, &error);
|
|
|
|
|
g_assert_false (fp_device_open_sync (device, NULL, &error));
|
|
|
|
|
g_assert (fake_dev->last_called_function == dev_class->open);
|
|
|
|
|
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
|
|
|
|
|
g_assert_false (fp_device_is_open (device));
|
|
|
|
|
@@ -567,7 +640,7 @@ test_driver_close (void)
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
|
|
|
|
|
fp_device_close_sync (device, NULL, &error);
|
|
|
|
|
g_assert_true (fp_device_close_sync (device, NULL, &error));
|
|
|
|
|
g_assert (fake_dev->last_called_function == dev_class->close);
|
|
|
|
|
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
@@ -583,7 +656,7 @@ test_driver_close_error (void)
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_GENERAL);
|
|
|
|
|
fp_device_close_sync (device, NULL, &error);
|
|
|
|
|
g_assert_false (fp_device_close_sync (device, NULL, &error));
|
|
|
|
|
|
|
|
|
|
g_assert (fake_dev->last_called_function == dev_class->close);
|
|
|
|
|
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
|
|
|
|
|
@@ -670,7 +743,7 @@ test_driver_enroll_error_no_print (void)
|
|
|
|
|
"*Driver passed an error but also provided a print, returning error*");
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_GENERAL);
|
|
|
|
|
fake_dev->ret_print = fp_print_new (device);
|
|
|
|
|
fake_dev->ret_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
g_object_add_weak_pointer (G_OBJECT (fake_dev->ret_print),
|
|
|
|
|
(gpointer) (&fake_dev->ret_print));
|
|
|
|
|
out_print =
|
|
|
|
|
@@ -761,7 +834,8 @@ test_driver_enroll_progress_vfunc (FpDevice *device)
|
|
|
|
|
|
|
|
|
|
expected_data->completed_stages =
|
|
|
|
|
g_random_int_range (fp_device_get_nr_enroll_stages (device), G_MAXINT32);
|
|
|
|
|
expected_data->print = fp_print_new (device);
|
|
|
|
|
expected_data->print = make_fake_print_reffed (device,
|
|
|
|
|
g_variant_new_int32 (expected_data->completed_stages));
|
|
|
|
|
expected_data->error = NULL;
|
|
|
|
|
|
|
|
|
|
error = fpi_device_error_new (FP_DEVICE_ERROR_GENERAL);
|
|
|
|
|
@@ -819,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
|
|
|
|
|
@@ -865,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
|
|
|
|
|
@@ -872,7 +955,7 @@ test_driver_verify (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
g_autoptr(FpPrint) out_print = NULL;
|
|
|
|
|
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
@@ -880,9 +963,9 @@ test_driver_verify (void)
|
|
|
|
|
gboolean match;
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_result = FPI_MATCH_SUCCESS;
|
|
|
|
|
fp_device_verify_sync (device, enrolled_print, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &out_print, &error);
|
|
|
|
|
g_assert_true (fp_device_verify_sync (device, enrolled_print, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &out_print, &error));
|
|
|
|
|
|
|
|
|
|
g_assert (fake_dev->last_called_function == dev_class->verify);
|
|
|
|
|
g_assert (fake_dev->action_data == enrolled_print);
|
|
|
|
|
@@ -902,17 +985,18 @@ test_driver_verify_fail (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = NULL;
|
|
|
|
|
g_autoptr(FpPrint) out_print = NULL;
|
|
|
|
|
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
gboolean match;
|
|
|
|
|
|
|
|
|
|
enrolled_print = make_fake_print_reffed (device, g_variant_new_uint64 (3));
|
|
|
|
|
fake_dev->ret_result = FPI_MATCH_FAIL;
|
|
|
|
|
fp_device_verify_sync (device, enrolled_print, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &out_print, &error);
|
|
|
|
|
g_assert_true (fp_device_verify_sync (device, enrolled_print, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &out_print, &error));
|
|
|
|
|
|
|
|
|
|
g_assert (fake_dev->last_called_function == dev_class->verify);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
@@ -931,7 +1015,7 @@ test_driver_verify_retry (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
g_autoptr(FpPrint) out_print = NULL;
|
|
|
|
|
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
@@ -940,9 +1024,9 @@ test_driver_verify_retry (void)
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_result = FPI_MATCH_ERROR;
|
|
|
|
|
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_GENERAL);
|
|
|
|
|
fp_device_verify_sync (device, enrolled_print, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &out_print, &error);
|
|
|
|
|
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &out_print, &error));
|
|
|
|
|
|
|
|
|
|
g_assert_true (match_data->called);
|
|
|
|
|
g_assert_null (match_data->match);
|
|
|
|
|
@@ -959,7 +1043,7 @@ test_driver_verify_error (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
g_autoptr(FpPrint) out_print = NULL;
|
|
|
|
|
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
@@ -968,9 +1052,9 @@ test_driver_verify_error (void)
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_result = FPI_MATCH_ERROR;
|
|
|
|
|
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_GENERAL);
|
|
|
|
|
fp_device_verify_sync (device, enrolled_print, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &out_print, &error);
|
|
|
|
|
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &out_print, &error));
|
|
|
|
|
|
|
|
|
|
g_assert_false (match_data->called);
|
|
|
|
|
g_assert_null (match_data->match);
|
|
|
|
|
@@ -998,16 +1082,16 @@ test_driver_verify_not_reported (void)
|
|
|
|
|
|
|
|
|
|
dev_class->verify = fake_device_verify_immediate_complete;
|
|
|
|
|
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
|
|
|
|
|
enrolled_print = g_object_ref_sink (fp_print_new (device));
|
|
|
|
|
enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
|
|
|
|
|
g_assert_true (fp_device_open_sync (device, NULL, NULL));
|
|
|
|
|
|
|
|
|
|
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
|
|
|
|
|
"*reported successful verify complete*not report*result*");
|
|
|
|
|
|
|
|
|
|
fp_device_verify_sync (device, enrolled_print, NULL,
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
NULL, NULL, &error);
|
|
|
|
|
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL,
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
NULL, NULL, &error));
|
|
|
|
|
|
|
|
|
|
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
|
|
|
|
|
|
|
|
|
|
@@ -1041,7 +1125,7 @@ test_driver_verify_report_no_callback (void)
|
|
|
|
|
dev_class->verify = fake_device_verify_complete_error;
|
|
|
|
|
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
|
|
|
|
|
fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
enrolled_print = g_object_ref_sink (fp_print_new (device));
|
|
|
|
|
enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
|
|
|
|
|
g_assert_true (fp_device_open_sync (device, NULL, NULL));
|
|
|
|
|
|
|
|
|
|
@@ -1050,9 +1134,9 @@ test_driver_verify_report_no_callback (void)
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_result = FPI_MATCH_ERROR;
|
|
|
|
|
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_NOT_SUPPORTED);
|
|
|
|
|
fp_device_verify_sync (device, enrolled_print, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &print, &error);
|
|
|
|
|
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &print, &error));
|
|
|
|
|
|
|
|
|
|
g_test_assert_expected_messages ();
|
|
|
|
|
|
|
|
|
|
@@ -1081,7 +1165,7 @@ test_driver_verify_complete_retry (void)
|
|
|
|
|
dev_class->verify = fake_device_verify_complete_error;
|
|
|
|
|
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
|
|
|
|
|
fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
enrolled_print = g_object_ref_sink (fp_print_new (device));
|
|
|
|
|
enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
|
|
|
|
|
g_assert_true (fp_device_open_sync (device, NULL, NULL));
|
|
|
|
|
|
|
|
|
|
@@ -1091,8 +1175,8 @@ test_driver_verify_complete_retry (void)
|
|
|
|
|
test_driver_match_data_clear (match_data);
|
|
|
|
|
fake_dev->ret_result = FPI_MATCH_FAIL;
|
|
|
|
|
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_TOO_SHORT);
|
|
|
|
|
fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
|
|
|
|
|
match_data, &match, &print, &error);
|
|
|
|
|
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
|
|
|
|
|
match_data, &match, &print, &error));
|
|
|
|
|
g_test_assert_expected_messages ();
|
|
|
|
|
|
|
|
|
|
g_assert_true (error == g_steal_pointer (&fake_dev->ret_error));
|
|
|
|
|
@@ -1113,8 +1197,8 @@ test_driver_verify_complete_retry (void)
|
|
|
|
|
fake_dev->ret_result = FPI_MATCH_FAIL;
|
|
|
|
|
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_TOO_SHORT);
|
|
|
|
|
fake_dev->user_data = g_error_copy (fake_dev->ret_error);
|
|
|
|
|
fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
|
|
|
|
|
match_data, &match, &print, &error);
|
|
|
|
|
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
|
|
|
|
|
match_data, &match, &print, &error));
|
|
|
|
|
|
|
|
|
|
g_test_assert_expected_messages ();
|
|
|
|
|
g_assert_true (error != g_steal_pointer (&fake_dev->ret_error));
|
|
|
|
|
@@ -1135,8 +1219,8 @@ test_driver_verify_complete_retry (void)
|
|
|
|
|
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_TOO_SHORT);
|
|
|
|
|
fake_dev->user_data = g_error_copy (fake_dev->ret_error);
|
|
|
|
|
|
|
|
|
|
fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
|
|
|
|
|
match_data, &match, &print, &error);
|
|
|
|
|
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
|
|
|
|
|
match_data, &match, &print, &error));
|
|
|
|
|
g_test_assert_expected_messages ();
|
|
|
|
|
|
|
|
|
|
g_assert_true (error != g_steal_pointer (&fake_dev->ret_error));
|
|
|
|
|
@@ -1155,8 +1239,8 @@ test_driver_verify_complete_retry (void)
|
|
|
|
|
test_driver_match_data_clear (match_data);
|
|
|
|
|
fake_dev->ret_result = FPI_MATCH_ERROR;
|
|
|
|
|
|
|
|
|
|
fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
|
|
|
|
|
match_data, &match, &print, &error);
|
|
|
|
|
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
|
|
|
|
|
match_data, &match, &print, &error));
|
|
|
|
|
g_test_assert_expected_messages ();
|
|
|
|
|
|
|
|
|
|
g_assert_true (error != g_steal_pointer (&fake_dev->ret_error));
|
|
|
|
|
@@ -1174,12 +1258,12 @@ test_driver_verify_complete_retry (void)
|
|
|
|
|
test_driver_match_data_clear (match_data);
|
|
|
|
|
fake_dev->ret_result = FPI_MATCH_ERROR;
|
|
|
|
|
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_TOO_SHORT);
|
|
|
|
|
fake_dev->ret_print = fp_print_new (device);
|
|
|
|
|
fake_dev->ret_print = make_fake_print (device, NULL);
|
|
|
|
|
g_object_add_weak_pointer (G_OBJECT (fake_dev->ret_print),
|
|
|
|
|
(gpointer) (&fake_dev->ret_print));
|
|
|
|
|
|
|
|
|
|
fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
|
|
|
|
|
match_data, &match, &print, &error);
|
|
|
|
|
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
|
|
|
|
|
match_data, &match, &print, &error));
|
|
|
|
|
g_test_assert_expected_messages ();
|
|
|
|
|
|
|
|
|
|
g_assert_error (error, FP_DEVICE_RETRY, FP_DEVICE_RETRY_TOO_SHORT);
|
|
|
|
|
@@ -1228,25 +1312,23 @@ test_driver_identify (void)
|
|
|
|
|
g_autoptr(FpPrint) print = NULL;
|
|
|
|
|
g_autoptr(FpPrint) matched_print = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
|
|
|
|
|
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
|
|
|
|
|
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 500);
|
|
|
|
|
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
FpPrint *expected_matched;
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 500; ++i)
|
|
|
|
|
g_ptr_array_add (prints, g_object_ref_sink (fp_print_new (device)));
|
|
|
|
|
|
|
|
|
|
expected_matched = g_ptr_array_index (prints, g_random_int_range (0, 499));
|
|
|
|
|
fp_print_set_description (expected_matched, "fake-verified");
|
|
|
|
|
|
|
|
|
|
g_assert_true (fp_device_supports_identify (device));
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_print = fp_print_new (device);
|
|
|
|
|
fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&matched_print, &print, &error);
|
|
|
|
|
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,
|
|
|
|
|
&matched_print, &print, &error));
|
|
|
|
|
|
|
|
|
|
g_assert_true (match_data->called);
|
|
|
|
|
g_assert_nonnull (match_data->match);
|
|
|
|
|
@@ -1254,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);
|
|
|
|
|
@@ -1268,21 +1349,17 @@ test_driver_identify_fail (void)
|
|
|
|
|
g_autoptr(FpPrint) print = NULL;
|
|
|
|
|
g_autoptr(FpPrint) matched_print = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
|
|
|
|
|
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
|
|
|
|
|
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 500);
|
|
|
|
|
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 500; ++i)
|
|
|
|
|
g_ptr_array_add (prints, g_object_ref_sink (fp_print_new (device)));
|
|
|
|
|
|
|
|
|
|
g_assert_true (fp_device_supports_identify (device));
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_print = fp_print_new (device);
|
|
|
|
|
fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&matched_print, &print, &error);
|
|
|
|
|
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,
|
|
|
|
|
&matched_print, &print, &error));
|
|
|
|
|
|
|
|
|
|
g_assert_true (match_data->called);
|
|
|
|
|
g_assert_null (match_data->match);
|
|
|
|
|
@@ -1304,15 +1381,11 @@ test_driver_identify_retry (void)
|
|
|
|
|
g_autoptr(FpPrint) print = NULL;
|
|
|
|
|
g_autoptr(FpPrint) matched_print = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
|
|
|
|
|
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
|
|
|
|
|
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 500);
|
|
|
|
|
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
FpPrint *expected_matched;
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 500; ++i)
|
|
|
|
|
g_ptr_array_add (prints, g_object_ref_sink (fp_print_new (device)));
|
|
|
|
|
|
|
|
|
|
expected_matched = g_ptr_array_index (prints, g_random_int_range (0, 499));
|
|
|
|
|
fp_print_set_description (expected_matched, "fake-verified");
|
|
|
|
|
@@ -1320,9 +1393,9 @@ test_driver_identify_retry (void)
|
|
|
|
|
g_assert_true (fp_device_supports_identify (device));
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_GENERAL);
|
|
|
|
|
fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&matched_print, &print, &error);
|
|
|
|
|
g_assert_false (fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&matched_print, &print, &error));
|
|
|
|
|
|
|
|
|
|
g_assert_true (match_data->called);
|
|
|
|
|
g_assert_null (match_data->match);
|
|
|
|
|
@@ -1342,15 +1415,11 @@ test_driver_identify_error (void)
|
|
|
|
|
g_autoptr(FpPrint) print = NULL;
|
|
|
|
|
g_autoptr(FpPrint) matched_print = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
|
|
|
|
|
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
|
|
|
|
|
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 500);
|
|
|
|
|
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
FpPrint *expected_matched;
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 500; ++i)
|
|
|
|
|
g_ptr_array_add (prints, g_object_ref_sink (fp_print_new (device)));
|
|
|
|
|
|
|
|
|
|
expected_matched = g_ptr_array_index (prints, g_random_int_range (0, 499));
|
|
|
|
|
fp_print_set_description (expected_matched, "fake-verified");
|
|
|
|
|
@@ -1358,9 +1427,9 @@ test_driver_identify_error (void)
|
|
|
|
|
g_assert_true (fp_device_supports_identify (device));
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_GENERAL);
|
|
|
|
|
fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&matched_print, &print, &error);
|
|
|
|
|
g_assert_false (fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&matched_print, &print, &error));
|
|
|
|
|
|
|
|
|
|
g_assert_false (match_data->called);
|
|
|
|
|
g_assert_null (match_data->match);
|
|
|
|
|
@@ -1384,24 +1453,21 @@ test_driver_identify_not_reported (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FpAutoResetClass) dev_class = auto_reset_device_class ();
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = NULL;
|
|
|
|
|
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
|
|
|
|
|
g_autoptr(GPtrArray) prints = NULL;
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
|
dev_class->identify = fake_device_identify_immediate_complete;
|
|
|
|
|
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 500; ++i)
|
|
|
|
|
g_ptr_array_add (prints, g_object_ref_sink (fp_print_new (device)));
|
|
|
|
|
prints = make_fake_prints_gallery (device, 500);
|
|
|
|
|
|
|
|
|
|
g_assert_true (fp_device_open_sync (device, NULL, NULL));
|
|
|
|
|
|
|
|
|
|
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
|
|
|
|
|
"*reported successful identify complete*not report*result*");
|
|
|
|
|
|
|
|
|
|
fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
NULL, NULL, &error);
|
|
|
|
|
g_assert_false (fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
NULL, NULL, &error));
|
|
|
|
|
|
|
|
|
|
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
|
|
|
|
|
|
|
|
|
|
@@ -1424,21 +1490,18 @@ static void
|
|
|
|
|
test_driver_identify_complete_retry (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FpAutoResetClass) dev_class = auto_reset_device_class ();
|
|
|
|
|
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
|
|
|
|
|
g_autoptr(GPtrArray) prints = NULL;
|
|
|
|
|
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = NULL;
|
|
|
|
|
g_autoptr(FpPrint) print = NULL;
|
|
|
|
|
g_autoptr(FpPrint) match = NULL;
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
FpiDeviceFake *fake_dev;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
dev_class->identify = fake_device_identify_complete_error;
|
|
|
|
|
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
|
|
|
|
|
fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 500; ++i)
|
|
|
|
|
g_ptr_array_add (prints, g_object_ref_sink (fp_print_new (device)));
|
|
|
|
|
prints = make_fake_prints_gallery (device, 500);
|
|
|
|
|
|
|
|
|
|
g_assert_true (fp_device_open_sync (device, NULL, NULL));
|
|
|
|
|
|
|
|
|
|
@@ -1450,8 +1513,9 @@ test_driver_identify_complete_retry (void)
|
|
|
|
|
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_TOO_SHORT);
|
|
|
|
|
fake_dev->user_data = g_error_copy (fake_dev->ret_error);
|
|
|
|
|
|
|
|
|
|
fp_device_identify_sync (device, prints, NULL, test_driver_match_cb, match_data,
|
|
|
|
|
&match, &print, &error);
|
|
|
|
|
g_assert_false (fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &print, &error));
|
|
|
|
|
g_test_assert_expected_messages ();
|
|
|
|
|
|
|
|
|
|
g_assert_true (error != g_steal_pointer (&fake_dev->ret_error));
|
|
|
|
|
@@ -1467,11 +1531,12 @@ test_driver_identify_complete_retry (void)
|
|
|
|
|
"*Driver reported a match to a print that was not in the gallery*");
|
|
|
|
|
|
|
|
|
|
test_driver_match_data_clear (match_data);
|
|
|
|
|
fake_dev->ret_match = fp_print_new (device);
|
|
|
|
|
fake_dev->ret_match = make_fake_print_reffed (device, NULL);
|
|
|
|
|
g_object_add_weak_pointer (G_OBJECT (fake_dev->ret_match),
|
|
|
|
|
(gpointer) (&fake_dev->ret_match));
|
|
|
|
|
fp_device_identify_sync (device, prints, NULL, test_driver_match_cb, match_data,
|
|
|
|
|
&match, &print, &error);
|
|
|
|
|
g_assert_true (fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &print, &error));
|
|
|
|
|
g_test_assert_expected_messages ();
|
|
|
|
|
|
|
|
|
|
g_object_unref (fake_dev->ret_match);
|
|
|
|
|
@@ -1490,11 +1555,12 @@ test_driver_identify_complete_retry (void)
|
|
|
|
|
test_driver_match_data_clear (match_data);
|
|
|
|
|
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_REMOVE_FINGER);
|
|
|
|
|
fake_dev->ret_match = prints->pdata[0];
|
|
|
|
|
fake_dev->ret_print = fp_print_new (device);
|
|
|
|
|
fake_dev->ret_print = make_fake_print (device, NULL);
|
|
|
|
|
g_object_add_weak_pointer (G_OBJECT (fake_dev->ret_print),
|
|
|
|
|
(gpointer) (&fake_dev->ret_print));
|
|
|
|
|
fp_device_identify_sync (device, prints, NULL, test_driver_match_cb, match_data,
|
|
|
|
|
&match, &print, &error);
|
|
|
|
|
g_assert_false (fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &print, &error));
|
|
|
|
|
g_test_assert_expected_messages ();
|
|
|
|
|
|
|
|
|
|
g_assert_error (error, FP_DEVICE_RETRY, FP_DEVICE_RETRY_REMOVE_FINGER);
|
|
|
|
|
@@ -1512,7 +1578,7 @@ test_driver_identify_report_no_callback (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FpAutoResetClass) dev_class = auto_reset_device_class ();
|
|
|
|
|
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
|
|
|
|
|
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
|
|
|
|
|
g_autoptr(GPtrArray) prints = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = NULL;
|
|
|
|
|
G_GNUC_UNUSED g_autoptr(FpPrint) enrolled_print = NULL;
|
|
|
|
|
g_autoptr(FpPrint) print = NULL;
|
|
|
|
|
@@ -1523,7 +1589,8 @@ test_driver_identify_report_no_callback (void)
|
|
|
|
|
dev_class->identify = fake_device_identify_complete_error;
|
|
|
|
|
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
|
|
|
|
|
fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
enrolled_print = g_object_ref_sink (fp_print_new (device));
|
|
|
|
|
prints = make_fake_prints_gallery (device, 0);
|
|
|
|
|
enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
|
|
|
|
|
g_assert_true (fp_device_open_sync (device, NULL, NULL));
|
|
|
|
|
|
|
|
|
|
@@ -1531,9 +1598,9 @@ test_driver_identify_report_no_callback (void)
|
|
|
|
|
"*Driver reported a verify error that was not in the retry domain*");
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_NOT_SUPPORTED);
|
|
|
|
|
fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &print, &error);
|
|
|
|
|
g_assert_false (fp_device_identify_sync (device, prints, NULL,
|
|
|
|
|
test_driver_match_cb, match_data,
|
|
|
|
|
&match, &print, &error));
|
|
|
|
|
|
|
|
|
|
g_test_assert_expected_messages ();
|
|
|
|
|
|
|
|
|
|
@@ -1650,15 +1717,10 @@ test_driver_list (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
|
|
|
|
|
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 500);
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
|
|
|
|
|
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 500; ++i)
|
|
|
|
|
g_ptr_array_add (prints, fp_print_new (device));
|
|
|
|
|
|
|
|
|
|
fake_dev->ret_list = g_steal_pointer (&prints);
|
|
|
|
|
prints = fp_device_list_prints_sync (device, NULL, &error);
|
|
|
|
|
|
|
|
|
|
@@ -1711,7 +1773,7 @@ test_driver_delete (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = fp_print_new (device);
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
gboolean ret;
|
|
|
|
|
@@ -1728,7 +1790,7 @@ test_driver_delete_error (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = fp_print_new (device);
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
gboolean ret;
|
|
|
|
|
@@ -1796,7 +1858,7 @@ test_driver_cancel (void)
|
|
|
|
|
device = auto_close_fake_device_new ();
|
|
|
|
|
fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
cancellable = g_cancellable_new ();
|
|
|
|
|
enrolled_print = fp_print_new (device);
|
|
|
|
|
enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
|
|
|
|
|
fp_device_delete_print (device, enrolled_print, cancellable,
|
|
|
|
|
on_driver_cancel_delete, &completed);
|
|
|
|
|
@@ -1814,11 +1876,11 @@ test_driver_cancel_fail (void)
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
|
|
|
|
|
g_autoptr(GCancellable) cancellable = g_cancellable_new ();
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = fp_print_new (device);
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
|
|
|
|
|
fp_device_delete_print_sync (device, enrolled_print, cancellable, &error);
|
|
|
|
|
g_assert_true (fp_device_delete_print_sync (device, enrolled_print, cancellable, &error));
|
|
|
|
|
g_assert (fake_dev->last_called_function == dev_class->delete);
|
|
|
|
|
g_cancellable_cancel (cancellable);
|
|
|
|
|
|
|
|
|
|
@@ -1889,7 +1951,7 @@ test_driver_action_get_cancellable_open (void)
|
|
|
|
|
fake_dev = FPI_DEVICE_FAKE (device);
|
|
|
|
|
|
|
|
|
|
cancellable = g_cancellable_new ();
|
|
|
|
|
fp_device_open_sync (device, cancellable, NULL);
|
|
|
|
|
g_assert_true (fp_device_open_sync (device, cancellable, NULL));
|
|
|
|
|
|
|
|
|
|
g_assert (fake_dev->last_called_function == test_driver_action_get_cancellable_open_vfunc);
|
|
|
|
|
}
|
|
|
|
|
@@ -2048,8 +2110,8 @@ static void
|
|
|
|
|
test_driver_action_error_all (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
|
|
|
|
|
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 0);
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
FpiDeviceFake *fake_dev;
|
|
|
|
|
@@ -2120,8 +2182,8 @@ static void
|
|
|
|
|
test_driver_action_error_fallback_all (void)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(FpAutoCloseDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
|
|
|
|
|
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
|
|
|
|
|
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
|
|
|
|
|
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 0);
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
|
|
|
|
FpiDeviceFake *fake_dev;
|
|
|
|
|
|