diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-11-01 17:29:01 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:56:16 -0300 |
commit | dde75099f284a1c44773501fde77dc17d445028d (patch) | |
tree | 781fb8969f7d4412448d7ac6cb72d9e7616f892e /tests | |
parent | 64ffc4f61b874e461c559495ece6f963ce5153ee (diff) |
Fix bug 1029 - "qmlRegisterType Fails to Increase the Ref Count"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/QtDeclarative/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtDeclarative/bug_1029.py | 29 | ||||
-rw-r--r-- | tests/QtDeclarative/bug_1029.qml | 15 |
3 files changed, 45 insertions, 0 deletions
diff --git a/tests/QtDeclarative/CMakeLists.txt b/tests/QtDeclarative/CMakeLists.txt index be3fb3cbb..2c842d3d1 100644 --- a/tests/QtDeclarative/CMakeLists.txt +++ b/tests/QtDeclarative/CMakeLists.txt @@ -10,6 +10,7 @@ PYSIDE_TEST(bug_926.py) PYSIDE_TEST(bug_951.py) PYSIDE_TEST(bug_995.py) PYSIDE_TEST(bug_997.py) +PYSIDE_TEST(bug_1029.py) PYSIDE_TEST(qdeclarativenetwork_test.py) PYSIDE_TEST(qdeclarativeview_test.py) PYSIDE_TEST(connect_python_qml.py) diff --git a/tests/QtDeclarative/bug_1029.py b/tests/QtDeclarative/bug_1029.py new file mode 100644 index 000000000..3cc343f58 --- /dev/null +++ b/tests/QtDeclarative/bug_1029.py @@ -0,0 +1,29 @@ +from PySide.QtCore import * +from PySide.QtGui import * +from PySide.QtDeclarative import * + +import sys +import gc + +def register_qml_types(): + class TestClass(QDeclarativeItem): + def __init__(self, parent = None): + QDeclarativeItem.__init__(self, parent) + + qmlRegisterType(TestClass, "UserTypes", 1, 0, "TestClass") + +def main(): + app = QApplication([]) + + # reg qml types here + register_qml_types() + + # force gc to run + gc.collect() + + view = QDeclarativeView() + url = QUrl(__file__.replace(".py", ".qml")) + view.setSource(url) + +if __name__ == "__main__": + main() diff --git a/tests/QtDeclarative/bug_1029.qml b/tests/QtDeclarative/bug_1029.qml new file mode 100644 index 000000000..a9c0aea43 --- /dev/null +++ b/tests/QtDeclarative/bug_1029.qml @@ -0,0 +1,15 @@ +import QtQuick 1.0 +import UserTypes 1.0 + +Rectangle +{ + width: 200 + height: 200 + + color: "#ff0000" + + TestClass + { + + } +} |