testinggtk r279 - trunk/tests/gobjecttests



Author: bjornl
Date: Sat Jun 28 10:35:02 2008
New Revision: 279
URL: http://svn.gnome.org/viewvc/testinggtk?rev=279&view=rev

Log:
Test for connecting to the notify signal

Modified:
   trunk/tests/gobjecttests/test_gobject.py

Modified: trunk/tests/gobjecttests/test_gobject.py
==============================================================================
--- trunk/tests/gobjecttests/test_gobject.py	(original)
+++ trunk/tests/gobjecttests/test_gobject.py	Sat Jun 28 10:35:02 2008
@@ -34,6 +34,28 @@
     obj = gobject.GObject()
     obj.handler_block(123)
 
+def test_notify_signal():
+    '''
+    Ensure that the ``notify`` signal is emitted properly when a
+    property is being modified.
+    '''
+    class Sub46(gobject.GObject):
+        prop = gobject.property(type = int)
+    gobject.type_register(Sub46)
+
+    cb_args = []
+    def notify_cb(obj, prop_spec):
+        cb_args.append((obj, prop_spec))
+
+    obj = Sub46()
+    obj.connect('notify', notify_cb)
+    obj.set_property('prop', 99)
+
+    cb_obj, cb_prop_spec = cb_args[0]
+    assert cb_obj == obj
+    assert cb_prop_spec.name == 'prop'
+    assert cb_prop_spec.value_type == gobject.TYPE_INT
+
 def test_is_freeze_cumulative():
     obj = gobject.GObject()
     for x in range(10):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]