Fix up the openlp_core_ui tests so that they run and they don't segfault at the end

This commit is contained in:
Raoul Snyman 2013-01-21 09:26:36 +02:00
parent 4e2ea75962
commit ac795d8439
2 changed files with 9 additions and 3 deletions

View File

@ -2,9 +2,10 @@
Package to test the openlp.core.ui package. Package to test the openlp.core.ui package.
""" """
import sys import sys
from unittest import TestCase from unittest import TestCase
from mock import MagicMock from mock import MagicMock
from openlp.core.ui import starttimeform from openlp.core.ui import starttimeform
from PyQt4 import QtCore, QtGui, QtTest from PyQt4 import QtCore, QtGui, QtTest
@ -14,10 +15,15 @@ class TestStartTimeDialog(TestCase):
""" """
Create the UI Create the UI
""" """
self.app = QtGui.QApplication(sys.argv) self.app = QtGui.QApplication([])
self.window = QtGui.QMainWindow() self.window = QtGui.QMainWindow()
self.form = starttimeform.StartTimeForm(self.window) self.form = starttimeform.StartTimeForm(self.window)
def tearDown(self):
del self.form
del self.window
del self.app
def ui_defaults_test(self): def ui_defaults_test(self):
""" """
Test StartTimeDialog defaults Test StartTimeDialog defaults
@ -40,7 +46,7 @@ class TestStartTimeDialog(TestCase):
Test StartTimeDialog display initialisation Test StartTimeDialog display initialisation
""" """
#GIVEN: A service item with with time #GIVEN: A service item with with time
mocked_serviceitem = MagicMock() mocked_serviceitem = MagicMock()
mocked_serviceitem.start_time = 61 mocked_serviceitem.start_time = 61
mocked_serviceitem.end_time = 3701 mocked_serviceitem.end_time = 3701