def test_prop_orientation(self):
        global notify_called

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

        dockpaned = DockPaned()
        dockpaned.connect('notify::orientation', _on_notify)

        notify_called = False
        dockpaned.set_orientation(gtk.ORIENTATION_VERTICAL)
        self.assertEquals(dockpaned.get_orientation(), gtk.ORIENTATION_VERTICAL,
                          msg='get_orientation method did not return expected value')
        self.assertTrue(notify_called,
                        msg='orientation property change notification failed when using set_orientation method')

        notify_called = False
        dockpaned.set_property('orientation', gtk.ORIENTATION_HORIZONTAL)
        self.assertEquals(dockpaned.get_property('orientation'), gtk.ORIENTATION_HORIZONTAL,
                          msg='get_property method did not return expected value')
        self.assertTrue(notify_called,
                        msg='orientation property change notification failed when using set_property method')

        notify_called = False
        dockpaned.props.orientation = gtk.ORIENTATION_VERTICAL
        self.assertEquals(dockpaned.props.orientation, gtk.ORIENTATION_VERTICAL,
                          msg='.props attribute did not return expected value')
        self.assertTrue(notify_called,
                        msg='orientation property change notification failed when using .props attribute')

        dockpaned.destroy()
    def test_prop_handle_size(self):
        global notify_called

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

        dockpaned = DockPaned()
        dockpaned.connect('notify::handle-size', _on_notify)

        notify_called = False
        dockpaned.set_handle_size(1)
        self.assertEquals(dockpaned.get_handle_size(), 1,
                          msg='get_handle_size method did not return expected value')
        self.assertTrue(notify_called,
                        msg='handle-size property change notification failed when using set_handle_size method')

        notify_called = False
        dockpaned.set_property('handle-size', 2)
        self.assertEquals(dockpaned.get_property('handle-size'), 2,
                          msg='get_property method did not return expected value')
        self.assertTrue(notify_called,
                        msg='handle-size property change notification failed when using set_property method')

        notify_called = False
        dockpaned.props.handle_size = 3
        self.assertEquals(dockpaned.props.handle_size, 3,
                          msg='.props attribute did not return expected value')
        self.assertTrue(notify_called,
                        msg='handle-size property change notification failed when using .props attribute')

        dockpaned.destroy()
    def test_item_added_signal(self):
        add_events = []
        item_added_events = []

        def on_add(self, widget):
            add_events.append(widget)

        def on_item_added(dockpaned, child):
            item_added_events.append(child)

        dockgroup1 = DockGroup()
        dockgroup2 = DockGroup()
        dockpaned = DockPaned()
        dockpaned.connect('add', on_add)
        dockpaned.connect('item-added', on_item_added)
        dockpaned.add(dockgroup1)
        dockpaned.insert_item(dockgroup2)

        self.assertTrue(dockgroup1 in item_added_events)
        self.assertTrue(dockgroup1 in add_events)
        self.assertTrue(dockgroup2 in item_added_events)
        self.assertFalse(dockgroup2 in add_events)

        dockgroup2.destroy()
        dockgroup1.destroy()
        dockpaned.destroy()
    def test_item_removed_signal(self):
        remove_events = []
        item_removed_events = []

        def on_remove(self, widget):
            remove_events.append(widget)

        def on_item_removed(dockpaned, child):
            item_removed_events.append(child)

        dockgroup1 = DockGroup()
        dockgroup2 = DockGroup()
        dockpaned = DockPaned()
        dockpaned.connect('remove', on_remove)
        dockpaned.connect('item-removed', on_item_removed)
        dockpaned.add(dockgroup1)
        dockpaned.add(dockgroup2)
        dockpaned.remove(dockgroup1)
        dockpaned.remove_item(0)

        self.assertTrue(dockgroup1 in item_removed_events)
        self.assertTrue(dockgroup1 in remove_events)
        self.assertTrue(dockgroup2 in item_removed_events)
        self.assertFalse(dockgroup2 in remove_events)

        dockgroup1.destroy()
        dockgroup2.destroy()
        dockpaned.destroy()
    def test_add_signal(self):
        add_events = []

        def on_add(self, widget):
            add_events.append(widget)

        dockgroup = DockGroup()
        dockpaned = DockPaned()
        dockpaned.connect('add', on_add)
        dockpaned.add(dockgroup)

        self.assertTrue(dockgroup in add_events)

        dockgroup.destroy()
        dockpaned.destroy()