From: Takashi Sakamoto Date: Sun, 19 Jun 2022 11:38:51 +0000 (+0900) Subject: tests: add test script for ALSACtl.ElemId boxed structure X-Git-Tag: v0.3.0~82 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=be241ddab8790f65922eb5e627406df064672290;p=alsa-gobject.git tests: add test script for ALSACtl.ElemId boxed structure Signed-off-by: Takashi Sakamoto --- diff --git a/tests/alsactl-elem-id b/tests/alsactl-elem-id index 0a1226e..b81f5f8 100644 --- a/tests/alsactl-elem-id +++ b/tests/alsactl-elem-id @@ -3,24 +3,22 @@ from sys import exit from errno import ENXIO -from helper import test_object +from helper import test_struct import gi gi.require_version('ALSACtl', '0.0') from gi.repository import ALSACtl -target = ALSACtl.ElemId() -props = () +target_type = ALSACtl.ElemId methods = ( 'get_numid', 'get_iface', - 'get_device', - 'get_subdevice', + 'get_device_id', + 'get_subdevice_id', 'get_name', 'get_index', - 'equals', + 'equal', ) -signals = () -if not test_object(target, props, methods, signals): +if not test_struct(target_type, methods): exit(ENXIO) diff --git a/tests/helper.py b/tests/helper.py index 2ab15dc..a9c1f53 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -27,3 +27,11 @@ def test_enums(target_type: object, enumerations: tuple[str]) -> bool: enumeration, target_type)) return False return True + + +def test_struct(target_type: object, methods: tuple[str]) -> bool: + for method in methods: + if not hasattr(target_type, method): + print('Method {0} is not produced.'.format(method)) + return False + return True diff --git a/tests/meson.build b/tests/meson.build index e7015fd..e6d931a 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -13,6 +13,7 @@ tests = { 'alsactl-elem-info-integer64', 'alsactl-elem-info-enumerated', 'alsactl-elem-value', + 'alsactl-elem-id', ], 'timer': [ 'alsatimer-enums',