]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
tests: test virtual functions in object
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>
32 files changed:
tests/alsactl-card
tests/alsactl-card-info
tests/alsactl-elem-info-boolean
tests/alsactl-elem-info-bytes
tests/alsactl-elem-info-enumerated
tests/alsactl-elem-info-iec60958
tests/alsactl-elem-info-integer
tests/alsactl-elem-info-integer64
tests/alsactl-elem-value
tests/alsahwdep-device-info
tests/alsarawmidi-stream-pair
tests/alsarawmidi-substream-info
tests/alsarawmidi-substream-params
tests/alsarawmidi-substream-status
tests/alsaseq-client-info
tests/alsaseq-client-pool
tests/alsaseq-port-info
tests/alsaseq-queue-info
tests/alsaseq-queue-status
tests/alsaseq-queue-tempo
tests/alsaseq-queue-timer-alsa
tests/alsaseq-subscribe-data
tests/alsaseq-system-info
tests/alsaseq-user-client
tests/alsatimer-device-info
tests/alsatimer-device-params
tests/alsatimer-device-status
tests/alsatimer-instance-info
tests/alsatimer-instance-params
tests/alsatimer-instance-status
tests/alsatimer-user-instance
tests/helper.py

index 265b2dbbe72d064b7eda4a72488a3c811a9466d8..48744931834e51b93981446d503dc5bc8fb99820 100644 (file)
@@ -31,6 +31,8 @@ methods = (
     'write_elem_value',
     'read_elem_value',
     'create_source',
+)
+vmethods = (
     'do_handle_elem_event',
     'do_handle_disconnection',
 )
