summaryrefslogtreecommitdiffstats
path: root/tests/QtDeclarative/bug_456.py
blob: 178ea7d43021fc79e9bbb5b0345e29b86566a808 (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
from PySide import QtCore, QtGui, QtDeclarative
from helper import adjust_filename, TimedQApplication
import unittest

class RotateValue(QtCore.QObject):
    def __init__(self):
        super(RotateValue,self).__init__()

    @QtCore.Slot(result=int)
    def val(self):
        return 100

    def setRotation(self, v):
        self._rotation = v

    def getRotation(self):
        return self._rotation

    rotation = QtCore.Property(int, getRotation, setRotation)

class TestConnectionWithInvalidSignature(TimedQApplication):

    def testSlotRetur(self):
        view = QtDeclarative.QDeclarativeView()
        rotatevalue = RotateValue()

        timer = QtCore.QTimer()
        timer.start(2000)

        context = view.rootContext()
        context.setContextProperty("rotatevalue", rotatevalue)
        view.setSource(adjust_filename('bug_456.qml', __file__))
        root = view.rootObject()
        button = root.findChild(QtCore.QObject, "buttonMouseArea")
        view.show()
        button.clicked.emit()
        self.assertEqual(rotatevalue.rotation, 100)

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