mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-06-10 18:24:19 +00:00
tests: Get tod driver name from env variable
This commit is contained in:
@@ -200,6 +200,7 @@ if get_option('tod')
|
||||
tod_envs.set('FP_TOD_KEEP_MODULES_OPEN', 'TRUE')
|
||||
tod_envs.set('FP_VIRTUAL_FAKE_DEVICE', 'yes')
|
||||
tod_envs.append('FP_DRIVERS_WHITELIST', 'fake_test_dev_tod')
|
||||
tod_envs.set('FP_TOD_TEST_DRIVER_NAME', 'fake_test_dev_tod')
|
||||
tod_c_args = [
|
||||
'-DTEST_TOD_DRIVER=1',
|
||||
]
|
||||
|
||||
@@ -48,10 +48,12 @@ test_context_has_fake_device (void)
|
||||
g_autoptr(FpContext) context = NULL;
|
||||
FpDevice *fake_device = NULL;
|
||||
GPtrArray *devices;
|
||||
const char *tod_name;
|
||||
unsigned int i;
|
||||
|
||||
context = fp_context_new ();
|
||||
devices = fp_context_get_devices (context);
|
||||
tod_name = g_getenv ("FP_TOD_TEST_DRIVER_NAME");
|
||||
|
||||
g_assert_nonnull (devices);
|
||||
g_assert_cmpuint (devices->len, ==, 1);
|
||||
@@ -60,7 +62,7 @@ test_context_has_fake_device (void)
|
||||
{
|
||||
FpDevice *device = devices->pdata[i];
|
||||
|
||||
if (g_strcmp0 (fp_device_get_driver (device), "fake_test_dev_tod") == 0)
|
||||
if (g_strcmp0 (fp_device_get_driver (device), tod_name) == 0)
|
||||
{
|
||||
fake_device = device;
|
||||
break;
|
||||
|
||||
@@ -100,7 +100,7 @@ test_device_open_sync_notify (void)
|
||||
g_autoptr(FptContext) tctx = fpt_context_new_with_fake_dev ();
|
||||
|
||||
g_signal_connect (tctx->device, "notify::open", G_CALLBACK (on_open_notify), tctx);
|
||||
fp_device_open_sync (tctx->device, NULL, &error);
|
||||
g_assert_true (fp_device_open_sync (tctx->device, NULL, &error));
|
||||
g_assert_no_error (error);
|
||||
g_assert_true (GPOINTER_TO_INT (tctx->user_data));
|
||||
}
|
||||
@@ -147,7 +147,7 @@ test_device_get_driver (void)
|
||||
g_autoptr(FptContext) tctx = fpt_context_new_with_fake_dev ();
|
||||
|
||||
fp_device_open_sync (tctx->device, NULL, NULL);
|
||||
g_assert_cmpstr (fp_device_get_driver (tctx->device), ==, "fake_test_dev_tod");
|
||||
g_assert_cmpstr (fp_device_get_driver (tctx->device), ==, g_getenv ("FP_TOD_TEST_DRIVER_NAME"));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -156,7 +156,7 @@ test_device_get_device_id (void)
|
||||
g_autoptr(FptContext) tctx = fpt_context_new_with_fake_dev ();
|
||||
|
||||
fp_device_open_sync (tctx->device, NULL, NULL);
|
||||
g_assert_cmpstr (fp_device_get_device_id (tctx->device), ==, "fake_test_dev_tod");
|
||||
g_assert_cmpstr (fp_device_get_device_id (tctx->device), ==, g_getenv ("FP_TOD_TEST_DRIVER_NAME"));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -28,11 +28,14 @@ fpt_context_new_with_fake_dev (void)
|
||||
{
|
||||
FptContext *tctx;
|
||||
GPtrArray *devices;
|
||||
const char *tod_name;
|
||||
unsigned int i;
|
||||
|
||||
tctx = fpt_context_new ();
|
||||
devices = fp_context_get_devices (tctx->fp_context);
|
||||
tod_name = g_getenv ("FP_TOD_TEST_DRIVER_NAME");
|
||||
|
||||
g_assert_nonnull (tod_name);
|
||||
g_assert_nonnull (devices);
|
||||
g_assert_cmpuint (devices->len, ==, 1);
|
||||
|
||||
@@ -40,7 +43,7 @@ fpt_context_new_with_fake_dev (void)
|
||||
{
|
||||
FpDevice *device = devices->pdata[i];
|
||||
|
||||
if (g_strcmp0 (fp_device_get_driver (device), "fake_test_dev_tod") == 0)
|
||||
if (g_strcmp0 (fp_device_get_driver (device), tod_name) == 0)
|
||||
{
|
||||
tctx->device = device;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user