コード例 #1
0
    def test_update_display_with_pre_generated(self, mock_image_manager):
        mock, mock_im_instance, mock_epd = MagicMock(), MagicMock(), MagicMock()
        mock.im_instance, mock.epd = mock_im_instance, mock_epd

        mock_image_manager.return_value = mock_im_instance
        test_epaper_image = EpaperImage(Images.epaper_00pc, Images.epaper_00pc)
        mock_im_instance.get_epaper_image.return_value = test_epaper_image

        image_lock = Lock()
        class_under_test = PictureDisplayManager(image_lock)
        class_under_test.update_display(mock_epd)
        mock.assert_has_calls([call.epd.safe_display(test_epaper_image)])
コード例 #2
0
    def test_update_display_from_filepath(self, mock_image_manager):
        mock, mock_im_instance, mock_epd = MagicMock(), MagicMock(), MagicMock()
        mock.im_instance, mock.epd = mock_im_instance, mock_epd

        mock_image_manager.return_value = mock_im_instance
        empty_epaper_image = EpaperImage()
        mock_im_instance.get_epaper_image.return_value = empty_epaper_image

        test_epaper_image = EpaperImage(MagicMock(), MagicMock())
        mock_im_instance.generate_display_image.return_value = test_epaper_image

        Definitions.READY_IMAGE_BLACK = Definitions.PC33_BLACK_FILEPATH
        Definitions.READY_IMAGE_COLOUR = Definitions.PC33_COLOUR_FILEPATH

        image_lock = Lock()
        class_under_test = PictureDisplayManager(image_lock)

        class_under_test.update_display(mock_epd)
        mock.assert_has_calls([call.epd.safe_display(test_epaper_image)])