mirror of
https://github.com/python/cpython
synced 2026-11-14 10:17:33 +03:00
* gh-154511: Consolidate IDLE's mouse wheel handling in util (GH-156974)
Move wheel_event there from idlelib.tree and add x11_buttons(widget) and
bind_wheel(widget, func), used by the editor, the tree and test_sidebar.
wheel_event now reads the direction from the event, not the platform.
Move its test from test_tree, and test the fix_ functions of util too.
(cherry picked from commit 57594aae5e)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Misc.tk_scaling is new in 3.16, and fix_scaling itself calls "tk
scaling" here.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
33 lines
792 B
Python
33 lines
792 B
Python
"Test tree. coverage 56%."
|
|
|
|
from idlelib import tree
|
|
import unittest
|
|
from test.support import requires
|
|
requires('gui')
|
|
from tkinter import Tk
|
|
|
|
|
|
class TreeTest(unittest.TestCase):
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.root = Tk()
|
|
cls.root.withdraw()
|
|
|
|
@classmethod
|
|
def tearDownClass(cls):
|
|
cls.root.destroy()
|
|
del cls.root
|
|
|
|
def test_init(self):
|
|
# Start with code slightly adapted from htest.
|
|
sc = tree.ScrolledCanvas(
|
|
self.root, bg="white", highlightthickness=0, takefocus=1)
|
|
sc.frame.pack(expand=1, fill="both", side='left')
|
|
item = tree.FileTreeItem(tree.ICONDIR)
|
|
node = tree.TreeNode(sc.canvas, None, item)
|
|
node.expand()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main(verbosity=2)
|