forked from openlp/openlp
added test
This commit is contained in:
parent
fd3cad1c7c
commit
f715810ce9
@ -15,7 +15,7 @@ class TestLib(TestCase):
|
|||||||
"""
|
"""
|
||||||
Test the str_to_bool function with boolean input
|
Test the str_to_bool function with boolean input
|
||||||
"""
|
"""
|
||||||
#GIVEN: A boolean value set to true
|
# GIVEN: A boolean value set to true
|
||||||
true_boolean = True
|
true_boolean = True
|
||||||
|
|
||||||
# WHEN: We "convert" it to a bool
|
# WHEN: We "convert" it to a bool
|
||||||
@ -25,7 +25,7 @@ class TestLib(TestCase):
|
|||||||
assert isinstance(true_result, bool), u'The result should be a boolean'
|
assert isinstance(true_result, bool), u'The result should be a boolean'
|
||||||
assert true_result is True, u'The result should be True'
|
assert true_result is True, u'The result should be True'
|
||||||
|
|
||||||
#GIVEN: A boolean value set to false
|
# GIVEN: A boolean value set to false
|
||||||
false_boolean = False
|
false_boolean = False
|
||||||
|
|
||||||
# WHEN: We "convert" it to a bool
|
# WHEN: We "convert" it to a bool
|
||||||
|
Binary file not shown.
@ -46,7 +46,7 @@ class TestCustomFrom(TestCase):
|
|||||||
self.form.exec_()
|
self.form.exec_()
|
||||||
self.form.load_custom(0)
|
self.form.load_custom(0)
|
||||||
|
|
||||||
#THEN: The line edits should not contain any text.
|
# THEN: The line edits should not contain any text.
|
||||||
self.assertEqual(self.form.title_edit.text(), u'', u'The title edit should be empty')
|
self.assertEqual(self.form.title_edit.text(), u'', u'The title edit should be empty')
|
||||||
self.assertEqual(self.form.credit_edit.text(), u'', u'The credit edit should be empty')
|
self.assertEqual(self.form.credit_edit.text(), u'', u'The credit edit should be empty')
|
||||||
|
|
||||||
@ -60,5 +60,19 @@ class TestCustomFrom(TestCase):
|
|||||||
# WHEN: Show the dialog and add a new slide.
|
# WHEN: Show the dialog and add a new slide.
|
||||||
self.form.exec_()
|
self.form.exec_()
|
||||||
QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton)
|
QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton)
|
||||||
#THEN: One slide should be added.
|
# THEN: One slide should be added.
|
||||||
assert self.form.slide_list_view.count() == 1, u'There should be one slide added.'
|
assert self.form.slide_list_view.count() == 1, u'There should be one slide added.'
|
||||||
|
|
||||||
|
def load_themes_test(self):
|
||||||
|
"""
|
||||||
|
Test the load_themes() method.
|
||||||
|
"""
|
||||||
|
# GIVEN: A mocked QDialog.exec_() method
|
||||||
|
with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec:
|
||||||
|
theme_list = [u'First Theme', u'Second Theme']
|
||||||
|
# WHEN: Show the dialog and add pass a theme list.
|
||||||
|
self.form.exec_()
|
||||||
|
self.form.load_themes(theme_list)
|
||||||
|
|
||||||
|
# THEN: There should be three items in the combo box.
|
||||||
|
assert self.form.theme_combo_box.count() == 3, u'There should be three items (themes) in the combo box.'
|
||||||
|
Loading…
Reference in New Issue
Block a user