openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #20133
[Merge] lp:~googol/openlp/random-regression-bugs into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/random-regression-bugs into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~googol/openlp/random-regression-bugs/+merge/156082
Hello,
- fixed customs regression
Fixed regression I have caused with my last proposal. A test has been added to verify the fix :)
--
https://code.launchpad.net/~googol/openlp/random-regression-bugs/+merge/156082
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/random-regression-bugs into lp:openlp.
=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py 2013-03-28 20:25:35 +0000
+++ openlp/plugins/custom/forms/editcustomform.py 2013-03-28 22:09:18 +0000
@@ -158,7 +158,7 @@
"""
Add a new blank slide.
"""
- self.edit_slide_form.setText(u'')
+ self.edit_slide_form.set_text(u'')
if self.edit_slide_form.exec_():
self.slide_list_view.addItems(self.edit_slide_form.get_text())
@@ -166,7 +166,7 @@
"""
Edit the currently selected slide.
"""
- self.edit_slide_form.setText(self.slide_list_view.currentItem().text())
+ self.edit_slide_form.set_text(self.slide_list_view.currentItem().text())
if self.edit_slide_form.exec_():
self.update_slide_list(self.edit_slide_form.get_text())
@@ -180,7 +180,7 @@
slide_text += item.text()
if row != self.slide_list_view.count() - 1:
slide_text += u'\n[===]\n'
- self.edit_slide_form.setText(slide_text)
+ self.edit_slide_form.set_text(slide_text)
if self.edit_slide_form.exec_():
self.update_slide_list(self.edit_slide_form.get_text(), True)
=== modified file 'tests/interfaces/openlp_plugins_custom_forms/test_customform.py'
--- tests/interfaces/openlp_plugins_custom_forms/test_customform.py 2013-03-28 21:24:19 +0000
+++ tests/interfaces/openlp_plugins_custom_forms/test_customform.py 2013-03-28 22:09:18 +0000
@@ -4,7 +4,7 @@
from unittest import TestCase
from mock import MagicMock, patch
-from PyQt4 import QtGui
+from PyQt4 import QtGui, QtTest, QtCore
from openlp.core.lib import Registry
# Import needed due to import problems.
@@ -36,9 +36,9 @@
del self.main_window
del self.app
- def load_custom_test(self):
+ def load_custom(self):
"""
- Test the EditCustomForm defaults are correct
+ Test the load_custom() method.
"""
# GIVEN: A mocked QDialog.exec_() method
with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec:
@@ -50,3 +50,15 @@
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')
+
+ def on_add_button_clicked_test(self):
+ """
+ Test the on_add_button_clicked_test method / add_button button.
+ """
+ # GIVEN: A mocked QDialog.exec_() method
+ with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec:
+ # WHEN: Show the dialog and add a new slide.
+ self.form.exec_()
+ QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton)
+ #THEN: One slide should be added.
+ assert self.form.slide_list_view.count() == 1, u'There should be one slide be added.'