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


Python MagicMock.screen_list方法代码示例

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


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

示例1: unblank_screen_test

# 需要导入模块: from tests.functional import MagicMock [as 别名]
# 或者: from tests.functional.MagicMock import screen_list [as 别名]
    def unblank_screen_test(self):
        """
        Test that unblank_screen works as expected
        """
        # GIVEN: A Document with mocked controller, presentation, ScreenList, and mocked function get_slide_number
        with patch('openlp.plugins.presentations.lib.powerpointcontroller.ScreenList') as mocked_screen_list:
            mocked_screen_list_ret = MagicMock()
            mocked_screen_list_ret.screen_list = [1]
            mocked_screen_list.return_value = mocked_screen_list_ret
            doc = PowerpointDocument(self.mock_controller, self.mock_presentation)
            doc.presentation = MagicMock()
            doc.presentation.SlideShowWindow.View.GetClickIndex.return_value = 3
            doc.presentation.Application.Version = 14.0
            doc.get_slide_number = MagicMock()
            doc.get_slide_number.return_value = 2
            doc.index_map[1] = 1
            doc.blank_slide = 1
            doc.blank_click = 1

            # WHEN: Calling goto_slide
            doc.unblank_screen()

            # THEN: The view state have new value, and several function should have been called
            self.assertEquals(doc.presentation.SlideShowWindow.View.State, 1, 'The View State should be 1')
            self.assertEquals(doc.presentation.SlideShowWindow.Activate.called, True,
                              'SlideShowWindow.Activate should have been called')
            self.assertEquals(doc.presentation.SlideShowWindow.View.GotoSlide.called, True,
                              'View.GotoSlide should have been called because of the PowerPoint version')
            self.assertEquals(doc.presentation.SlideShowWindow.View.GotoClick.called, True,
                              'View.GotoClick should have been called because of the PowerPoint version')
开发者ID:crossroadchurch,项目名称:paul,代码行数:32,代码来源:test_powerpointcontroller.py


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