forked from openlp/openlp
fix bits
This commit is contained in:
parent
7be849681a
commit
3bfa92cd47
@ -193,8 +193,8 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties):
|
|||||||
if self.service_item.is_capable(ItemCapabilities.HasThumbnails):
|
if self.service_item.is_capable(ItemCapabilities.HasThumbnails):
|
||||||
image = self.image_manager.get_image(frame['image'], ImageSource.CommandPlugins)
|
image = self.image_manager.get_image(frame['image'], ImageSource.CommandPlugins)
|
||||||
pixmap = QtGui.QPixmap.fromImage(image)
|
pixmap = QtGui.QPixmap.fromImage(image)
|
||||||
# else:
|
else:
|
||||||
# pixmap = frame['image'].pixmap(80, 80)
|
pixmap = frame['image'].pixmap(80, 80)
|
||||||
else:
|
else:
|
||||||
image = self.image_manager.get_image(frame['path'], ImageSource.ImagePlugin)
|
image = self.image_manager.get_image(frame['path'], ImageSource.ImagePlugin)
|
||||||
pixmap = QtGui.QPixmap.fromImage(image)
|
pixmap = QtGui.QPixmap.fromImage(image)
|
||||||
|
@ -34,9 +34,8 @@ from openlp.core.common.registry import Registry
|
|||||||
from openlp.core.common.settings import Settings
|
from openlp.core.common.settings import Settings
|
||||||
from openlp.core.lib import MediaType, ServiceItemContext, check_item_selected
|
from openlp.core.lib import MediaType, ServiceItemContext, check_item_selected
|
||||||
from openlp.core.lib.mediamanageritem import MediaManagerItem
|
from openlp.core.lib.mediamanageritem import MediaManagerItem
|
||||||
from openlp.core.lib.serviceitem import ItemCapabilities, ServiceItem
|
from openlp.core.lib.serviceitem import ItemCapabilities
|
||||||
from openlp.core.lib.ui import create_widget_action, critical_error_message_box, create_horizontal_adjusting_combo_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.ui import DisplayControllerType
|
|
||||||
from openlp.core.ui.icons import UiIcons
|
from openlp.core.ui.icons import UiIcons
|
||||||
from openlp.core.ui.media import parse_optical_path, format_milliseconds
|
from openlp.core.ui.media import parse_optical_path, format_milliseconds
|
||||||
from openlp.core.ui.media.vlcplayer import get_vlc
|
from openlp.core.ui.media.vlcplayer import get_vlc
|
||||||
|
@ -32,6 +32,9 @@ from PyQt5 import QtGui
|
|||||||
from openlp.core.common.i18n import UiStrings
|
from openlp.core.common.i18n import UiStrings
|
||||||
from openlp.core.lib import ImageSource
|
from openlp.core.lib import ImageSource
|
||||||
from openlp.core.widgets.views import ListPreviewWidget, ListWidgetWithDnD, TreeWidgetWithDnD, handle_mime_data_urls
|
from openlp.core.widgets.views import ListPreviewWidget, ListWidgetWithDnD, TreeWidgetWithDnD, handle_mime_data_urls
|
||||||
|
from openlp.core.ui.icons import UiIcons
|
||||||
|
|
||||||
|
CLAPPERBOARD = UiIcons().clapperboard
|
||||||
|
|
||||||
|
|
||||||
class TestHandleMimeDataUrls(TestCase):
|
class TestHandleMimeDataUrls(TestCase):
|
||||||
@ -148,16 +151,16 @@ class TestListPreviewWidget(TestCase):
|
|||||||
mocked_img_service_item.is_media.return_value = False
|
mocked_img_service_item.is_media.return_value = False
|
||||||
mocked_img_service_item.is_command.return_value = False
|
mocked_img_service_item.is_command.return_value = False
|
||||||
mocked_img_service_item.is_capable.return_value = False
|
mocked_img_service_item.is_capable.return_value = False
|
||||||
mocked_img_service_item.get_frames.return_value = [{'title': None, 'path': 'TEST1', 'image': 'FAIL'},
|
mocked_img_service_item.get_frames.return_value = [{'title': None, 'path': 'TEST1', 'image': CLAPPERBOARD},
|
||||||
{'title': None, 'path': 'TEST2', 'image': 'FAIL'}]
|
{'title': None, 'path': 'TEST2', 'image': CLAPPERBOARD}]
|
||||||
# Mock Command service item
|
# Mock Command service item
|
||||||
mocked_cmd_service_item = MagicMock()
|
mocked_cmd_service_item = MagicMock()
|
||||||
mocked_cmd_service_item.is_text.return_value = False
|
mocked_cmd_service_item.is_text.return_value = False
|
||||||
mocked_cmd_service_item.is_media.return_value = False
|
mocked_cmd_service_item.is_media.return_value = False
|
||||||
mocked_cmd_service_item.is_command.return_value = True
|
mocked_cmd_service_item.is_command.return_value = True
|
||||||
mocked_cmd_service_item.is_capable.return_value = True
|
mocked_cmd_service_item.is_capable.return_value = True
|
||||||
mocked_cmd_service_item.get_frames.return_value = [{'title': None, 'path': 'FAIL', 'image': 'TEST3'},
|
mocked_cmd_service_item.get_frames.return_value = [{'title': None, 'path': 'FAIL', 'image': CLAPPERBOARD},
|
||||||
{'title': None, 'path': 'FAIL', 'image': 'TEST4'}]
|
{'title': None, 'path': 'FAIL', 'image': CLAPPERBOARD}]
|
||||||
# Mock image_manager
|
# Mock image_manager
|
||||||
mocked_image_manager.get_image.return_value = QtGui.QImage()
|
mocked_image_manager.get_image.return_value = QtGui.QImage()
|
||||||
|
|
||||||
@ -223,8 +226,8 @@ class TestListPreviewWidget(TestCase):
|
|||||||
service_item = MagicMock()
|
service_item = MagicMock()
|
||||||
service_item.is_text.return_value = False
|
service_item.is_text.return_value = False
|
||||||
service_item.is_capable.return_value = False
|
service_item.is_capable.return_value = False
|
||||||
service_item.get_frames.return_value = [{'title': None, 'path': None, 'image': None},
|
service_item.get_frames.return_value = [{'title': None, 'path': None, 'image': CLAPPERBOARD},
|
||||||
{'title': None, 'path': None, 'image': None}]
|
{'title': None, 'path': None, 'image': CLAPPERBOARD}]
|
||||||
# init ListPreviewWidget and load service item
|
# init ListPreviewWidget and load service item
|
||||||
list_preview_widget = ListPreviewWidget(None, 1)
|
list_preview_widget = ListPreviewWidget(None, 1)
|
||||||
list_preview_widget.replace_service_item(service_item, 200, 0)
|
list_preview_widget.replace_service_item(service_item, 200, 0)
|
||||||
@ -260,8 +263,8 @@ class TestListPreviewWidget(TestCase):
|
|||||||
service_item = MagicMock()
|
service_item = MagicMock()
|
||||||
service_item.is_text.return_value = False
|
service_item.is_text.return_value = False
|
||||||
service_item.is_capable.return_value = False
|
service_item.is_capable.return_value = False
|
||||||
service_item.get_frames.return_value = [{'title': None, 'path': None, 'image': None},
|
service_item.get_frames.return_value = [{'title': None, 'path': None, 'image': CLAPPERBOARD},
|
||||||
{'title': None, 'path': None, 'image': None}]
|
{'title': None, 'path': None, 'image': CLAPPERBOARD}]
|
||||||
# init ListPreviewWidget and load service item
|
# init ListPreviewWidget and load service item
|
||||||
list_preview_widget = ListPreviewWidget(None, 1)
|
list_preview_widget = ListPreviewWidget(None, 1)
|
||||||
list_preview_widget.replace_service_item(service_item, 200, 0)
|
list_preview_widget.replace_service_item(service_item, 200, 0)
|
||||||
@ -296,8 +299,8 @@ class TestListPreviewWidget(TestCase):
|
|||||||
service_item = MagicMock()
|
service_item = MagicMock()
|
||||||
service_item.is_text.return_value = False
|
service_item.is_text.return_value = False
|
||||||
service_item.is_capable.return_value = False
|
service_item.is_capable.return_value = False
|
||||||
service_item.get_frames.return_value = [{'title': None, 'path': None, 'image': None},
|
service_item.get_frames.return_value = [{'title': None, 'path': None, 'image': CLAPPERBOARD},
|
||||||
{'title': None, 'path': None, 'image': None}]
|
{'title': None, 'path': None, 'image': CLAPPERBOARD}]
|
||||||
# init ListPreviewWidget and load service item
|
# init ListPreviewWidget and load service item
|
||||||
list_preview_widget = ListPreviewWidget(None, 1)
|
list_preview_widget = ListPreviewWidget(None, 1)
|
||||||
list_preview_widget.replace_service_item(service_item, 200, 0)
|
list_preview_widget.replace_service_item(service_item, 200, 0)
|
||||||
@ -333,8 +336,8 @@ class TestListPreviewWidget(TestCase):
|
|||||||
# Mock text service item
|
# Mock text service item
|
||||||
service_item = MagicMock()
|
service_item = MagicMock()
|
||||||
service_item.is_text.return_value = True
|
service_item.is_text.return_value = True
|
||||||
service_item.get_frames.return_value = [{'title': None, 'text': None, 'verseTag': None},
|
service_item.get_frames.return_value = [{'title': None, 'text': None, 'verseTag': CLAPPERBOARD},
|
||||||
{'title': None, 'text': None, 'verseTag': None}]
|
{'title': None, 'text': None, 'verseTag': CLAPPERBOARD}]
|
||||||
# Mock self.cellWidget().children().setMaximumWidth()
|
# Mock self.cellWidget().children().setMaximumWidth()
|
||||||
mocked_cellWidget_child = MagicMock()
|
mocked_cellWidget_child = MagicMock()
|
||||||
mocked_cellWidget_obj = MagicMock()
|
mocked_cellWidget_obj = MagicMock()
|
||||||
@ -368,8 +371,8 @@ class TestListPreviewWidget(TestCase):
|
|||||||
service_item = MagicMock()
|
service_item = MagicMock()
|
||||||
service_item.is_text.return_value = False
|
service_item.is_text.return_value = False
|
||||||
service_item.is_capable.return_value = False
|
service_item.is_capable.return_value = False
|
||||||
service_item.get_frames.return_value = [{'title': None, 'path': None, 'image': None},
|
service_item.get_frames.return_value = [{'title': None, 'path': None, 'image': CLAPPERBOARD},
|
||||||
{'title': None, 'path': None, 'image': None}]
|
{'title': None, 'path': None, 'image': CLAPPERBOARD}]
|
||||||
# Mock self.cellWidget().children().setMaximumWidth()
|
# Mock self.cellWidget().children().setMaximumWidth()
|
||||||
mocked_cellWidget_child = MagicMock()
|
mocked_cellWidget_child = MagicMock()
|
||||||
mocked_cellWidget_obj = MagicMock()
|
mocked_cellWidget_obj = MagicMock()
|
||||||
@ -405,8 +408,8 @@ class TestListPreviewWidget(TestCase):
|
|||||||
service_item = MagicMock()
|
service_item = MagicMock()
|
||||||
service_item.is_text.return_value = False
|
service_item.is_text.return_value = False
|
||||||
service_item.is_capable.return_value = False
|
service_item.is_capable.return_value = False
|
||||||
service_item.get_frames.return_value = [{'title': None, 'path': None, 'image': None},
|
service_item.get_frames.return_value = [{'title': None, 'path': None, 'image': CLAPPERBOARD},
|
||||||
{'title': None, 'path': None, 'image': None}]
|
{'title': None, 'path': None, 'image': CLAPPERBOARD}]
|
||||||
# Mock self.cellWidget().children().setMaximumWidth()
|
# Mock self.cellWidget().children().setMaximumWidth()
|
||||||
mocked_cellWidget_child = MagicMock()
|
mocked_cellWidget_child = MagicMock()
|
||||||
mocked_cellWidget_obj = MagicMock()
|
mocked_cellWidget_obj = MagicMock()
|
||||||
@ -440,8 +443,8 @@ class TestListPreviewWidget(TestCase):
|
|||||||
service_item = MagicMock()
|
service_item = MagicMock()
|
||||||
service_item.is_text.return_value = False
|
service_item.is_text.return_value = False
|
||||||
service_item.is_capable.return_value = False
|
service_item.is_capable.return_value = False
|
||||||
service_item.get_frames.return_value = [{'title': None, 'path': None, 'image': None},
|
service_item.get_frames.return_value = [{'title': None, 'path': None, 'image': CLAPPERBOARD},
|
||||||
{'title': None, 'path': None, 'image': None}]
|
{'title': None, 'path': None, 'image': CLAPPERBOARD}]
|
||||||
# Mock self.cellWidget().children()
|
# Mock self.cellWidget().children()
|
||||||
mocked_cellWidget_obj = MagicMock()
|
mocked_cellWidget_obj = MagicMock()
|
||||||
mocked_cellWidget_obj.children.return_value = None
|
mocked_cellWidget_obj.children.return_value = None
|
||||||
|
Loading…
Reference in New Issue
Block a user