diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-05-06 19:03:03 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:20 -0300 |
commit | ae67df9d8b833e5ccad75cd1de2565503e38262a (patch) | |
tree | ce7a7852a654b4479dcacd66a90f5eefdcbcd744 /tests/QtDeclarative | |
parent | 595133f9c858002a32c489ff6a045a076516e57b (diff) |
Created unit test for bug #847.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'tests/QtDeclarative')
-rw-r--r-- | tests/QtDeclarative/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtDeclarative/bug_847.py | 43 | ||||
-rw-r--r-- | tests/QtDeclarative/bug_847.qml | 26 |
3 files changed, 70 insertions, 0 deletions
diff --git a/tests/QtDeclarative/CMakeLists.txt b/tests/QtDeclarative/CMakeLists.txt index abde6fb80..8bb6bade0 100644 --- a/tests/QtDeclarative/CMakeLists.txt +++ b/tests/QtDeclarative/CMakeLists.txt @@ -4,6 +4,7 @@ PYSIDE_TEST(bug_557.py) PYSIDE_TEST(bug_726.py) PYSIDE_TEST(bug_814.py) PYSIDE_TEST(bug_825.py) +PYSIDE_TEST(bug_847.py) PYSIDE_TEST(qdeclarativenetwork_test.py) PYSIDE_TEST(qdeclarativeview_test.py) PYSIDE_TEST(connect_python_qml.py) diff --git a/tests/QtDeclarative/bug_847.py b/tests/QtDeclarative/bug_847.py new file mode 100644 index 000000000..faba8c951 --- /dev/null +++ b/tests/QtDeclarative/bug_847.py @@ -0,0 +1,43 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Testcase for PySide bug 847 +# Released under the same terms as PySide itself +# 2011-05-04 Thomas Perl <m@thp.io> + + +import unittest + +from PySide.QtCore import Slot, Signal, QUrl +from PySide.QtGui import QApplication +from PySide.QtDeclarative import QDeclarativeView + +from helper import adjust_filename, TimedQApplication + +class View(QDeclarativeView): + def __init__(self): + QDeclarativeView.__init__(self) + self.setSource(QUrl.fromLocalFile(adjust_filename('bug_847.qml', __file__))) + self.rootObject().setProperty('pythonObject', self) + + @Slot(int, int) + def blubb(self, x, y): + self.called.emit(x, y) + + called = Signal(int, int) + + +class TestQML(TimedQApplication): + def done(self, x, y): + self._sucess = True + + def testPythonSlot(self): + self._sucess = False + view = View() + view.called.connect(self.done) + view.show() + self.app.exec_() + self.assertTrue(self._sucess) + +if __name__ == '__main__': + unittest.main() + diff --git a/tests/QtDeclarative/bug_847.qml b/tests/QtDeclarative/bug_847.qml new file mode 100644 index 000000000..e47819ff7 --- /dev/null +++ b/tests/QtDeclarative/bug_847.qml @@ -0,0 +1,26 @@ + +import Qt 4.7 + +Rectangle { + width: 500 + height: 500 + color: 'red' + + property variant pythonObject: undefined + + Text { + anchors.centerIn: parent + text: 'click me' + color: 'white' + } + + Timer { + interval: 1; running: true; + onTriggered: { + if (pythonObject != undefined) { + pythonObject.blubb(42, 84) + } + } + } +} + |