~suutari-olli/openlp/click-slide-to-go-live-from-blank

« back to all changes in this revision

Viewing changes to tests/interfaces/openlp_core_ui_lib/test_historycombobox.py

  • Committer: Simon Hanna
  • Date: 2016-05-17 08:48:19 UTC
  • mfrom: (2625.1.36 openlp)
  • mto: (2625.1.37 openlp)
  • mto: This revision was merged to the branch mainline in revision 2649.
  • Revision ID: simon.hanna@serve-me.info-20160517084819-lgup78nzyzjympuu
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
 
3
 
 
4
###############################################################################
 
5
# OpenLP - Open Source Lyrics Projection                                      #
 
6
# --------------------------------------------------------------------------- #
 
7
# Copyright (c) 2008-2016 OpenLP Developers                                   #
 
8
# --------------------------------------------------------------------------- #
 
9
# This program is free software; you can redistribute it and/or modify it     #
 
10
# under the terms of the GNU General Public License as published by the Free  #
 
11
# Software Foundation; version 2 of the License.                              #
 
12
#                                                                             #
 
13
# This program is distributed in the hope that it will be useful, but WITHOUT #
 
14
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
 
15
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
 
16
# more details.                                                               #
 
17
#                                                                             #
 
18
# You should have received a copy of the GNU General Public License along     #
 
19
# with this program; if not, write to the Free Software Foundation, Inc., 59  #
 
20
# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 
21
###############################################################################
 
22
"""
 
23
Module to test the :mod:`~openlp.core.common.historycombobox` module.
 
24
"""
 
25
 
 
26
from unittest import TestCase
 
27
 
 
28
from PyQt5 import QtWidgets
 
29
 
 
30
from openlp.core.common import Registry
 
31
from openlp.core.ui.lib.historycombobox import HistoryComboBox
 
32
from tests.helpers.testmixin import TestMixin
 
33
 
 
34
 
 
35
class TestHistoryComboBox(TestCase, TestMixin):
 
36
    def setUp(self):
 
37
        """
 
38
        Some pre-test setup required.
 
39
        """
 
40
        Registry.create()
 
41
        self.setup_application()
 
42
        self.main_window = QtWidgets.QMainWindow()
 
43
        Registry().register('main_window', self.main_window)
 
44
        self.combo = HistoryComboBox(self.main_window)
 
45
 
 
46
    def tearDown(self):
 
47
        """
 
48
        Delete all the C++ objects at the end so that we don't have a segfault
 
49
        """
 
50
        del self.combo
 
51
        del self.main_window
 
52
 
 
53
    def get_items_test(self):
 
54
        """
 
55
        Test the getItems() method
 
56
        """
 
57
        # GIVEN: The combo.
 
58
 
 
59
        # WHEN: Add two items.
 
60
        self.combo.addItem('test1')
 
61
        self.combo.addItem('test2')
 
62
 
 
63
        # THEN: The list of items should contain both strings.
 
64
        self.assertEqual(self.combo.getItems(), ['test1', 'test2'])