@@ -39,5 +41,5 @@ signals = (
     'handle-disconnection',
 )
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 3d8b65b5068b83f5783813c66c95016d34707319..c7a5e98f76d1f79a0fbde0484b3fd3248f112a27 100644 (file)
@@ -20,7 +20,8 @@ props = (
     'components',
 )
 methods = ()
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 17d19c20345539a6f44cfea7fbe4b3e8032ddac5..8aaba937d7795348ba05fd34bef8a318a678a86a 100644 (file)
@@ -20,7 +20,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 792d2eb7c7231395805b45bf93b0567ffd193a50..0af5bbbae3df964819ce7aa632a486db090c0ae2 100644 (file)
@@ -20,7 +20,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index dcb48437761fab233e49a9d45689ebb9888dca7a..050aa7f054bad26d6355abbd10afba87f55aac4f 100644 (file)
@@ -21,7 +21,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index d81d1843eba5d192e1d728320ff2680f83530c76..a774ab45ce2d02071da8c8b81ed3c9fcef6cc940 100644 (file)
@@ -19,7 +19,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 69a0323b5c3c7d52ad43d088a2f615b308e58de9..ad41810be16c6e8639fcb8551d857350ccc7b17b 100644 (file)
@@ -23,7 +23,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 066fe2edbb4c30a543d1bf0c522b77f7a283000e..129e93758298aea0e3f1f5a1976c808f6b951abd 100644 (file)
@@ -23,7 +23,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index c4a55f786d949c5c0c9a0abfe55b705627d47b31..8dc86ed83c4e44c6d47fe4e863bba2f8e1496f65 100644 (file)
@@ -31,7 +31,8 @@ methods = (
     'get_int64',
     'equal',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 4d27ef87c3548e1aa713451baa97e4f20ec2a1a0..232c7a9865343f6a87aaf23994c31a5649985b2c 100644 (file)
@@ -18,7 +18,8 @@ props = (
     'iface',
 )
 methods = ()
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 5bd2b1b116eac32818d29d37420007d49a032c26..398aa26298139c9f07475e94f09fe4b60e33d91b 100644 (file)
@@ -25,6 +25,8 @@ methods = (
     'drain_substream',
     'drop_substream',
     'create_source',
+)
+vmethods = (
     'do_handle_messages',
     'do_handle_disconnection',
 )
@@ -33,5 +35,5 @@ signals = (
     'handle-disconnection',
 )
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 3d9e87b42c34028646aef08f291660bba1daaef5..11553be064c5b1041563142efb849e5e397abe42 100644 (file)
@@ -23,7 +23,8 @@ props = (
     'subdevices-avail',
 )
 methods = ()
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 5a1b63164b7ecd2e0f82338efc16cb03dc97774c..05b268186e86d0fb01e925cb4055d22f4b1d50c5 100644 (file)
@@ -18,7 +18,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 876b649959ac2bf3bb08d07d4f44fa17fc72fc81..fa1ef3acaa8a5cc52ceec6f5adf90b2142c71bb4 100644 (file)
@@ -17,7 +17,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index b268f8ee965fafad50f2ae95de971b6fd00cdefa..f51c2dc036c02b0e6fb7006d164737e230e846ba 100644 (file)
@@ -26,7 +26,8 @@ methods = (
     'set_event_filter',
     'get_event_filter',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index fd5e1d103a5b0d251b52b9d6147938d6a55d4e9a..86f5e505b119f6352221440d621e8c42b99b69c6 100644 (file)
@@ -19,7 +19,8 @@ props = (
     'input-free',
 )
 methods = ()
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index bb166c233d0b7452cf2b6a8e610c05cd59e73472..ae6e2e54aa084e09b9231a8314467c0da980f57c 100644 (file)
@@ -26,7 +26,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 42fab07f7bd90fd5b18232e49ae386ab9c74e1b0..4eccc0f3591a15aaf87df451071a463d538b68d2 100644 (file)
@@ -19,7 +19,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index d5eca736f22fd6a07123b53e9763d479a295c3b3..c96d6e081a9bdac5faea184fa2827b3cf5e6915b 100644 (file)
@@ -20,7 +20,8 @@ methods = (
     'get_tick_time',
     'get_real_time',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 8aca8f3f0514d8632d17fbbb14c3efa006caac34..9647778ed17b2aa780314197a65153c4e9c8e331 100644 (file)
@@ -20,7 +20,8 @@ methods = (
     'get_skew',
     'set_skew',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 7ac6f63e466a7efc2cd05c1b27b45f9c8010e96f..fdee1ad296aa3f0036eb16cf356db2d1d96b95c1 100644 (file)
@@ -16,12 +16,11 @@ props = (
     'device-id',
     'resolution-ticks',
 )
-
 methods = (
     'new',
 )
-
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 65c3225c2fba3a31599b03103f41147679a3f686..5f6443836dc3b8b3b582b41d7bba499465929b9c 100644 (file)
@@ -21,7 +21,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index e9c43b13f747837f9fbb399b3e759e6205fde102..a01b58fca416b55cc30888d793ef2afc482ed03a 100644 (file)
@@ -19,7 +19,8 @@ props = (
     'current-queue-count',
 )
 methods = ()
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 5ec0b41ece0b3dd8428ac038329b4a216ac9f2b1..f23e8b22d3f84fcec32be98d3abe6bfb858ded7b 100644 (file)
@@ -40,7 +40,12 @@ methods = (
     'remove_events',
     'schedule_events',
 )
-signals = ()
+vmethods = (
+    'do_handle_event',
+)
+signals = (
+    'handle-event',
+)
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 97e31236af99a2783011c326944674a8b83fd8ed..88df917708850f1f4b0d99fc3a791ca12bdad9df 100644 (file)
@@ -21,7 +21,8 @@ props = (
     'instance-count',
 )
 methods = ()
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 377800777029e6b1156dfbad44c10d397992e31b..461e3ea13d7e379a448694bdb196935ce47bdde2 100644 (file)
@@ -17,7 +17,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 4a1382df4f60a493bc51619a940c182604f3cec4..10ca7250dbc57f6c43520630a86016b4148cabc8 100644 (file)
@@ -18,7 +18,8 @@ props = (
 methods = (
     'new',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 25e1588e9f24b6a688fcc802d2487a73ce97e1df..70797e2002894b81e3f49be619610cfd8502a378 100644 (file)
@@ -18,7 +18,8 @@ props = (
     'resolution',
 )
 methods = ()
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 293f9eddb94cb3f0539cce5b02158ddb2ccd8b90..018d956e8aa111cf0e8a850aff43237a2b80a1ae 100644 (file)
@@ -20,7 +20,8 @@ methods = (
     'set_event_filter',
     'get_event_filter',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 4135042136818fc8839cbc2f10d60cac45237f57..440071740be5edc2c69a5c0a950ad00eed39c68e 100644 (file)
@@ -20,7 +20,8 @@ methods = (
     'new',
     'get_tstamp',
 )
+vmethods = ()
 signals = ()
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 4b949061640c3052ca4e8cf7c7ac845679add97e..bb1ace1ca67db97dcf0ccd55c3b8464eed7d6580 100644 (file)
@@ -22,19 +22,21 @@ methods = (
     'set_params',
     'get_status',
     'create_source',
-    'do_handle_tick_event',
-    'do_handle_tstamp_event',
-    'do_handle_disconnection',
     'start',
     'stop',
     'pause',
     'continue_',
 )
+vmethods = (
+    'do_handle_tick_event',
+    'do_handle_tstamp_event',
+    'do_handle_disconnection',
+)
 signals = (
     'handle-tick-event',
     'handle-tstamp-event',
     'handle-disconnection',
 )
 
-if not test_object(target_type, props, methods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
     exit(ENXIO)
index 4cabd50b092b00bf160f5b56bb96fe31307a7574..5a42934d906f9b30675c60e0f77cad5510127c8e 100644 (file)
@@ -1,5 +1,5 @@
 def test_object(target_type: object, props: tuple[str], methods: tuple[str],
-                signals: tuple[str]) -> bool:
+                vmethods: tuple[str], signals: tuple[str]) -> bool:
     # All of available methods are put into the list of attribute.
     for method in methods:
         if not hasattr(target_type, method):
@@ -9,6 +9,7 @@ def test_object(target_type: object, props: tuple[str], methods: tuple[str],
     # The properties, virtual methods, and signals in interface are not put
     # into the list of attribute in object implementing the interface.
     prop_labels = []
+    vmethod_labels = []
     signal_labels = []
 
     # The  gi.ObjectInfo and gi.InterfaceInfo keeps them. Let's traverse them.
@@ -16,6 +17,8 @@ def test_object(target_type: object, props: tuple[str], methods: tuple[str],
         if hasattr(info, '__info__'):
             for prop in info.__info__.get_properties():
                 prop_labels.append(prop.get_name())
+            for vfunc in info.__info__.get_vfuncs():
+                vmethod_labels.append('do_' + vfunc.get_name())
             for signal in info.__info__.get_signals():
                 signal_labels.append(signal.get_name())
 
@@ -23,6 +26,10 @@ def test_object(target_type: object, props: tuple[str], methods: tuple[str],
         if prop not in prop_labels:
             print('Property {0} is not produced.'.format(prop))
             return False
+    for vmethod in vmethods:
+        if vmethod not in vmethod_labels:
+            print('Vmethod {0} is not produced.'.format(vmethod))
+            return False
     for signal in signals:
         if signal not in signal_labels:
             print('Signal {0} is not produced.'.format(signal))