aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtDeclarative/bug_726.py
blob: fa18aac1e175a3c2f0a3569636ba25b80e8781e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from PySide import QtCore, QtGui, QtDeclarative
from helper import adjust_filename, TimedQApplication
import unittest

class ProxyObject(QtCore.QObject):
    def __init__(self):
        super(ProxyObject,self).__init__()
        self._o = None
        self._receivedName = ""

    @QtCore.Slot(result='QObject*')
    def getObject(self):
        if self._o:
            return self._o

        self._o = QtCore.QObject()
        self._o.setObjectName("PySideObject")
        return self._o

    @QtCore.Slot(str)
    def receivedObject(self, name):
        self._receivedName = name
 

class TestConnectionWithInvalidSignature(TimedQApplication):

    def testSlotRetur(self):
        view = QtDeclarative.QDeclarativeView()
        proxy = ProxyObject()

        context = view.rootContext()
        context.setContextProperty("proxy", proxy)
        view.setSource(QtCore.QUrl.fromLocalFile(adjust_filename('bug_726.qml', __file__)))
        root = view.rootObject()
        button = root.findChild(QtCore.QObject, "buttonMouseArea")
        view.show()
        button.entered.emit()
        self.assertEqual(proxy._receivedName, "PySideObject")

if __name__ == '__main__':
    unittest.main()