aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2022-06-17 17:37:29 +0900
committer坂本 貴史 <o-takashi@sakamocchi.jp>2022-06-19 19:02:17 +0900
commit7d96b547b3c77221b9a1f8049aa93ccb312e4ae3 (patch)
tree235cdd1c1d90196836fc6f24b3441098cef796ac
parentb88d6e4f9c9006aac6ed822583c3a924ce971ee3 (diff)
downloadlibhinawa-7d96b547b3c77221b9a1f8049aa93ccb312e4ae3.tar.gz
tests: add test script for Hinawa.SndMotuRegisterDspParameter boxed structure
The available methods of boxed structure are available by attributes of object. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--tests/helper.py8
-rw-r--r--tests/meson.build1
-rw-r--r--tests/snd-motu-register-dsp-parameter32
3 files changed, 41 insertions, 0 deletions
diff --git a/tests/helper.py b/tests/helper.py
index 3a8e6fe..b845a70 100644
--- a/tests/helper.py
+++ b/tests/helper.py
@@ -31,3 +31,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 988773e..8bfd50d 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -10,6 +10,7 @@ tests = [
'snd-motu',
'snd-tscm',
'hinawa-enum',
+ 'snd-motu-register-dsp-parameter',
]
envs = environment()
diff --git a/tests/snd-motu-register-dsp-parameter b/tests/snd-motu-register-dsp-parameter
new file mode 100644
index 0000000..b84d788
--- /dev/null
+++ b/tests/snd-motu-register-dsp-parameter
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+from sys import exit
+from errno import ENXIO
+
+from helper import test_struct
+
+import gi
+gi.require_version('Hinawa', '3.0')
+from gi.repository import Hinawa
+
+target_type = Hinawa.SndMotuRegisterDspParameter
+methods = (
+ 'new',
+ 'get_mixer_source_gain',
+ 'get_mixer_source_pan',
+ 'get_mixer_source_flag',
+ 'get_mixer_source_paired_balance',
+ 'get_mixer_source_paired_width',
+ 'get_mixer_output_paired_volume',
+ 'get_mixer_output_paired_flag',
+ 'get_main_output_paired_volume',
+ 'get_headphone_output_paired_volume',
+ 'get_headphone_output_paired_assignment',
+ 'get_line_input_boost_flag',
+ 'get_line_input_nominal_level_flag',
+ 'get_input_gain_and_invert',
+ 'get_input_flag',
+)
+
+if not test_struct(target_type, methods):
+ exit(ENXIO)