~timo-jyrinki/ubuntu/trusty/pitivi/backport_utopic_fixes

« back to all changes in this revision

Viewing changes to tests/test_signallable.py

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Bicha
  • Date: 2011-08-15 02:32:20 UTC
  • mfrom: (1.5.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110815023220-x2n5l0i4deiqn7dn
Tags: 0.14.2-0ubuntu1
* New upstream version.
  - New Mallard format help
* debian/control:
  - Add gnome-doc-utils to build-depends
  - Bump pygtk minimum to 2.24
* debian/patches/01_lpi.patch
  - Move LPI items below User Manual in Help menu
* debian/watch: Watch for 0.14.* tar.bz2

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
    __signals__ = {
8
8
        "signal-oneargs": ["firstarg"],
9
 
        "signal-noargs": []
10
 
        }
 
9
        "signal-noargs": []}
11
10
 
12
11
    def emit_signal_one_args(self, firstarg):
13
12
        self.emit("signal-oneargs", firstarg)
19
18
class mysubobject(myobject):
20
19
 
21
20
    __signals__ = {
22
 
        "subobject-noargs": None
23
 
        }
 
21
        "subobject-noargs": None}
24
22
 
25
23
    def emit_sub_signal_no_args(self):
26
24
        self.emit("subobject-noargs")
159
157
 
160
158
        self.object.emit("signal-oneargs", 42)
161
159
 
 
160
    def test_disconnect_while_handling(self):
 
161
        # When the handler being called disconnects itself,
 
162
        # the next handler must not be skipped.
 
163
 
 
164
        def firstCb(unused_object):
 
165
            self.object.disconnect_by_function(firstCb)
 
166
 
 
167
        def secondCb(unused_object):
 
168
            self.called = True
 
169
 
 
170
        self.called = False
 
171
        self.object.connect("signal-oneargs", firstCb)
 
172
        self.object.connect("signal-oneargs", secondCb)
 
173
        self.object.emit("signal-oneargs")
 
174
        self.assertTrue(self.called)
 
175
        del self.called
 
176
 
 
177
    def test_disconnect_following_handler_while_handling(self):
 
178
        # When the handler being called disconnects a following handler,
 
179
        # the following handler must be skipped.
 
180
 
 
181
        def firstCb(unused_object):
 
182
            self.object.disconnect_by_function(secondCb)
 
183
 
 
184
        def secondCb(unused_object):
 
185
            self.called = True
 
186
 
 
187
        self.called = False
 
188
        self.object.connect("signal-oneargs", firstCb)
 
189
        self.object.connect("signal-oneargs", secondCb)
 
190
        self.object.emit("signal-oneargs")
 
191
        self.assertFalse(self.called)
 
192
        del self.called
 
193
 
162
194
    def test04_emit01(self):
163
195
        # signal: no arguments
164
196
        # connect: no arguments