Exemplo n.º 1
0
    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()
Exemplo n.º 2
0
    def test_remove_item(self):
        dockgroup1 = DockGroup()
        dockgroup2 = DockGroup()
        dockgroup3 = DockGroup()
        dockpaned = DockPaned()
        dockpaned.add(dockgroup1)
        dockpaned.add(dockgroup2)
        dockpaned.add(dockgroup3)
        dockpaned.remove_item(None)
        dockpaned.remove_item(0)
        dockpaned.remove_item(-1)

        self.assertTrue(dockgroup1 not in dockpaned)
        self.assertTrue(dockgroup2 not in dockpaned)

        dockgroup2.destroy()
        dockgroup1.destroy()
        dockpaned.destroy()