summaryrefslogtreecommitdiffstats
path: root/tests/QtDeclarative/qdeclarativenetwork_test.py
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-06-07 14:43:45 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-06-07 16:57:11 -0300
commitab918abc1e103e0ca86939f7d057e8a44ac8a4ef (patch)
tree53c6f57d089dcf5e145d766b1ceef704714046d8 /tests/QtDeclarative/qdeclarativenetwork_test.py
parent471486732b03cbb42b884158604a59d5a18e8a35 (diff)
downloadpyside-ab918abc1e103e0ca86939f7d057e8a44ac8a4ef.tar.gz
pyside-ab918abc1e103e0ca86939f7d057e8a44ac8a4ef.tar.xz
pyside-ab918abc1e103e0ca86939f7d057e8a44ac8a4ef.zip
Created new unittest model.
Separete unittest for module. Only run unittest for compiled modules. Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/QtDeclarative/qdeclarativenetwork_test.py')
-rw-r--r--tests/QtDeclarative/qdeclarativenetwork_test.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/QtDeclarative/qdeclarativenetwork_test.py b/tests/QtDeclarative/qdeclarativenetwork_test.py
new file mode 100644
index 0000000..a03a484
--- /dev/null
+++ b/tests/QtDeclarative/qdeclarativenetwork_test.py
@@ -0,0 +1,35 @@
+'''Test cases for QDeclarativeNetwork'''
+
+import unittest
+
+from PySide.QtCore import QUrl
+from PySide.QtDeclarative import QDeclarativeView, QDeclarativeNetworkAccessManagerFactory
+from PySide.QtNetwork import QNetworkAccessManager
+
+from helper import adjust_filename, TimedQApplication
+
+class MyNetworkAccessManagerFactory(QDeclarativeNetworkAccessManagerFactory):
+ def create(self, parent):
+ nam = QNetworkAccessManager(parent)
+ return nam
+
+class TestQDeclarativeNetworkFactory(TimedQApplication):
+
+ def setUp(self):
+ TimedQApplication.setUp(self, timeout=1000)
+
+ def testQDeclarativeNetworkFactory(self):
+ view = QDeclarativeView()
+
+ url = QUrl.fromLocalFile(adjust_filename('network.qml', __file__))
+
+ view.engine().setNetworkAccessManagerFactory(MyNetworkAccessManagerFactory())
+ view.setSource(url)
+ view.show()
+
+ self.assertEqual(view.status(), QDeclarativeView.Ready)
+
+ self.app.exec_()
+
+if __name__ == '__main__':
+ unittest.main()