1
# -*- coding: utf-8 -*-
2
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
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. #
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 #
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
###############################################################################
23
Module to test the :mod:`~openlp.core.common.historycombobox` module.
26
from unittest import TestCase
28
from PyQt5 import QtWidgets
30
from openlp.core.common import Registry
31
from openlp.core.ui.lib.historycombobox import HistoryComboBox
32
from tests.helpers.testmixin import TestMixin
35
class TestHistoryComboBox(TestCase, TestMixin):
38
Some pre-test setup required.
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)
48
Delete all the C++ objects at the end so that we don't have a segfault
53
def get_items_test(self):
55
Test the getItems() method
59
# WHEN: Add two items.
60
self.combo.addItem('test1')
61
self.combo.addItem('test2')
63
# THEN: The list of items should contain both strings.
64
self.assertEqual(self.combo.getItems(), ['test1', 'test2'])