forked from openlp/openlp
update
This commit is contained in:
parent
40981701e9
commit
f2537981e4
@ -253,7 +253,6 @@ if is_win():
|
|||||||
from subprocess import STARTUPINFO, STARTF_USESHOWWINDOW
|
from subprocess import STARTUPINFO, STARTF_USESHOWWINDOW
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def add_actions(target, actions):
|
def add_actions(target, actions):
|
||||||
"""
|
"""
|
||||||
Adds multiple actions to a menu or toolbar in one command.
|
Adds multiple actions to a menu or toolbar in one command.
|
||||||
|
@ -153,11 +153,10 @@ class MediaPlugin(Plugin):
|
|||||||
|
|
||||||
def process_check_binary(program_path):
|
def process_check_binary(program_path):
|
||||||
"""
|
"""
|
||||||
Function that checks whether a binary is either ghostscript or mudraw or neither.
|
Function that checks whether a binary MediaInfo is present
|
||||||
Is also used from presentationtab.py
|
|
||||||
|
|
||||||
:param program_path:The full path to the binary to check.
|
:param program_path:The full path to the binary to check.
|
||||||
:return: Type of the binary, 'gs' if ghostscript, 'mudraw' if mudraw, None if invalid.
|
:return: If exists or not
|
||||||
"""
|
"""
|
||||||
program_type = None
|
program_type = None
|
||||||
runlog = check_binary(program_path)
|
runlog = check_binary(program_path)
|
||||||
|
@ -25,7 +25,7 @@ Test the media plugin
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from openlp.core import Registry
|
from openlp.core import Registry
|
||||||
from openlp.plugins.media.mediaplugin import MediaPlugin
|
from openlp.plugins.media.mediaplugin import MediaPlugin, process_check_binary
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
from tests.functional import MagicMock, patch
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
@ -63,3 +63,25 @@ class MediaPluginTest(TestCase, TestMixin):
|
|||||||
self.assertIsInstance(MediaPlugin.about(), str)
|
self.assertIsInstance(MediaPlugin.about(), str)
|
||||||
# THEN: about() should return a non-empty string
|
# THEN: about() should return a non-empty string
|
||||||
self.assertNotEquals(len(MediaPlugin.about()), 0)
|
self.assertNotEquals(len(MediaPlugin.about()), 0)
|
||||||
|
|
||||||
|
def process_check_binary_pass_test(self):
|
||||||
|
"""
|
||||||
|
Test that the Process check returns true if found
|
||||||
|
"""
|
||||||
|
# GIVEN: A media plugin instance
|
||||||
|
# WHEN: function is called with the correct name
|
||||||
|
result = process_check_binary("MediaInfo")
|
||||||
|
|
||||||
|
# THEN: The the result should be True
|
||||||
|
self.assertFalse(result, "Media info should have been found")
|
||||||
|
|
||||||
|
def process_check_binary_fail_test(self):
|
||||||
|
"""
|
||||||
|
Test that the Process check returns false if not found
|
||||||
|
"""
|
||||||
|
# GIVEN: A media plugin instance
|
||||||
|
# WHEN: function is called with the wrong name
|
||||||
|
result = process_check_binary("MediaInfo1")
|
||||||
|
|
||||||
|
# THEN: The the result should be True
|
||||||
|
self.assertTrue(result, "Media info should not have been found")
|
||||||
|
Loading…
Reference in New Issue
Block a user