コード例 #1
0
    def test_append_item(self):
        dockgroup1 = DockGroup()
        dockgroup2 = DockGroup()
        dockpaned = DockPaned()
        item_num1 = dockpaned.append_item(dockgroup1)
        item_num2 = dockpaned.append_item(dockgroup2)

        self.assertTrue(item_num1 == 0)
        self.assertTrue(dockpaned.get_nth_item(0) is dockgroup1)
        self.assertTrue(item_num2 == 1)
        self.assertTrue(dockpaned.get_nth_item(1) is dockgroup2)

        dockgroup2.destroy()
        dockgroup1.destroy()
        dockpaned.destroy()
コード例 #2
0
    def test_insert_item(self):
        dockgroup1 = DockGroup()
        dockgroup2 = DockGroup()
        dockgroup3 = DockGroup()
        dockpaned = DockPaned()
        item_num1 = dockpaned.insert_item(dockgroup1, position=None)
        self.assertTrue(item_num1 == 0)
        item_num2 = dockpaned.insert_item(dockgroup2, position=-1)
        self.assertTrue(item_num2 == 1)
        item_num3 = dockpaned.insert_item(dockgroup3, position=1, weight=0.5)
        self.assertTrue(item_num3 == 1)

        self.assertTrue(dockpaned.get_nth_item(0) is dockgroup1)
        self.assertTrue(dockpaned.get_nth_item(1) is dockgroup3)
        self.assertTrue(dockpaned.get_nth_item(2) is dockgroup2)

        dockgroup3.destroy()
        dockgroup2.destroy()
        dockgroup1.destroy()
        dockpaned.destroy()
コード例 #3
0
    def test_get_nth_item(self):
        dockgroup1 = DockGroup()
        dockgroup2 = DockGroup()
        dockpaned = DockPaned()
        dockpaned.add(dockgroup1)
        dockpaned.add(dockgroup2)

        self.assertTrue(dockpaned.get_nth_item(0) == dockgroup1)
        self.assertTrue(dockpaned.get_nth_item(1) == dockgroup2)

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