]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
tests: add test script for ALSACtl.ElemId boxed structure
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 19 Jun 2022 11:38:51 +0000 (20:38 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 19 Jun 2022 11:38:51 +0000 (20:38 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
tests/alsactl-elem-id
tests/helper.py
tests/meson.build

index 0a1226e1d634fe8f4ba1144c85bb03e700128c30..b81f5f849594bba9c6366018435e05028199ff8d 100644 (file)
@@ -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)
index 2ab15dc72c2f55860a11a0d7dec144409a1f39a4..a9c1f532afdca8eef4055f0768451a453f516c5a 100644 (file)
@@ -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
index e7015fda08b5736d570f481b0d3465f50aacdcd8..e6d931a134aa76f30d7cc3d1edf0bf90526f53bf 100644 (file)
@@ -13,6 +13,7 @@ tests = {
     'alsactl-elem-info-integer64',
     'alsactl-elem-info-enumerated',
     'alsactl-elem-value',
+    'alsactl-elem-id',
   ],
   'timer': [
     'alsatimer-enums',