From 8224e39a2cf2f54c85d53ea257b7157ba55c2860 Mon Sep 17 00:00:00 2001 From: Olli Suutari Date: Sat, 20 Aug 2016 22:14:15 +0300 Subject: [PATCH] - Added test --- .../openlp_core_ui/test_mainwindow.py | 3 ++- .../openlp_plugins/bibles/test_mediaitem.py | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/functional/openlp_core_ui/test_mainwindow.py b/tests/functional/openlp_core_ui/test_mainwindow.py index 341e74eb8..09c423304 100644 --- a/tests/functional/openlp_core_ui/test_mainwindow.py +++ b/tests/functional/openlp_core_ui/test_mainwindow.py @@ -26,11 +26,12 @@ import os from unittest import TestCase -from PyQt5 import QtWidgets +from PyQt5 import QtWidgets, QtGui, QtCore from openlp.core.ui.mainwindow import MainWindow from openlp.core.lib.ui import UiStrings from openlp.core.common.registry import Registry +from openlp.core.common import is_win, is_macosx, is_linux from tests.functional import MagicMock, patch from tests.helpers.testmixin import TestMixin diff --git a/tests/functional/openlp_plugins/bibles/test_mediaitem.py b/tests/functional/openlp_plugins/bibles/test_mediaitem.py index 05418f177..f4b356d2c 100644 --- a/tests/functional/openlp_plugins/bibles/test_mediaitem.py +++ b/tests/functional/openlp_plugins/bibles/test_mediaitem.py @@ -114,6 +114,27 @@ class TestMediaItem(TestCase, TestMixin): self.assertEqual(self.media_item.search_results, {}) self.assertEqual(self.media_item.second_search_results, {}) + def test_required_icons(self): + """ + Test that all the required icons are set properly. + """ + # GIVEN: Mocked icons that need to be called. + self.media_item.has_import_icon = MagicMock() + self.media_item.has_new_icon = MagicMock() + self.media_item.has_edit_icon = MagicMock() + self.media_item.has_delete_icon = MagicMock() + self.media_item.add_to_service_item = MagicMock() + + # WHEN: self.media_item.required_icons is called + self.media_item.required_icons() + + # THEN: On windows it should return True, on other platforms False + self.assertTrue(self.media_item.has_import_icon, 'Check that the icon is as True.') + self.assertFalse(self.media_item.has_new_icon, 'Check that the icon is called as False.') + self.assertTrue(self.media_item.has_edit_icon, 'Check that the icon is called as True.') + self.assertTrue(self.media_item.has_delete_icon, 'Check that the icon is called as True.') + self.assertFalse(self.media_item.add_to_service_item, 'Check that the icon is called as False') + def on_quick_search_button_general_test(self): """ Test that general things, which should be called on all Quick searches are called.