Ejemplo n.º 1
0
    def test_next_item(self):
        dockitem1 = DockItem()
        dockitem2 = DockItem()
        dockgroup = DockGroup()
        dockgroup.add(dockitem1)
        dockgroup.add(dockitem2)
        dockgroup.set_current_item(0)
        self.assertTrue(dockgroup.get_current_item() == 0)

        dockgroup.next_item()
        self.assertTrue(dockgroup.get_current_item() == 1)

        dockgroup.next_item()
        self.assertTrue(dockgroup.get_current_item() == 1)

        dockitem1.destroy()
        dockitem2.destroy()
        dockgroup.destroy()
Ejemplo n.º 2
0
    def test_set_current_item(self):
        dockitem1 = DockItem()
        dockitem2 = DockItem()
        dockgroup = DockGroup()
        self.assertTrue(dockgroup.get_current_item() is None)

        index = dockgroup.append_item(dockitem1)
        self.assertTrue(dockgroup.get_current_item() == index)

        index = dockgroup.append_item(dockitem2)
        self.assertTrue(dockgroup.get_current_item() == index)

        dockgroup.set_current_item(0)
        self.assertTrue(dockgroup.get_current_item() == 0)

        dockgroup.set_current_item(len(dockgroup) + 10)
        self.assertTrue(dockgroup.get_current_item() == len(dockgroup) - 1)

        dockgroup.set_current_item(-1)
        self.assertTrue(dockgroup.get_current_item() == 0)

        dockitem1.destroy()
        dockitem2.destroy()
        dockgroup.destroy()