Ejemplo n.º 1
0
    def test_prop_title(self):
        global notify_called

        def _on_notify(gobject, pspec):
            global notify_called
            notify_called = True

        dockitem = DockItem()
        dockitem.connect('notify::title', _on_notify)

        notify_called = False
        dockitem.set_title('sometitle')
        self.assertEquals(dockitem.get_title(), 'sometitle',
                          msg='get_title method did not return expected value')
        self.assertTrue(notify_called,
                        msg='title property change notification failed when using set_title method')

        notify_called = False
        dockitem.set_property('title', 'anothertitle')
        self.assertEquals(dockitem.get_property('title'), 'anothertitle',
                          msg='get_property method did not return expected value')
        self.assertTrue(notify_called,
                        msg='title property change notification failed when using set_property method')

        notify_called = False
        dockitem.props.title = 'hello'
        self.assertEquals(dockitem.props.title, 'hello',
                          msg='.props attribute did not return expected value')
        self.assertTrue(notify_called,
                        msg='title property change notification failed when using .props attribute')

        dockitem.destroy()