diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-07-20 10:41:31 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:37 -0300 |
commit | e37426c8c4a1f041c2f4b9c0f560751aa4b9a924 (patch) | |
tree | cbcd4d631282a8cc7818cb4674bae6227a603c87 /tests | |
parent | 8ec69343969dd1ef767d9c8d38ce49d4280e5d4c (diff) |
Fix bug 926 - "qmlRegisterType does not work with QObject"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Lauro Neto <lauro.neto@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/QtDeclarative/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtDeclarative/bug_926.py | 38 | ||||
-rw-r--r-- | tests/QtDeclarative/bug_926.qml | 17 |
3 files changed, 56 insertions, 0 deletions
diff --git a/tests/QtDeclarative/CMakeLists.txt b/tests/QtDeclarative/CMakeLists.txt index b319d86b7..31ea6e75e 100644 --- a/tests/QtDeclarative/CMakeLists.txt +++ b/tests/QtDeclarative/CMakeLists.txt @@ -6,6 +6,7 @@ PYSIDE_TEST(bug_814.py) PYSIDE_TEST(bug_825.py) PYSIDE_TEST(bug_847.py) PYSIDE_TEST(bug_915.py) +PYSIDE_TEST(bug_926.py) PYSIDE_TEST(qdeclarativenetwork_test.py) PYSIDE_TEST(qdeclarativeview_test.py) PYSIDE_TEST(connect_python_qml.py) diff --git a/tests/QtDeclarative/bug_926.py b/tests/QtDeclarative/bug_926.py new file mode 100644 index 000000000..54b659036 --- /dev/null +++ b/tests/QtDeclarative/bug_926.py @@ -0,0 +1,38 @@ +import sys +import unittest +from helper import adjust_filename +from PySide.QtCore import * +from PySide.QtGui import * +from PySide.QtDeclarative import * + +class MyClass (QObject): + + def __init__(self): + super(MyClass,self).__init__() + self.__url = QUrl() + + def getUrl(self): + return self.__url + + def setUrl(self,value): + newUrl = QUrl(value) + if (newUrl != self.__url): + self.__url = newUrl + self.urlChanged.emit() + + urlChanged = Signal() + urla = Property(QUrl, getUrl, setUrl, notify = urlChanged) + +class TestBug926 (unittest.TestCase): + def testIt(self): + app = QApplication([]) + qmlRegisterType(MyClass,'Example',1,0,'MyClass') + view = QDeclarativeView() + view.setSource(QUrl.fromLocalFile(adjust_filename('bug_926.qml', __file__))) + self.assertEqual(len(view.errors()), 0) + view.show() + QTimer.singleShot(0, app.quit) + app.exec_() + +if __name__ == '__main__': + unittest.main() diff --git a/tests/QtDeclarative/bug_926.qml b/tests/QtDeclarative/bug_926.qml new file mode 100644 index 000000000..50895db1c --- /dev/null +++ b/tests/QtDeclarative/bug_926.qml @@ -0,0 +1,17 @@ +import Qt 4.7 +import Example 1.0 + +Rectangle { + width: 100 + height: 62 + + MyClass { + id: myClass + urla: "http://www.pyside.org" + } + + Text { + id: name + text: myClass.urla + } +} |