From 17f9eed1ad5d04603872f198876047466ba08666 Mon Sep 17 00:00:00 2001 From: Luciano Wolf Date: Thu, 20 May 2010 22:07:17 -0300 Subject: 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 Renato Araujo --- tests/qtwebkit/webpage_test.py | 19 +++++++++++++------ tests/qtwebkit/webview_test.py | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'tests') 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) -- cgit v1.2.3