aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLuciano Wolf <luciano.wolf@openbossa.org>2010-05-20 22:07:17 -0300
committerLuciano Wolf <luciano.wolf@openbossa.org>2010-05-21 11:52:26 -0300
commit17f9eed1ad5d04603872f198876047466ba08666 (patch)
tree3ed4e22bd94924b4a116d242467bb1fc291a2127 /tests
parent7fd722a38a7ac9ad60113eae825aefa017f210c1 (diff)
Fix bug#218 - TimedQApplication uses a singleton.
It's necessary to use a global TIMEOUT value, big enough to run all the tests without killing the QApp. Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org> Renato Araujo <renato.araujo@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/qtwebkit/webpage_test.py19
-rw-r--r--tests/qtwebkit/webview_test.py2
2 files changed, 14 insertions, 7 deletions
diff --git a/tests/qtwebkit/webpage_test.py b/tests/qtwebkit/webpage_test.py
index ed98c9f8d..20796971f 100644
--- a/tests/qtwebkit/webpage_test.py
+++ b/tests/qtwebkit/webpage_test.py
@@ -9,11 +9,15 @@ from PySide.QtNetwork import QNetworkAccessManager
from helper import adjust_filename, TimedQApplication
+#Define a global timeout because TimedQApplication uses a singleton!
+#Use a value big enough to run all the tests.
+TIMEOUT = 1000
+
class TestFindText(TimedQApplication):
'''Test cases for finding text'''
def setUp(self):
- TimedQApplication.setUp(self, timeout=250)
+ TimedQApplication.setUp(self, timeout=TIMEOUT)
self.page = QWebPage()
QObject.connect(self.page, SIGNAL('loadFinished(bool)'),
self.load_finished)
@@ -27,19 +31,22 @@ class TestFindText(TimedQApplication):
def testFindSelectText(self):
url = QUrl.fromLocalFile(adjust_filename('fox.html', __file__))
- self.page.currentFrame().setUrl(url)
+ self.page.mainFrame().load(url)
self.app.exec_()
self.assert_(self.called)
def load_finished(self, ok):
#Callback to check if load was successful
- self.assert_(self.page.findText('fox'))
- self.assertEqual(self.page.selectedText(), 'fox')
- self.app.quit()
if ok:
self.called = True
+ self.assert_(self.page.findText('fox'))
+ self.assertEqual(self.page.selectedText(), 'fox')
+ self.app.quit()
-class SetNetworkAccessManaterCase(TimedQApplication):
+class SetNetworkAccessManagerCase(TimedQApplication):
+
+ def setUp(self):
+ TimedQApplication.setUp(self, timeout=TIMEOUT)
def testSetNetworkAccessManager(self):
page = QWebPage()
diff --git a/tests/qtwebkit/webview_test.py b/tests/qtwebkit/webview_test.py
index 176d4873e..e1ba7efd6 100644
--- a/tests/qtwebkit/webview_test.py
+++ b/tests/qtwebkit/webview_test.py
@@ -14,7 +14,7 @@ class TestLoadFinished(TimedQApplication):
def setUp(self):
#Acquire resources
- TimedQApplication.setUp(self, timeout=250)
+ TimedQApplication.setUp(self, timeout=1000)
self.view = QWebView()
QObject.connect(self.view, SIGNAL('loadFinished(bool)'),
self.load_finished)