当前位置: 首页>>代码示例>>Python>>正文


Python Controller.cb_signal_handler方法代码示例

本文整理汇总了Python中gstswitch.controller.Controller.cb_signal_handler方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.cb_signal_handler方法的具体用法?Python Controller.cb_signal_handler怎么用?Python Controller.cb_signal_handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gstswitch.controller.Controller的用法示例。


在下文中一共展示了Controller.cb_signal_handler方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_multiple_handler_calls

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import cb_signal_handler [as 别名]
    def test_multiple_handler_calls(self, monkeypatch):
        """Test that the various Handler gets calles"""
        monkeypatch.setattr(Connection, 'connect_dbus', Mock())
        controller = Controller(address='unix:abstract=abcd')

        signals = ('preview_port_added', 'preview_port_removed',
                   'new_mode_online', 'show_face_marker',
                   'show_track_marker', 'select_face')
        test_cbs = {}
        for signal in signals:
            test_cbs[signal] = Mock()
            getattr(controller, 'on_'+signal)(test_cbs[signal])
            getattr(controller, 'on_'+signal)(test_cbs[signal])
            getattr(controller, 'on_'+signal)(test_cbs[signal])

        for signal in signals:
            controller.cb_signal_handler(
                None,
                ':0',
                '/us/timvideos/gstswitch/SwitchControllerInterface',
                'us.timvideos.gstswitch.SwitchControllerInterface',
                signal,
                GLib.Variant('(i)', (123,)),
                None)

        for signal in signals:
            test_cbs[signal].assert_called_with(123)
            assert test_cbs[signal].call_count == 3
开发者ID:techman83,项目名称:gst-switch,代码行数:30,代码来源:test_controller_unit.py

示例2: test_signal_name_collision

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import cb_signal_handler [as 别名]
 def test_signal_name_collision(self, monkeypatch):
     """Test that nothing happens when a signal is on the bus which name
     collides with an attribute also starting with 'callbacks_'
     """
     monkeypatch.setattr(Connection, 'connect_dbus', Mock())
     controller = Controller(address='unix:abstract=abcd')
     controller.callbacks_foobar = 123
     controller.cb_signal_handler(None, ':0', '/foo/bar',
                                  'foo.bar', 'foobar', None, None)
开发者ID:a740122,项目名称:gst-switch,代码行数:11,代码来源:test_controller_unit.py

示例3: test_single_handler_calls

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import cb_signal_handler [as 别名]
    def test_single_handler_calls(self, monkeypatch):
        """Test that the various Handler gets calles"""
        monkeypatch.setattr(Connection, 'connect_dbus', Mock())

        for signal in ('preview_port_added', 'preview_port_removed',
                       'new_mode_online', 'show_face_marker',
                       'show_track_marker', 'select_face'):
            test_cb = Mock()
            controller = Controller(address='unix:abstract=abcd')
            getattr(controller, 'on_'+signal)(test_cb)

            controller.cb_signal_handler(
                None,
                ':0',
                '/us/timvideos/gstswitch/SwitchControllerInterface',
                'us.timvideos.gstswitch.SwitchControllerInterface',
                signal,
                GLib.Variant('(iii)', (5, 10, 20,)),
                None)
            test_cb.assert_called_once_with(5, 10, 20)
开发者ID:techman83,项目名称:gst-switch,代码行数:22,代码来源:test_controller_unit.py

示例4: test_unknown_signal_name

# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import cb_signal_handler [as 别名]
 def test_unknown_signal_name(self, monkeypatch):
     """Test that nothing happens when a unknown signal is on the bus"""
     monkeypatch.setattr(Connection, 'connect_dbus', Mock())
     controller = Controller(address='unix:abstract=abcd')
     controller.cb_signal_handler(None, ':0', '/foo/bar',
                                  'foo.bar', 'foobar', None, None)
开发者ID:techman83,项目名称:gst-switch,代码行数:8,代码来源:test_controller_unit.py


注:本文中的gstswitch.controller.Controller.cb_signal_handler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。