示例#1
0
 def test_adding_data(self):
     parent = Parent()
     items = PopupMenuItems(parent, ['Do Something'])
     assert_equal(len(items._items), 1)
     items.add_menu_item(PopupMenuItem('Do', parent=parent))
     assert_equal(len(items._items), 2)
     _test = lambda: None
     items.add_menu_item(PopupMenuItem('Do', callable=_test))
     assert_equal(len(items._items), 3)
     assert_equal(items._items[-1].callable, _test)
示例#2
0
 def test_adding_separator(self):
     items = PopupMenuItems()
     items.add_separator()
     assert_equal(len(items._items), 1)
示例#3
0
 def test_initing_with_data(self):
     parent = Parent()
     items = PopupMenuItems(parent, ['Do Something', 'Do'])
     assert_equal(len(items._items), 2)
示例#4
0
 def test_initing_without_data(self):
     items = PopupMenuItems()
     assert_equal(len(items._items), 0)