def test_get_current_item(self): dockitem = DockItem() dockgroup = DockGroup() self.assertTrue(dockgroup.get_current_item() is None) index = dockgroup.append_item(dockitem) self.assertTrue(dockgroup.get_current_item() == index) dockgroup.remove(dockitem) self.assertTrue(dockgroup.get_current_item() is None) dockitem.destroy() dockgroup.destroy()
def test_get_current_item(self): dockitem = DockItem() dockgroup = DockGroup() self.assertTrue(dockgroup.get_current_item() is None) index = dockgroup.append_item(dockitem) self.assertTrue(dockgroup.get_current_item() == index) dockgroup.remove(dockitem) self.assertTrue(dockgroup.get_current_item() is None) dockitem.destroy() dockgroup.destroy()
def test_remove(self): win = gtk.Window() dockitem = DockItem() dockgroup = DockGroup() dockgroup.add(dockitem) win.add(dockgroup) win.show_all() assert dockitem.flags() & gtk.REALIZED dockgroup.remove(dockitem) self.assertTrue(dockitem not in dockgroup) win.destroy() assert not dockitem.flags() & gtk.REALIZED assert not dockgroup.flags() & gtk.REALIZED
def test_remove(self): win = gtk.Window() dockitem = DockItem() dockgroup = DockGroup() dockgroup.add(dockitem) win.add(dockgroup) win.show_all() assert dockitem.flags() & gtk.REALIZED dockgroup.remove(dockitem) self.assertTrue(dockitem not in dockgroup) win.destroy() assert not dockitem.flags() & gtk.REALIZED assert not dockgroup.flags() & gtk.REALIZED
def test_remove_signal(self): remove_events = [] item_removed_events = [] def on_remove(self, widget): remove_events.append(widget) def on_item_removed(dockgroup, child): item_removed_events.append(child) dockitem = DockItem() dockitem.add(gtk.Button()) dockgroup = DockGroup() dockgroup.connect('remove', on_remove) dockgroup.connect('item-removed', on_item_removed) dockgroup.add(dockitem) dockgroup.remove(dockitem) self.assertTrue(dockitem in remove_events) self.assertTrue(dockitem in item_removed_events) dockitem.destroy() dockgroup.destroy()
def test_remove_signal(self): remove_events = [] item_removed_events = [] def on_remove(self, widget): remove_events.append(widget) def on_item_removed(dockgroup, child): item_removed_events.append(child) dockitem = DockItem() dockitem.add(gtk.Button()) dockgroup = DockGroup() dockgroup.connect('remove', on_remove) dockgroup.connect('item-removed', on_item_removed) dockgroup.add(dockitem) dockgroup.remove(dockitem) self.assertTrue(dockitem in remove_events) self.assertTrue(dockitem in item_removed_events) dockitem.destroy() dockgroup.destroy()