forked from openlp/openlp
Fix tests and code
This commit is contained in:
parent
fc675e9c99
commit
c24fb0cb59
@ -69,39 +69,6 @@ class ItemMediaInfo(object):
|
|||||||
media_type = MediaType()
|
media_type = MediaType()
|
||||||
|
|
||||||
|
|
||||||
# def get_media_players():
|
|
||||||
# """
|
|
||||||
# This method extracts the configured media players and overridden player
|
|
||||||
# from the settings.
|
|
||||||
# """
|
|
||||||
# log.debug('get_media_players')
|
|
||||||
# saved_players = Settings().value('media/players')
|
|
||||||
# reg_ex = QtCore.QRegExp(r'.*\[(.*)\].*')
|
|
||||||
# if Settings().value('media/override player') == QtCore.Qt.Checked:
|
|
||||||
# if reg_ex.exactMatch(saved_players):
|
|
||||||
# overridden_player = '{text}'.format(text=reg_ex.cap(1))
|
|
||||||
# else:
|
|
||||||
# overridden_player = 'auto'
|
|
||||||
# else:
|
|
||||||
# overridden_player = ''
|
|
||||||
# saved_players_list = saved_players.replace('[', '').replace(']', '').split(',') if saved_players else []
|
|
||||||
# return saved_players_list, overridden_player
|
|
||||||
|
|
||||||
|
|
||||||
# def set_media_players(players_list, overridden_player='auto'):
|
|
||||||
# """
|
|
||||||
# This method saves the configured media players and overridden player to the settings
|
|
||||||
#
|
|
||||||
# :param players_list: A list with all active media players.
|
|
||||||
# :param overridden_player: Here an special media player is chosen for all media actions.
|
|
||||||
# """
|
|
||||||
# log.debug('set_media_players')
|
|
||||||
# players = ','.join(players_list)
|
|
||||||
# if Settings().value('media/override player') == QtCore.Qt.Checked and overridden_player != 'auto':
|
|
||||||
# players = players.replace(overridden_player, '[{text}]'.format(text=overridden_player))
|
|
||||||
# Settings().setValue('media/players', players)
|
|
||||||
|
|
||||||
|
|
||||||
def parse_optical_path(input_string):
|
def parse_optical_path(input_string):
|
||||||
"""
|
"""
|
||||||
Split the optical path info.
|
Split the optical path info.
|
||||||
|
@ -138,7 +138,6 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
Registry().register_function('songs_hide', self.media_hide)
|
Registry().register_function('songs_hide', self.media_hide)
|
||||||
Registry().register_function('songs_blank', self.media_blank)
|
Registry().register_function('songs_blank', self.media_blank)
|
||||||
Registry().register_function('songs_unblank', self.media_unblank)
|
Registry().register_function('songs_unblank', self.media_unblank)
|
||||||
# Registry().register_function('mediaitem_media_rebuild', self._set_active_players)
|
|
||||||
Registry().register_function('mediaitem_suffixes', self._generate_extensions_lists)
|
Registry().register_function('mediaitem_suffixes', self._generate_extensions_lists)
|
||||||
register_endpoint(media_endpoint)
|
register_endpoint(media_endpoint)
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import os
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
|
from openlp.core.state import State
|
||||||
from openlp.core.common import md5_hash
|
from openlp.core.common import md5_hash
|
||||||
from openlp.core.common.path import Path
|
from openlp.core.common.path import Path
|
||||||
from openlp.core.common.registry import Registry
|
from openlp.core.common.registry import Registry
|
||||||
@ -110,8 +111,11 @@ class TestServiceItem(TestCase, TestMixin):
|
|||||||
service_item.add_icon = MagicMock()
|
service_item.add_icon = MagicMock()
|
||||||
FormattingTags.load_tags()
|
FormattingTags.load_tags()
|
||||||
|
|
||||||
# WHEN: We add a custom from a saved service
|
# WHEN: We add a custom from a saved serviceand set the media state
|
||||||
line = convert_file_service_item(TEST_PATH, 'serviceitem_custom_1.osj')
|
line = convert_file_service_item(TEST_PATH, 'serviceitem_custom_1.osj')
|
||||||
|
State().add_service("media", 0)
|
||||||
|
State().update_pre_conditions("media", True)
|
||||||
|
State().flush_preconditions()
|
||||||
service_item.set_from_service(line)
|
service_item.set_from_service(line)
|
||||||
|
|
||||||
# THEN: We should get back a valid service item
|
# THEN: We should get back a valid service item
|
||||||
|
Loading…
Reference in New Issue
Block a user