MCPcopy Index your code
hub / github.com/python/cpython / test_heading_callback

Method test_heading_callback

Lib/test/test_ttk/test_widgets.py:1672–1705  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1670 anchor=1)
1671
1672 def test_heading_callback(self):
1673 def simulate_heading_click(x, y):
1674 if tk_version >= (8, 6):
1675 self.assertEqual(self.tv.identify_column(x), '#0')
1676 self.assertEqual(self.tv.identify_region(x, y), 'heading')
1677 simulate_mouse_click(self.tv, x, y)
1678 self.tv.update()
1679
1680 success = [] # no success for now
1681
1682 self.tv.pack()
1683 self.tv.heading('#0', command=lambda: success.append(True))
1684 self.tv.column('#0', width=100)
1685 self.tv.update()
1686
1687 # assuming that the coords (5, 5) fall into heading #0
1688 simulate_heading_click(5, 5)
1689 if not success:
1690 self.fail("The command associated to the treeview heading wasn't "
1691 "invoked.")
1692
1693 success = []
1694 commands = self.tv.master._tclCommands
1695 self.tv.heading('#0', command=str(self.tv.heading('#0', command=None)))
1696 self.assertEqual(commands, self.tv.master._tclCommands)
1697 simulate_heading_click(5, 5)
1698 if not success:
1699 self.fail("The command associated to the treeview heading wasn't "
1700 "invoked.")
1701
1702 # XXX The following raises an error in a tcl interpreter, but not in
1703 # Python
1704 #self.tv.heading('#0', command='I dont exist')
1705 #simulate_heading_click(5, 5)
1706
1707 def test_index(self):
1708 # item 'what' doesn't exist

Callers

nothing calls this directly

Calls 8

strFunction · 0.85
packMethod · 0.45
headingMethod · 0.45
appendMethod · 0.45
columnMethod · 0.45
updateMethod · 0.45
failMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected