diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-04-25 10:12:24 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:13 -0300 |
commit | 9b4a43be493cb38adc5aa3a4b195ab9033ce550e (patch) | |
tree | 8556c92c2f4e8a1e80f43038fc9f5fc64eb03311 | |
parent | 047d42c704cf2bf8aabd61b7d405746506b7e37d (diff) |
Implemented test for QWebFrame.metadata function.
Reviewer: Lauro Moura <lauro.neto@openbossa.org>
Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r-- | tests/QtWebKit/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtWebKit/fox.html | 1 | ||||
-rw-r--r-- | tests/QtWebKit/webframe_test.py | 34 |
3 files changed, 36 insertions, 0 deletions
diff --git a/tests/QtWebKit/CMakeLists.txt b/tests/QtWebKit/CMakeLists.txt index 1902fbf9a..683414144 100644 --- a/tests/QtWebKit/CMakeLists.txt +++ b/tests/QtWebKit/CMakeLists.txt @@ -2,3 +2,4 @@ PYSIDE_TEST(bug_448.py) PYSIDE_TEST(bug_694.py) PYSIDE_TEST(webpage_test.py) PYSIDE_TEST(webview_test.py) +PYSIDE_TEST(webframe_test.py) diff --git a/tests/QtWebKit/fox.html b/tests/QtWebKit/fox.html index e7691eb66..da873b1cc 100644 --- a/tests/QtWebKit/fox.html +++ b/tests/QtWebKit/fox.html @@ -1,5 +1,6 @@ <html> <title>Title</title> +<meta name="description" content="PySide Test METADATA." /> <body> <p>The quick <b>brown</b> fox <i>jumps</i> over the lazy dog.</p> </body> diff --git a/tests/QtWebKit/webframe_test.py b/tests/QtWebKit/webframe_test.py new file mode 100644 index 000000000..596617d4f --- /dev/null +++ b/tests/QtWebKit/webframe_test.py @@ -0,0 +1,34 @@ +import unittest +import sys + +from PySide.QtCore import QObject, SIGNAL, QUrl +from PySide.QtWebKit import * +from PySide.QtNetwork import QNetworkRequest + +from helper import adjust_filename, UsesQApplication + + + +class TestWebFrame(UsesQApplication): + def load_finished(self, ok): + self.assert_(ok) + page = self.view.page() + self.assert_(page) + frame = page.mainFrame() + self.assert_(frame) + meta = frame.metaData() + self.assertEqual(meta['description'], ['PySide Test METADATA.']) + self.app.quit() + + def testMetaData(self): + self.view = QWebView() + QObject.connect(self.view, SIGNAL('loadFinished(bool)'), + self.load_finished) + url = QUrl.fromLocalFile(adjust_filename('fox.html', __file__)) + self.view.setUrl(url) + self.app.exec_() + + +if __name__ == '__main__': + unittest.main() + |