libfprint/SOURCES/0148-tests-Add-a-reference-to-the-enrolled-print-before-r.patch
2021-09-09 20:12:48 +00:00

65 lines
2.4 KiB
Diff

From 006cef0a5f97c22c2860d419c8d48fd8c849b58b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Tue, 17 Dec 2019 03:28:12 +0100
Subject: [PATCH 148/181] tests: Add a reference to the enrolled print before
returning it
---
tests/test-device-fake.c | 4 +++-
tests/test-fpi-device.c | 8 +++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/tests/test-device-fake.c b/tests/test-device-fake.c
index 096d140..eaa1fa6 100644
--- a/tests/test-device-fake.c
+++ b/tests/test-device-fake.c
@@ -77,7 +77,9 @@ fpi_device_fake_enroll (FpDevice *device)
fpi_device_get_enroll_data (device, &print);
fake_dev->last_called_function = fpi_device_fake_enroll;
- fpi_device_enroll_complete (device, print, fake_dev->ret_error);
+ fpi_device_enroll_complete (device,
+ print ? g_object_ref (print) : NULL,
+ fake_dev->ret_error);
}
static void
diff --git a/tests/test-fpi-device.c b/tests/test-fpi-device.c
index b269ec4..398407a 100644
--- a/tests/test-fpi-device.c
+++ b/tests/test-fpi-device.c
@@ -393,9 +393,9 @@ test_driver_enroll (void)
{
g_autoptr(GError) error = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
+ g_autoptr(FpPrint) template_print = fp_print_new (device);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
- FpPrint *template_print = fp_print_new (device);
FpPrint *out_print = NULL;
out_print =
@@ -520,6 +520,7 @@ test_driver_enroll_progress (void)
{
g_autoptr(FpAutoResetClass) dev_class = auto_reset_device_class ();
g_autoptr(FpAutoCloseDevice) device = NULL;
+ g_autoptr(FpPrint) enrolled_print = NULL;
ExpectedEnrollData expected_enroll_data = {0};
FpiDeviceFake *fake_dev;
@@ -535,8 +536,9 @@ test_driver_enroll_progress (void)
fake_dev = FPI_DEVICE_FAKE (device);
fake_dev->user_data = &expected_enroll_data;
- fp_device_enroll_sync (device, fp_print_new (device), NULL,
- test_driver_enroll_progress_callback, &expected_enroll_data, NULL);
+ enrolled_print = fp_device_enroll_sync (device, fp_print_new (device), NULL,
+ test_driver_enroll_progress_callback,
+ &expected_enroll_data, NULL);
g_assert (fake_dev->last_called_function == test_driver_enroll_progress_vfunc);
}
--
2.24.1