~ubuntu-branches/ubuntu/utopic/pyside/utopic

« back to all changes in this revision

Viewing changes to tests/QtGui/qlayout_test.py

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2011-02-18 18:01:00 UTC
  • mfrom: (1.2.3 upstream) (6.1.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20110218180100-vaczjij7g08fzfme
Tags: 1.0.0~rc1-1
* New 1.0.0~rc1 upstream release
  - Bump the B-D chain versions:
    + apiextractor to 0.10.0-2~
    + generatorrunner to 0.6.6
    + shiboken to 1.0.0~rc1
* Update patches to ~rc1.
* debian/watch: update to handle Release Candidates too.
* Bump XS-Python-Version to >= 2.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    def add(self, item):
28
28
        self._list.append(item)
29
29
 
30
 
 
 
30
class MissingItemAtLayout(QLayout):
 
31
    def __init__(self, parent=None):
 
32
        QLayout.__init__(self, parent)
 
33
        self._list = []
 
34
 
 
35
    def addItem(self, item):
 
36
        self.add(item)
 
37
 
 
38
    def addWidget(self, widget):
 
39
        self.add(QWidgetItem(widget))
 
40
 
 
41
    def count(self):
 
42
        return len(self._list)
 
43
 
 
44
    def add(self, item):
 
45
        self._list.append(item)
31
46
 
32
47
#Test if a layout implemented in python, the QWidget.setLayout works
33
48
#fine because this implement som layout functions used in glue code of
71
86
 
72
87
        self.assertEqual(sys.getrefcount(b), 2)
73
88
 
 
89
    def testMissingFunctions(self):
 
90
        w = QWidget()
 
91
        b = QPushButton("test")
 
92
        l = MissingItemAtLayout()
 
93
 
 
94
        l.addWidget(b)
 
95
 
 
96
        self.assertRaises(RuntimeError, w.setLayout, l)
 
97
 
74
98
if __name__ == '__main__':
75
99
    unittest.main()