mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
tests/virtual-image: Support passing specific FP_PRINTS_PATH env variable
This commit is contained in:
@@ -19,6 +19,8 @@ envs.set('FP_DRIVERS_WHITELIST', ':'.join([
|
|||||||
'virtual_device_storage',
|
'virtual_device_storage',
|
||||||
]))
|
]))
|
||||||
|
|
||||||
|
envs.set('FP_PRINTS_PATH', meson.project_source_root() / 'examples' / 'prints')
|
||||||
|
|
||||||
envs.set('NO_AT_BRIDGE', '1')
|
envs.set('NO_AT_BRIDGE', '1')
|
||||||
|
|
||||||
drivers_tests = [
|
drivers_tests = [
|
||||||
|
|||||||
@@ -46,12 +46,15 @@ def load_image(img):
|
|||||||
|
|
||||||
return img
|
return img
|
||||||
|
|
||||||
if hasattr(os.environ, 'MESON_SOURCE_ROOT'):
|
if 'FP_PRINTS_PATH' in os.environ:
|
||||||
root = os.environ['MESON_SOURCE_ROOT']
|
prints_path = os.environ['FP_PRINTS_PATH']
|
||||||
else:
|
else:
|
||||||
root = os.path.join(os.path.dirname(__file__), '..')
|
if 'MESON_SOURCE_ROOT' in os.environ:
|
||||||
|
root = os.environ['MESON_SOURCE_ROOT']
|
||||||
|
else:
|
||||||
|
root = os.path.join(os.path.dirname(__file__), '..')
|
||||||
|
|
||||||
imgdir = os.path.join(root, 'examples', 'prints')
|
prints_path = os.path.join(root, 'examples', 'prints')
|
||||||
|
|
||||||
ctx = GLib.main_context_default()
|
ctx = GLib.main_context_default()
|
||||||
|
|
||||||
@@ -76,10 +79,12 @@ class VirtualImage(unittest.TestCase):
|
|||||||
assert cls.dev is not None, "You need to compile with virtual_image for testing"
|
assert cls.dev is not None, "You need to compile with virtual_image for testing"
|
||||||
|
|
||||||
cls.prints = {}
|
cls.prints = {}
|
||||||
for f in glob.glob(os.path.join(imgdir, '*.png')):
|
for f in glob.glob(os.path.join(prints_path, '*.png')):
|
||||||
n = os.path.basename(f)[:-4]
|
n = os.path.basename(f)[:-4]
|
||||||
cls.prints[n] = load_image(f)
|
cls.prints[n] = load_image(f)
|
||||||
|
|
||||||
|
assert cls.prints, "No prints found in " + prints_path
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
shutil.rmtree(cls.tmpdir)
|
shutil.rmtree(cls.tmpdir)
|
||||||
|
|||||||
Reference in New Issue
Block a user