This commit is contained in:
Tim Bentley 2016-04-20 17:36:37 +01:00
parent 40981701e9
commit f2537981e4
3 changed files with 25 additions and 5 deletions

View File

@ -253,7 +253,6 @@ if is_win():
from subprocess import STARTUPINFO, STARTF_USESHOWWINDOW
def add_actions(target, actions):
"""
Adds multiple actions to a menu or toolbar in one command.

View File

@ -153,11 +153,10 @@ class MediaPlugin(Plugin):
def process_check_binary(program_path):
"""
Function that checks whether a binary is either ghostscript or mudraw or neither.
Is also used from presentationtab.py
Function that checks whether a binary MediaInfo is present
: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
runlog = check_binary(program_path)

View File

@ -25,7 +25,7 @@ Test the media plugin
from unittest import TestCase
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.helpers.testmixin import TestMixin
@ -63,3 +63,25 @@ class MediaPluginTest(TestCase, TestMixin):
self.assertIsInstance(MediaPlugin.about(), str)
# THEN: about() should return a non-empty string
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")