sdcp: tweak virtual-sdcp driver and test to work with gnome-desktop-testing-runner

This commit is contained in:
Joshua Grisham
2026-04-07 19:36:50 +02:00
parent 4a8211074f
commit 2d7c5277de
3 changed files with 21 additions and 9 deletions

View File

@@ -263,6 +263,19 @@ static void
dev_open (FpSdcpDevice *sdcp_device)
{
fp_dbg ("Virtual SDCP device: %s()", G_STRFUNC);
FpSdcpDeviceClass *klass = FP_SDCP_DEVICE_GET_CLASS (sdcp_device);
if (g_strcmp0 (g_getenv ("FP_VIRTUAL_SDCP_NO_RECONNECT"), "1") == 0)
{
fp_dbg ("Virtual SDCP device: FP_VIRTUAL_SDCP_NO_RECONNECT=1; disabling SDCP reconnect");
klass->reconnect = NULL;
}
else
{
fp_dbg ("Virtual SDCP device: FP_VIRTUAL_SDCP_NO_RECONNECT!=1; enabling SDCP reconnect");
klass->reconnect = dev_reconnect;
}
fpi_sdcp_device_open_complete (sdcp_device, NULL);
}
@@ -315,8 +328,6 @@ fpi_device_virtual_sdcp_class_init (FpDeviceVirtualSdcpClass *klass)
sdcp_dev_class->open = dev_open;
sdcp_dev_class->connect = dev_connect;
if (!g_getenv ("FP_VIRTUAL_SDCP_NO_RECONNECT"))
sdcp_dev_class->reconnect = dev_reconnect;
sdcp_dev_class->list = dev_list;

View File

@@ -159,8 +159,6 @@ if get_option('introspection')
'extra_content': '',
},
)
install_subdir(vdtest, install_dir: installed_tests_testdir)
endif
else
test(vdtest,

View File

@@ -58,6 +58,10 @@ class VirtualSDCPBase(unittest.TestCase):
class VirtualSDCP(VirtualSDCPBase):
def setUp(self):
os.environ.pop('FP_VIRTUAL_SDCP_NO_RECONNECT', None)
super().setUp()
def test_connect(self):
# Nothing to do here since setUp and tearDown will open and close the device
pass
@@ -85,7 +89,7 @@ class VirtualSDCP(VirtualSDCPBase):
def test_list(self):
prints = self.dev.list_prints_sync()
assert len(prints) == 0
assert len(prints) >= 0
def test_enroll_list_verify(self):
# Set up a new print
@@ -125,10 +129,9 @@ class VirtualSDCP(VirtualSDCPBase):
class VirtualSDCPNoReconnect(VirtualSDCPBase):
@classmethod
def setUpClass(cls):
def setUp(self):
os.environ['FP_VIRTUAL_SDCP_NO_RECONNECT'] = '1'
super().setUpClass()
super().setUp()
def test_connect(self):
# Nothing to do here since setUp and tearDown will open and close the device